Esempio n. 1
0
 public MappingBase(Section section, string name, string Prefix, string Postfix)
 {
     this.Name = name;
     this.Section = section;
     this.TilePrefix = Prefix;
     this.TilePostfix = Postfix;
 }
Esempio n. 2
0
 public SectionToVolumeMapping(Section section, string name,  FixedTileCountMapping sourceMapping, TriangulationTransform volumeTransform)
     : base(section, name, sourceMapping.TilePrefix, sourceMapping.TilePostfix)
 {
     HasBeenWarped = false;
     SourceMapping = sourceMapping;
     VolumeTransform = volumeTransform;
 }
Esempio n. 3
0
 public TileGridMapping(Section section,
                        string name,
                        string Prefix, string Postfix,
                        int TileSizeX, int TileSizeY, 
                        string GridTilePath, 
                        string GridCoordFormat)
     : base(section, name, Prefix, Postfix, TileSizeX, TileSizeY, GridTilePath, GridCoordFormat)
 {
 }
Esempio n. 4
0
 public TileGridMappingBase(Section section, string name, string Prefix, string Postfix, int TileSizeX, int TileSizeY, string TileGridPath, string GridCoordFormat=null)
     : base(section, name, Prefix, Postfix)
 {
     this.TileSizeX = TileSizeX;
     this.TileSizeY = TileSizeY;
     this.TotalTileSize = TileSizeX * TileSizeY;
     this.TileGridPath = TileGridPath;
     if(GridCoordFormat != null)
         this.GridCoordFormat = GridCoordFormat;
 }
Esempio n. 5
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if(listSections.SelectedObject == null)
            {
                MessageBox.Show("Please select a section or press cancel.", "No section selected");
                return;
            }

            SelectedSection = listSections.SelectedObject as Section;

            this.Close();
        }
Esempio n. 6
0
        protected readonly string Host; //Host for tile paths, Viking will set to volume host if null

        #endregion Fields

        #region Constructors

        public TileServerMapping(Section section,
                                 string name,
                                 string Prefix, string Postfix,
                                 int TileSizeX, int TileSizeY,
                                 string TileServerHost, 
                                 string CoordSpaceName, 
                                 string TileGridPath,
                                 string GridCoordFormat = null)
            : base(section, name, Prefix, Postfix, TileSizeX, TileSizeY, TileGridPath, GridCoordFormat)
        {
            this.Host = TileServerHost;
            this.CoordSpaceName = CoordSpaceName;
        }
Esempio n. 7
0
        public TileGridToVolumeMapping(Section section, string name, TileGridMapping ToWarp, TriangulationTransform Transform)
            : base(ToWarp, section, name)
        {
            this.VolumeTransform = Transform;

            /*
            //Create a single grid transform for all tiles
            GridToVolumeTransform = new GridTransform();

            GridInfo gridInfo = LevelToGridInfo[this.MinDownsample];

            MappingGridVector2[] mappingPoints = new MappingGridVector2[(gridInfo.GridYDim+1) * (gridInfo.GridXDim+1)];
            int[] TriangleIndicies = new int[gridInfo.GridYDim * gridInfo.GridXDim * 6];

            int iPoint = 0;
            int iTriangle = 0;
            for(int iX = 0; iX <= gridInfo.GridXDim; iX++)
            {
                for(int iY = 0; iY <= gridInfo.GridYDim; iY++, iPoint++)
                {
                    GridVector2 controlPoint = new GridVector2(iX * this.TileSizeX,
                                                               iY * this.TileSizeY);
                    GridVector2 mappedPoint = controlPoint; //This will get warped later when we add to volume transform
                    MappingGridVector2 PointPair = new MappingGridVector2(controlPoint, mappedPoint);

                    mappingPoints[iPoint] = PointPair;

                    if(iY < gridInfo.GridYDim &&
                       iX < gridInfo.GridXDim)
                    {
                        TriangleIndicies[iTriangle++] = iPoint;
                        TriangleIndicies[iTriangle++] = iPoint + 1;
                        TriangleIndicies[iTriangle++] = iPoint + gridInfo.GridYDim + 1;

                        TriangleIndicies[iTriangle++] = iPoint + 1;
                        TriangleIndicies[iTriangle++] = iPoint + gridInfo.GridYDim + 1;
                        TriangleIndicies[iTriangle++] = iPoint + gridInfo.GridYDim + 2;
                    }
                }
            }

            //Todo: If we add the mapping points from the volume transform here they can be included in the output verticies

            GridToVolumeTransform.SetPointsAndTriangles(mappingPoints, TriangleIndicies);

            //            GridToVolumeTransform.Add(VolumeTransform);
             */
        }
