コード例 #1
0
        /// <summary>
        /// Creates a MultiPolygon using the next token in the stream.
        /// </summary>
        /// <param name="tokenizer">
        /// Tokenizer over a stream of text in Well-known Text
        /// format. The next tokens must form a &lt;MultiPolygon Text&gt;.
        /// </param>
        /// <returns>
        /// A MultiPolygon specified by the next token in the stream, or if
        /// the coordinates used to create the Polygon shells and holes do
        /// not form closed linestrings.
        /// </returns>
        /// <exception cref=IOException"">
        /// If an I/O error occurs.
        /// </exception>
        /// <exception cref="GeometryIOException">
        /// if an unexpected token was encountered.
        /// </exception>
        private MultiPolygon ReadMultiPolygon(StreamTokenizer tokenizer)
        {
            string nextToken = GetNextEmptyOrOpener(tokenizer);

            if (nextToken.Equals(WktEmpty))
            {
                return(m_objFactory.CreateMultiPolygon(new Polygon[] {}));
            }

            GeometryList polygons = new GeometryList();
            Polygon      polygon  = ReadPolygon(tokenizer);

            polygons.Add(polygon);
            nextToken = GetNextCloserOrComma(tokenizer);
            while (nextToken.Equals(TokenComma))
            {
                polygon = ReadPolygon(tokenizer);

                polygons.Add(polygon);
                nextToken = GetNextCloserOrComma(tokenizer);
            }

            return(m_objFactory.CreateMultiPolygon(
                       polygons.ToPolygonArray()));
        }
コード例 #2
0
        /// <summary>
        /// Creates a MultiLineString using the next token in the stream.
        /// </summary>
        /// <param name="tokenizer">
        /// Tokenizer over a stream of text in Well-known Text
        /// format. The next tokens must form a &lt;MultiLineString Text&gt;.
        /// </param>
        /// <returns>
        /// A MultiLineString specified by the next token in the stream.
        /// </returns>
        /// <exception cref="IOException">
        /// If an I/O error occurs.
        /// </exception>
        /// <exception cref="GeometryIOException">
        /// If an unexpected token was encountered.
        /// </exception>
        private MultiLineString ReadMultiLineString(StreamTokenizer tokenizer)
        {
            string nextToken = GetNextEmptyOrOpener(tokenizer);

            if (nextToken.Equals(WktEmpty))
            {
                return(m_objFactory.CreateMultiLineString(
                           new LineString[] {}));
            }

            GeometryList lineStrings = new GeometryList();
            LineString   lineString  = ReadLineString(tokenizer);

            lineStrings.Add(lineString);
            nextToken = GetNextCloserOrComma(tokenizer);
            while (nextToken.Equals(TokenComma))
            {
                lineString = ReadLineString(tokenizer);
                lineStrings.Add(lineString);
                nextToken = GetNextCloserOrComma(tokenizer);
            }

            return(m_objFactory.CreateMultiLineString(
                       lineStrings.ToLineStringArray()));
        }
コード例 #3
0
        private Polygon EditPolygon(Polygon polygon, IGeometryEdit operation)
        {
            Polygon newPolygon = (Polygon)operation.Edit(polygon, m_objFactory);

            if (newPolygon.IsEmpty)
            {
                //RemoveSelectedPlugIn relies on this behaviour. [Jon Aquino]
                return(newPolygon);
            }

            LinearRing shell = (LinearRing)Edit(newPolygon.ExteriorRing, operation);

            if (shell.IsEmpty)
            {
                //RemoveSelectedPlugIn relies on this behaviour. [Jon Aquino]
                return(m_objFactory.CreatePolygon(null, null));
            }

            GeometryList holes = new GeometryList();

            for (int i = 0; i < newPolygon.NumInteriorRings; i++)
            {
                LinearRing hole = (LinearRing)Edit(newPolygon.InteriorRing(i), operation);

                if (hole.IsEmpty)
                {
                    continue;
                }

                holes.Add(hole);
            }

            return(m_objFactory.CreatePolygon(shell, holes.ToLinearRingArray()));
        }