Esempio n. 8
0
        protected TileGridMappingBase(TileGridMappingBase ToCopy, Section section, string name)
            : base(section, name, ToCopy.TilePrefix, ToCopy.TilePostfix)
        {
            TileSizeX = ToCopy.TileSizeX;
            TileSizeY = ToCopy.TileSizeY;
            TotalTileSize = ToCopy.TotalTileSize;
            TileGridPath = ToCopy.TileGridPath;
            MinDownsample = ToCopy.MinDownsample;
            MaxDownsample = ToCopy.MaxDownsample;
            this.GridCoordFormat = ToCopy.GridCoordFormat;

            foreach(GridInfo info in ToCopy.LevelToGridInfo.Values)
            {
                GridInfo infoCopy = new GridInfo(info.GridXDim, info.GridYDim, info.Downsample, info.Path);
                LevelToGridInfo.Add(infoCopy.Downsample, infoCopy);
            }
        }
Esempio n. 9
0
        public static TileGridMapping CreateFromTilesetElement(XElement TilesetNode, Section section)
        {
            string Name = IO.GetAttributeCaseInsensitive(TilesetNode, "name").Value;
            string mosaicTransformPath = IO.GetAttributeCaseInsensitive(TilesetNode, "path").Value;
            int TileSizeX = System.Convert.ToInt32(IO.GetAttributeCaseInsensitive(TilesetNode, "TileXDim").Value);
            int TileSizeY = System.Convert.ToInt32(IO.GetAttributeCaseInsensitive(TilesetNode, "TileYDim").Value);
            string TilePrefix = IO.GetAttributeCaseInsensitive(TilesetNode, "FilePrefix").Value;
            string TilePostfix = IO.GetAttributeCaseInsensitive(TilesetNode, "FilePostfix").Value;
            string TileGridPath = IO.GetAttributeCaseInsensitive(TilesetNode, "path").Value;
            string GridTileFormat = null;

            XAttribute GridTileFormatAttribute = TilesetNode.Attribute("CoordFormat");
            if(GridTileFormatAttribute != null)
            {
                GridTileFormat = TileGridMapping.GridTileFormatStringFromPythonString(GridTileFormatAttribute.Value.ToString());
            }

            TileGridMapping mapping = new TileGridMapping(section, Name, TilePrefix, TilePostfix,
                                                          TileSizeX, TileSizeY, TileGridPath, GridTileFormat);

            foreach (XNode node in TilesetNode.Nodes())
            {
                XElement elem = node as XElement;
                if (elem == null)
                    continue;

                //Fetch the name if we know it
                switch (elem.Name.LocalName)
                {
                    case "Level":
                        mapping.AddLevel(System.Convert.ToInt32(IO.GetAttributeCaseInsensitive(elem, "Downsample").Value),
                                       System.Convert.ToInt32(IO.GetAttributeCaseInsensitive(elem, "GridDimX").Value),
                                       System.Convert.ToInt32(IO.GetAttributeCaseInsensitive(elem, "GridDimY").Value),
                                       IO.GetAttributeCaseInsensitive(elem, "path").Value);
                        break;
                }

            }

            return mapping;
        }