コード例 #4
0
        public override void UpdateGeometry()
        {
            GeometryList.Clear();
            GeometryList.Add(Name + "Up", new Geometry2D(Name, "StandardMenu", PX * ScreenWidth, PY * ScreenHeight, SX * ScreenWidth, SY * ScreenHeight, TX, TY, TSX, TSY, Z));
            GeometryList.Add(Name + "Down", new Geometry2D(Name, "StandardMenu", PX * ScreenWidth, PY * ScreenHeight, SX * ScreenWidth, SY * ScreenHeight, TX, TY, TSX, TSY, Z));

            float Buffer    = SX * 0.1f;
            float LetterGap = 0.75f;

            LetterGap = Text.Length > 1 ? LetterGap : 1;
            float DX = (SX - Buffer) / Text.Length;
            float OY = (SY - DX) / 2.0f;

            float DY = DX;

            DY = DY > SY / 4.0f ? DY : SY / 4.0f;

            for (int i = 0; i < Text.Length; i++)
            {
                int Index = Text[i] - 1;

                string Bit = Text[i].ToString();

                /*
                 * if ( Int32.TryParse(Bit, out int n))
                 * {
                 *  Index = 64 + Int32.Parse(Bit);
                 * }
                 */

                GeometryList.Add(Name + i, new Geometry2D(Name + i, "StandardText", (PX + Buffer / 2) * ScreenWidth + (DX * LetterGap * i * ScreenWidth), (PY + OY) * ScreenHeight, DX * (2.0f - LetterGap) * ScreenWidth, DY * ScreenHeight, 0.0625f * (Index % 16), 0.0625f * (Index / 16), 0.0625f, 0.0625f, Z + 0.1f));
            }
            NeedsNodeUpdate = true;
        }
コード例 #5
0
 /// <summary>
 /// Validates the specified geometry or returns <c>null</c> for invalid geometries.
 /// </summary>
 /// <remarks>
 /// The algorithm fixes the issues produced by the application of <see cref="PrecisionModel"/>.
 /// </remarks>
 /// <param name="geometry">The geometry.</param>
 /// <returns>A valid geometry or <c>null</c>.</returns>
 public static IGeometry Validate(IGeometry geometry)
 {
     if (geometry is IPolygon)
     {
         return(Validate(geometry as IPolygon));
     }
     else if (geometry is IGeometryCollection <IGeometry> )
     {
         IGeometryFactory factory = geometry.Factory;
         var collection           = new GeometryList <IGeometry>(factory, null);
         foreach (IGeometry subGeometry in (IGeometryCollection <IGeometry>)geometry)
         {
             try
             {
                 collection.Add(Validate(subGeometry));
             }
             catch (ArgumentNullException) { }  // null value cannot be added to the collection
         }
         if (collection.Count == 0)
         {
             collection = null;
         }
         return(collection);
     }
     else
     {
         return(geometry.IsValid ? geometry : null);
     }
 }
コード例 #6
0
        protected virtual Geometry Transform(GeometryCollection geom, Geometry parent)
        {
            GeometryList transGeomList = new GeometryList();

            for (int i = 0; i < geom.NumGeometries; i++)
            {
                Geometry transformGeom = Transform(geom[i]);
                if (transformGeom == null)
                {
                    continue;
                }
                if (pruneEmptyGeometry && transformGeom.IsEmpty)
                {
                    continue;
                }

                transGeomList.Add(transformGeom);
            }

            if (preserveGeometryCollectionType)
            {
                return(geomFactory.CreateGeometryCollection(transGeomList.ToArray()));
            }

            return(geomFactory.BuildGeometry(transGeomList));
        }