Esempio n. 10
0
 public TileServerToVolumeMapping(Section section, string name, TileServerMapping ToWarp, TriangulationTransform Transform)
     : base(ToWarp, section, name)
 {
     this.VolumeTransform = Transform;
 }
Esempio n. 11
0
 private void AddTileServerToSectionMappings(Section section)
 {
     foreach(TileServerInfo tileserver in this.TileServerList.Values)
     {
         section.AddTileserver(tileserver);
     }
 }
Esempio n. 12
0
 public SectionViewModelBase(Volume Volume, Section section)
 {
     this._VolumeModel = Volume;
     this.section = section;
 }
Esempio n. 13
0
        /// <summary>
        /// Called on the main thread after a section has loaded on a worker thread
        /// </summary>
        private void OnSectionLoadComplete(Section section)
        {
            foreach(string name in section.ChannelNames)
            {
                this.AddChannel(name);
            }

            this.AddTileServerToSectionMappings(section);

            if(this.DefaultTileset != null)
            {
                if(section.ChannelNames.Contains(DefaultTileset))
                {
                    section.DefaultTileset = DefaultTileset;
                }
            }

            this.SectionsTable.Add(section.Number, section);
        }
Esempio n. 14
0
 public FixedTileCountMapping(Section section, string name, string Prefix, string Postfix)
     : base(section, name, Prefix, Postfix)
 {
 }
Esempio n. 15
0
 public TilesToSectionMapping(Section section, string name, string rootPath, string mosaicPath, string tilePrefix, string tilePostfix)
     : base(section, name, tilePrefix, tilePostfix)
 {
     this.RootPath = rootPath;
     this.MosaicPath = mosaicPath;
 }
Esempio n. 16
0
        public void ThreadPoolCallback(Object threadContext)
        {
            newSection = new Section(volume, SectionPath, reader);

            DoneEvent.Set();
        }
Esempio n. 17
0
 protected TileServerMapping(TileServerMapping ToCopy, Section section, string name)
     : base(ToCopy, section, name)
 {
     this.Host = ToCopy.Host;
     this.CoordSpaceName = ToCopy.CoordSpaceName;
 }
Esempio n. 18
0
 protected TileGridMapping(TileGridMapping ToCopy, Section section, string name)
     : base(ToCopy, section, name)
 {
 }
Esempio n. 19
0
 public SectionViewModel(VolumeViewModel Volume, Section section)
 {
     this._VolumeViewModel = Volume;
     this.section = section;
 }
Esempio n. 20
0
        /// <summary>
        /// Returns the section that the passed section was registered to
        /// </summary>
        /// <param name="?"></param>
        /// <returns></returns>
        public Section GetReferenceSectionBelow(Section section)
        {
            if (section == null)
                return null;

            //Optimistic implementation that looks at section immediately above
            int refnumber = section.Number - 1;
            int minSectionNumber = SectionsTable.Keys.Min();
            while (refnumber >= minSectionNumber)
            {
                if (SectionsTable.ContainsKey(refnumber))
                    return SectionsTable[refnumber];
                refnumber--;
            }

            return null;
        }
Esempio n. 21
0
        /// <summary>
        /// Returns the section that the passed section was registered to
        /// </summary>
        /// <param name="?"></param>
        /// <returns></returns>
        public Section GetReferenceSectionAbove(Section section)
        {
            if (section == null)
                return null;

            //Optimistic implementation that looks at section immediately above
            int refnumber = section.Number + 1;
            int maxSectionNumber = SectionsTable.Keys.Max();
            while (refnumber <= maxSectionNumber)
            {
                if (SectionsTable.ContainsKey(refnumber))
                    return SectionsTable[refnumber];
                refnumber++;
            }

            return null;
        }
Esempio n. 22
0
 public SectionViewModel(Volume Volume, Section section)
     : base(Volume, section)
 {
 }