コード例 #7
0
ファイル: LineSequencer.cs プロジェクト: spacefan/iGeospatial
        /// <summary>
        /// Builds a geometry (<see cref="LineString"/> or <see cref="MultiLineString"/> )
        /// representing the sequence.
        ///
        /// </summary>
        /// <param name="sequences">a List of Lists of DirectedEdges with
        /// LineMergeEdges as their parent edges.
        /// </param>
        /// <returns> the sequenced geometry, or <code>null</code> if no sequence exists
        /// </returns>
        private Geometry BuildSequencedGeometry(IList sequences)
        {
            GeometryList lines = new GeometryList();

            for (IEnumerator i1 = sequences.GetEnumerator(); i1.MoveNext();)
            {
                IList seq = (IList)i1.Current;

                for (IEnumerator i2 = seq.GetEnumerator(); i2.MoveNext();)
                {
                    DirectedEdge  de   = (DirectedEdge)i2.Current;
                    LineMergeEdge e    = (LineMergeEdge)de.Edge;
                    LineString    line = e.Line;

                    LineString lineToAdd = line;
                    if (!de.EdgeDirection && !line.IsClosed)
                    {
                        lineToAdd = Reverse(line);
                    }

                    lines.Add(lineToAdd);
                }
            }

            if (lines.Count == 0)
            {
                return(factory.CreateMultiLineString(new LineString[0]));
            }

            return(factory.BuildGeometry(lines));
        }
コード例 #8
0
        /// <summary>
        /// Creates a Polygon using the next token in the stream.
        /// </summary>
        /// <param name="tokenizer">
        /// Tokenizer over a stream of text in Well-known Text
        /// format. The next tokens must form a &lt;Polygon Text&gt;.
        /// </param>
        /// <returns>
        /// A Polygon specified by the next token in the stream.
        /// </returns>
        /// <exception cref="GeometryIOException">
        /// If the coordinates used to create the Polygon shell and holes do
        /// not form closed linestrings, or if an unexpected token was
        /// encountered.
        /// </exception>
        /// <exception cref="IOException">
        /// If an I/O error occurs.
        /// </exception>
        private Polygon ReadPolygon(StreamTokenizer tokenizer)
        {
            string nextToken = GetNextEmptyOrOpener(tokenizer);

            if (nextToken.Equals(WktEmpty))
            {
                LinearRing objRing = m_objFactory.CreateLinearRing(new Coordinate[] {});

                return(m_objFactory.CreatePolygon(objRing, new LinearRing[] {}));
            }

            GeometryList holes = new GeometryList();
            LinearRing   shell = ReadLinearRing(tokenizer);

            nextToken = GetNextCloserOrComma(tokenizer);

            while (nextToken.Equals(TokenComma))
            {
                LinearRing hole = ReadLinearRing(tokenizer);
                holes.Add(hole);
                nextToken = GetNextCloserOrComma(tokenizer);
            }

            return(m_objFactory.CreatePolygon(shell,
                                              holes.ToLinearRingArray()));
        }
コード例 #9
0
ファイル: Polygonizer.cs プロジェクト: spacefan/iGeospatial
        /// <summary>
        /// Perform the polygonization, if it has not already been carried out.
        /// </summary>
        public void Polygonize()
        {
            // check if already computed
            if (polyList != null)
            {
                return;
            }

//?            polyList = new ArrayList();

            m_arrDangles  = graph.DeleteDangles();
            m_arrCutEdges = graph.DeleteCutEdges();
            ArrayList edgeRingList = graph.EdgeRings;

            ArrayList validEdgeRingList = new ArrayList();

            m_arrInvalidRingLines = new GeometryList();
            FindValidRings(edgeRingList, validEdgeRingList, m_arrInvalidRingLines);

            FindShellsAndHoles(validEdgeRingList);
            AssignHolesToShells(holeList, shellList);

            polyList = new GeometryList();

            for (IEnumerator i = shellList.GetEnumerator(); i.MoveNext();)
            {
                EdgeRing er = (EdgeRing)i.Current;

                polyList.Add(er.Polygon);
            }
        }
コード例 #10
0
        public override void UpdateGeometry()
        {
            GeometryList.Clear();
            GeometryList.Add(Name + "Background", new Geometry2D(Name + "StandardMenu", "StandardMenu", PX * ScreenWidth, PY * ScreenHeight, SX * ScreenWidth, SY * ScreenHeight, TX, TY, TSX, TSY, Z));

            if (Lines.Count > 0)
            {
                float LetterGap = 0.5f;
                float DY        = SY / MaxLineCount;
                float DX        = DY;

                for (int i = CurrentIndex; i < CurrentIndex + MaxLineCount && i < Lines.Count; i++)
                {
                    string Line = Lines[i];


                    float AllowedLength = SX / (DX * LetterGap);

                    for (int j = 0; j < AllowedLength && j < Line.Length; j++)
                    {
                        //get text texcoord
                        int Index = Line[j] - 1;
                        GeometryList.Add(Name + i + "-" + j, new Geometry2D(Name + i + "-" + j, "StandardText", (PX + DX * LetterGap * j) * ScreenWidth, (PY + DY * i) * ScreenHeight, DX * ScreenWidth, DY * ScreenHeight, 0.0625f * (Index % 16), 0.0625f * (Index / 16), 0.0625f, 0.0625f, Z + 0.1f));

                        //GeometryList.Add(Name + i, new Geometry2D(Name + i, "StandardText", (PX + DX * j + Buffer / 2) * ScreenWidth + (DX * i * ScreenWidth), (PY + OY) * ScreenHeight, DX * (2.0f - LetterGap) * ScreenWidth, DY * ScreenHeight, 0.0625f * (Index % 16), 0.0625f * (Index / 16), 0.0625f, 0.0625f, Z + 0.1f));
                    }
                }

                GeometryList.Add(Name + "HighLight", new Geometry2D(Name + "HighLight", "StandardMenu", PX * ScreenWidth, (PY + (SY / MaxLineCount * CurrentLocalIndex)) * ScreenHeight, SX * ScreenWidth, SY / MaxLineCount * ScreenHeight, 0.75f, 0, 0.1875f, 0.0625f, Z));
            }
            NeedsNodeUpdate = true;
        }
コード例 #11
0
ファイル: RWClumpNode.cs プロジェクト: zarroboogs/Amicitia
        /// <summary>
        /// Replace the geometries in the scene with the ones contained in the given Assimp scene.
        /// </summary>
        /// <param name="scene"></param>
        public void ReplaceGeometries(Assimp.Scene scene)
        {
            var skinToBoneMatrices = ComputeSkinToBoneMatrices(scene);

            GeometryList.Clear();
            Atomics.Clear();

            for (var i = 0; i < scene.Meshes.Count; i++)
            {
                var assimpMesh = scene.Meshes[i];

                var rootNode = FindMeshRootNode(scene.RootNode, i) ?? scene.RootNode;
                TransformMeshVertices(assimpMesh, rootNode);

                var geometryNode = new RwGeometryNode(this, assimpMesh, scene.Materials[assimpMesh.MaterialIndex], FrameList, skinToBoneMatrices, out bool singleWeight);
                GeometryList.Add(geometryNode);

                var atomicNode = new RwAtomicNode(this, 0, i, 5);
                if (singleWeight)
                {
                    if (assimpMesh.Bones.Count != 0)
                    {
                        atomicNode.FrameIndex = FrameList.GetFrameIndexByName(assimpMesh.Bones[0].Name);
                    }
                    else if (rootNode != null)
                    {
                        atomicNode.FrameIndex = FrameList.GetFrameIndexByName(rootNode.Name);
                    }
                }

                Atomics.Add(atomicNode);
            }

            mStructNode = new RwClumpStructNode(this);
        }
コード例 #12
0
 public override void GenerateGeometry()
 {
     if (GeometryList.Count > 0)
     {
         GeometryList.Clear();
     }
     GeometryList.Add(Name, new Geometry2D(Name, TextureName, PX * ScreenWidth, PY * ScreenHeight, SX * ScreenWidth, SY * ScreenHeight, 0, 0, 1.0f, 1.0f, Z));
 }
コード例 #13
0
 public virtual void GenerateGeometry()
 {
     if (GeometryList.Count > 0)
     {
         GeometryList.Clear();
     }
     GeometryList.Add(Name, new Geometry2D(Name, TextureName, PX * ScreenWidth, PY * ScreenHeight, SX * ScreenWidth, SY * ScreenHeight, TX, TY, TSX, TSY, Z));
 }
コード例 #14
0
 public void AddLayer(string LayerName, string LayerTexture)
 {
     //geometry
     if (GeometryList.ContainsKey(LayerName))
     {
         GeometryList.Remove(LayerName);
     }
     GeometryList.Add(LayerName, new Geometry2D(LayerName, LayerTexture, PX * ScreenWidth, PY * ScreenHeight, SX * ScreenWidth, SY * ScreenHeight, TX, TY, TSX, TSY, Z));
 }
コード例 #15
0
        /// <summary>
        /// Adds a hole to the polygon formed by this ring.
        /// </summary>
        /// <param name="hole">the {@link LinearRing} forming the hole.
        /// </param>
        public void AddHole(LinearRing hole)
        {
            if (holes == null)
            {
                holes = new GeometryList();
            }

            holes.Add(hole);
        }
コード例 #16
0
        public override void Init(string[] Data, int Width, int Height, Dictionary <string, Effect> Shaders)
        {
            base.Init(Data, Width, Height, Shaders);
            PickerTexture = Data[11];

            ScreenWidth  = Width;
            ScreenHeight = Height;

            GeometryList.Add(Name + "Selector", new Geometry2D(Name, "StandardMenu", PX * ScreenWidth, PY * ScreenHeight, 0, 0, TX, TY, TSX, TSY, Z + 0.25f));
        }
コード例 #17
0
ファイル: PointBuilder.cs プロジェクト: spacefan/iGeospatial
        /// <summary>
        /// Converts non-covered nodes to Point objects and adds them to
        /// the result.
        ///
        /// A node is covered if it is contained in another element Geometry
        /// with higher dimension (e.g. a node point might be contained in a polygon,
        /// in which case the point can be eliminated from the result).
        ///
        /// </summary>
        /// <param name="n">the node to test
        /// </param>
        private void FilterCoveredNodeToPoint(Node n)
        {
            Coordinate coord = n.Coordinate;

            if (!op.IsCoveredByLA(coord))
            {
                Point pt = geometryFactory.CreatePoint(coord);

                resultPointList.Add(pt);
            }
        }
コード例 #18
0
ファイル: LineBuilder.cs プロジェクト: spacefan/iGeospatial
        private void BuildLines(OverlayType opCode)
        {
            // need to simplify lines?
            for (IEnumerator it = lineEdgesList.GetEnumerator(); it.MoveNext();)
            {
                Edge e = (Edge)it.Current;

                LineString line = geometryFactory.CreateLineString(e.Coordinates);
                resultLineList.Add(line);
                e.InResult = true;
            }
        }
コード例 #19
0
        public void AddLayer(string LayerName, string LayerTexture, int TileX, int TileY, float TileZ, int TileSizeX, int TileSizeY, int PixelScale)
        {
            //geometry
            if (GeometryList.ContainsKey(LayerName))
            {
                GeometryList.Remove(LayerName);
            }
            GeometryList.Add(LayerName, new Geometry2D(LayerName, LayerTexture, PX * ScreenWidth, PY * ScreenHeight, SX * ScreenWidth, SY * ScreenHeight, TX, TY, TSX, TSY, Z + TileZ));

            Layers.Add(new Layer(TileX, TileY, TileZ, TileSizeX, TileSizeY, LayerName, PixelScale));
            Layers = Layers.OrderBy(x => x.TileZ).ToList();
        }
コード例 #20
0
        private GeometryList ComputePolygons(EdgeRingCollection shellList)
        {
            GeometryList resultPolyList = new GeometryList();

            // Add Polygons for all shells
            for (IEdgeRingEnumerator it = shellList.GetEnumerator(); it.MoveNext();)
            {
                EdgeRing er   = it.Current;
                Polygon  poly = er.ToPolygon(geometryFactory);
                resultPolyList.Add(poly);
            }

            return(resultPolyList);
        }
コード例 #21
0
        /// <summary>
        /// Creates a GeometryCollection using the next token in the stream.
        /// </summary>
        /// <param name="tokenizer">
        /// Tokenizer over a stream of text in Well-known Text format. The
        /// next tokens must form a &lt;GeometryCollection Text&gt;.
        /// </param>
        /// <returns>
        /// A GeometryCollection specified by the next token in the stream.
        /// </returns>
        /// <exception cref="GeometryIOException">
        /// If the coordinates used to create a Polygon shell and holes do
        /// not form closed linestrings, or if an unexpected token was
        /// encountered.
        /// </exception>
        /// <exception cref="IOException">
        /// If an I/O error occurs.
        /// </exception>
        private GeometryCollection ReadGeometryCollection(StreamTokenizer tokenizer)
        {
            string nextToken = GetNextEmptyOrOpener(tokenizer);

            if (nextToken.Equals(WktEmpty))
            {
                return(m_objFactory.CreateGeometryCollection(new Geometry[] {}));
            }

            GeometryList geometries = new GeometryList();
            Geometry     geometry   = ReadGeometry(tokenizer);

            geometries.Add(geometry);
            nextToken = GetNextCloserOrComma(tokenizer);
            while (nextToken.Equals(TokenComma))
            {
                geometry = ReadGeometry(tokenizer);

                geometries.Add(geometry);
                nextToken = GetNextCloserOrComma(tokenizer);
            }

            return(m_objFactory.CreateGeometryCollection(geometries.ToArray()));
        }
コード例 #22
0
        protected virtual Geometry Transform(Polygon geom, Geometry parent)
        {
            bool     isAllValidLinearRings = true;
            Geometry shell = Transform(geom.ExteriorRing, geom);

            if (shell == null ||
                !(shell.GeometryType == GeometryType.LinearRing) ||
                shell.IsEmpty)
            {
                isAllValidLinearRings = false;
            }

            GeometryList holes = new GeometryList();

            for (int i = 0; i < geom.NumInteriorRings; i++)
            {
                Geometry hole = Transform(geom.InteriorRing(i), geom);
                if (hole == null || hole.IsEmpty)
                {
                    continue;
                }

                if (!(hole.GeometryType == GeometryType.LinearRing))
                {
                    isAllValidLinearRings = false;
                }

                holes.Add(hole);
            }

            if (isAllValidLinearRings)
            {
                return(geomFactory.CreatePolygon((LinearRing)shell,
                                                 holes.ToLinearRingArray()));
            }
            else
            {
                GeometryList components = new GeometryList();
                if (shell != null)
                {
                    components.Add(shell);
                }

                components.AddRange(holes);

                return(geomFactory.BuildGeometry(components));
            }
        }
コード例 #23
0
ファイル: Polygonizer.cs プロジェクト: spacefan/iGeospatial
 private void  FindValidRings(ArrayList edgeRingList,
                              ArrayList validEdgeRingList, GeometryList invalidRingList)
 {
     for (IEnumerator i = edgeRingList.GetEnumerator(); i.MoveNext();)
     {
         EdgeRing er = (EdgeRing)i.Current;
         if (er.IsValid)
         {
             validEdgeRingList.Add(er);
         }
         else
         {
             invalidRingList.Add(er.LineString);
         }
     }
 }
コード例 #24
0
        public override void GenerateGeometry()
        {
            if (GeometryList.Count > 0)
            {
                GeometryList.Clear();
            }
            GeometryList.Add(Name, new Geometry2D(Name, TileTexture, PX * ScreenWidth, PY * ScreenHeight, SX * ScreenWidth, SY * ScreenHeight, 0, 0, 1, 1, 0.0f));

            float SSX = TileSizeX > 50 ? SX * ScreenWidth / 50 : SX * ScreenWidth / TileSizeX;
            float SSY = TileSizeY > 50 ? SY * ScreenWidth / 50 : SY * ScreenHeight / TileSizeY;

            float SPX = TileSizeX > 50 ? PX * ScreenWidth + (SX * ScreenWidth / TileSizeX * TileX) - SSX / 2 : PX * ScreenWidth + (SX * ScreenWidth / TileSizeX * TileX);
            float SPY = TileSizeY > 50 ? PY * ScreenHeight + (SY * ScreenHeight / TileSizeY * TileY) - SSY / 2 : PY * ScreenHeight + (SY * ScreenHeight / TileSizeY * TileY);

            GeometryList.Add(Name + "Selector", new Geometry2D(Name, "StandardMenu", SPX, SPY, SSX, SSY, TX, TY, TSX, TSY, 0.5f));
        }
コード例 #25
0
        public override Value Evaluate(FSharpList <Value> args)
        {
            GeometryList geometry = new GeometryList();

            String file_name = ((Value.String)args[0]).Item;
            var    input     = (args[1] as Value.List).Item;

            foreach (Value v in input)
            {
                Geometry g = ((Value.Container)v).Item as Geometry;
                geometry.Add(g);
            }

            ASMExporter.export_geometry(file_name, geometry);

            return(args[1]);
        }
コード例 #26
0
        public override void GenerateGeometry()
        {
            if (GeometryList.Count > 0)
            {
                GeometryList.Clear();
            }
            //GeometryList.Add(Name, new Geometry2D(Name, TileTexture, PX * ScreenWidth, PY * ScreenHeight, SX * ScreenWidth, SY * ScreenHeight, 0, 0, 1, 1, 0.0f));

            //background
            //Red Slider
            //Green Slider
            //Blue Slider
            //Alpha Slider
            float SPX  = PX * ScreenWidth;
            float SPY  = PY * ScreenHeight;
            float SPPX = SX * ScreenWidth;
            float SSX  = SX * ScreenWidth / 256;
            float SSY  = SY * ScreenHeight / 4;

            Geometry2D RedGeom   = new Geometry2D(Name + "RedSlider", "StandardMenu", SPX, SPY, SPPX, SSY, TX, TY, TSX, TSY, 0.5f);
            Geometry2D GreenGeom = new Geometry2D(Name + "GreenSlider", "StandardMenu", SPX, SPY + SSY, SPPX, SSY, TX, TY, TSX, TSY, 0.5f);
            Geometry2D BlueGeom  = new Geometry2D(Name + "BlueSlider", "StandardMenu", SPX, SPY + SSY * 2, SPPX, SSY, TX, TY, TSX, TSY, 0.5f);
            Geometry2D AlphaGeom = new Geometry2D(Name + "AlphaSlider", "StandardMenu", SPX, SPY + SSY * 3, SPPX, SSY, TX, TY, TSX, TSY, 0.5f);

            GeometryList.Add(RedGeom.Name, RedGeom);
            GeometryList.Add(GreenGeom.Name, GreenGeom);
            GeometryList.Add(BlueGeom.Name, BlueGeom);
            GeometryList.Add(AlphaGeom.Name, AlphaGeom);
            //Selectors

            float RPX = PX * ScreenWidth + (SSX * RX) - SSY / 2;
            float GPX = PX * ScreenWidth + (SSX * GX) - SSY / 2;
            float BPX = PX * ScreenWidth + (SSX * BX) - SSY / 2;
            float APX = PX * ScreenWidth + (SSX * AX) - SSY / 2;

            Geometry2D RedSelector   = new Geometry2D(Name + "RedSelector", "StandardMenu", RPX, SPY, SSY, SSY, TX, TY, TSX, TSY, 0.9f);
            Geometry2D GreenSelector = new Geometry2D(Name + "GreenSelector", "StandardMenu", GPX, SPY + SSY, SSY, SSY, TX, TY, TSX, TSY, 0.9f);
            Geometry2D BlueSelector  = new Geometry2D(Name + "BlueSelector", "StandardMenu", BPX, SPY + SSY * 2, SSY, SSY, TX, TY, TSX, TSY, 0.9f);
            Geometry2D AlphaSelector = new Geometry2D(Name + "AlphaSelector", "StandardMenu", APX, SPY + SSY * 3, SSY, SSY, TX, TY, TSX, TSY, 0.9f);

            GeometryList.Add(RedSelector.Name, RedSelector);
            GeometryList.Add(GreenSelector.Name, GreenSelector);
            GeometryList.Add(BlueSelector.Name, BlueSelector);
            GeometryList.Add(AlphaSelector.Name, AlphaSelector);
        }
コード例 #27
0
        /// <summary> Terminate the current LineString.</summary>
        public void EndLine()
        {
            if (coordList == null)
            {
                return;
            }

            if (ignoreInvalidLines && coordList.Count < 2)
            {
                coordList = null;
                return;
            }
            Coordinate[] rawPts = coordList.ToArray();
            Coordinate[] pts    = rawPts;

            if (fixInvalidLines)
            {
                pts = ValidCoordinateSequence(rawPts);
            }

            coordList = null;
            LineString line = null;

            try
            {
                line = geomFact.CreateLineString(pts);
            }
            catch (ArgumentException ex)
            {
                ExceptionManager.Publish(ex);

                // exception is due to too few points in line.
                // only propagate if not ignoring short lines
                if (!ignoreInvalidLines)
                {
                    throw ex;
                }
            }

            if (line != null)
            {
                lines.Add(line);
            }
        }
コード例 #28
0
        public override void UpdateGeometry()
        {
            GeometryList.Clear();
            GeometryList.Add(Name, new Geometry2D(Name, "StandardMenu", PX * ScreenWidth, PY * ScreenHeight, SX * ScreenWidth, SY * ScreenHeight, TX, TY, TSX, TSY, Z));

            if (Text.Length > 0)
            {
                float Buffer = SX * 0.1f;
                float DX     = (SX - Buffer) / Text.Length;

                for (int i = 0; i < Text.Length; i++)
                {
                    int    Index = Text[i] - 1;
                    string Bit   = Text[i].ToString();

                    GeometryList.Add(Name + i, new Geometry2D(Name + i, "StandardText", (PX + Buffer) * ScreenWidth + (DX * i * ScreenWidth), PY * ScreenHeight, DX * ScreenWidth, SY * ScreenHeight, 0.0625f * (Index % 16), 0.0625f * (Index / 16), 0.0625f, 0.0625f, Z + 0.1f));
                }
            }
            NeedsNodeUpdate = true;
        }
コード例 #29
0
        protected virtual Geometry Transform(MultiPolygon geom, Geometry parent)
        {
            GeometryList transGeomList = new GeometryList();

            for (int i = 0; i < geom.NumGeometries; i++)
            {
                Geometry transformGeom = Transform(geom[i], geom);
                if (transformGeom == null)
                {
                    continue;
                }
                if (transformGeom.IsEmpty)
                {
                    continue;
                }

                transGeomList.Add(transformGeom);
            }

            return(geomFactory.BuildGeometry(transGeomList));
        }
コード例 #30
0
        private GeometryCollection EditGeometryCollection(GeometryCollection collection,
                                                          IGeometryEdit operation)
        {
            GeometryCollection newCollection =
                (GeometryCollection)operation.Edit(collection, m_objFactory);

            GeometryList geometries = new GeometryList();

            for (int i = 0; i < newCollection.NumGeometries; i++)
            {
                Geometry geometry = Edit(newCollection.GetGeometry(i), operation);

                if (geometry.IsEmpty)
                {
                    continue;
                }

                geometries.Add(geometry);
            }

            GeometryType geomType = newCollection.GeometryType;

            if (geomType == GeometryType.MultiPoint)
            {
                return(m_objFactory.CreateMultiPoint(geometries.ToPointArray()));
            }

            if (geomType == GeometryType.MultiLineString)
            {
                return(m_objFactory.CreateMultiLineString(
                           geometries.ToLineStringArray()));
            }

            if (geomType == GeometryType.MultiPolygon)
            {
                return(m_objFactory.CreateMultiPolygon(geometries.ToPolygonArray()));
            }

            return(m_objFactory.CreateGeometryCollection(geometries.ToArray()));
        }
コード例 #31
0
ファイル: Geometry.cs プロジェクト: kscalvin/Dynamo
        public override Value Evaluate(FSharpList<Value> args)
        {
            GeometryList geometry = new GeometryList();

            System.String file_name = ((Value.String)args[0]).Item;
            var input = (args[1] as Value.List).Item;

            foreach (Value v in input)
            {
                Geometry g = ((Value.Container)v).Item as Geometry;
                geometry.Add(g);
            }

            ASMExporter.export_geometry(file_name, geometry);

            return args[1];
        }