Exemplo n.º 1
0
        private void DrawShape()
        {
            MapWindow.Interfaces.Draw  d = m_globals.MapWin.View.Draw;
            MapWindow.Interfaces.Layer l = m_globals.MapWin.Layers[m_globals.MapWin.Layers.CurrentLayer];

            PointD prev = null;

            for (int i = 0; i < m_Shape.NumPoints; i++)
            {
                PointD p = m_Shape[i];
                d.DrawPoint(p.x, p.y, m_PointSize, System.Drawing.Color.Blue);

                if (prev != null)
                {
                    if (l.LayerType == MapWindow.Interfaces.eLayerType.PolygonShapefile)
                    {
                        d.DrawLine(prev.x, prev.y, p.x, p.y, (int)l.LineOrPointSize, l.OutlineColor);
                    }
                    else
                    {
                        d.DrawLine(prev.x, prev.y, p.x, p.y, (int)l.LineOrPointSize, l.Color);
                    }
                }

                prev = p;
            }
        }
Exemplo n.º 2
0
        public void AddTest13()
        {
            MapWindow.Interfaces.Layers target = new Layers(); // TODO: Initialize to an appropriate value
            string Filename = string.Empty;                    // TODO: Initialize to an appropriate value

            MapWindow.Interfaces.Layer expected = null;        // TODO: Initialize to an appropriate value
            MapWindow.Interfaces.Layer actual;
            actual = target.Add(Filename);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Exemplo n.º 3
0
 public void AddTest3()
 {
     MapWindow.Interfaces.Layers target              = new MapWindow.Layers(); // TODO: Initialize to an appropriate value
     MapWinGIS.Image             ImageObject         = null;                   // TODO: Initialize to an appropriate value
     MapWinGIS.Image             ImageObjectExpected = null;                   // TODO: Initialize to an appropriate value
     MapWindow.Interfaces.Layer  expected            = null;                   // TODO: Initialize to an appropriate value
     MapWindow.Interfaces.Layer  actual;
     actual = target.Add(ref ImageObject);
     Assert.AreEqual(ImageObjectExpected, ImageObject);
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
        public void ExportSchemeTest()
        {
            MapWindow.Interfaces.Layer lyr         = null; // TODO: Initialize to an appropriate value
            MapWindow.Interfaces.Layer lyrExpected = null; // TODO: Initialize to an appropriate value
            string Path     = string.Empty;                // TODO: Initialize to an appropriate value
            bool   expected = false;                       // TODO: Initialize to an appropriate value
            bool   actual;

            actual = MapWindow.ColoringSchemeTools.ExportScheme(ref lyr, Path);
            Assert.AreEqual(lyrExpected, lyr);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Exemplo n.º 5
0
        public void AddTest4()
        {
            Layers    target                  = new Layers(); // TODO: Initialize to an appropriate value
            Shapefile ShapefileObject         = null;         // TODO: Initialize to an appropriate value
            Shapefile ShapefileObjectExpected = null;         // TODO: Initialize to an appropriate value
            string    LayerName               = string.Empty; // TODO: Initialize to an appropriate value

            MapWindow.Interfaces.Layer expected = null;       // TODO: Initialize to an appropriate value
            MapWindow.Interfaces.Layer actual;
            actual = target.Add(ref ShapefileObject, LayerName);
            Assert.AreEqual(ShapefileObjectExpected, ShapefileObject);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Exemplo n.º 6
0
        public void AddTest8()
        {
            Layers          target             = new Layers(); // TODO: Initialize to an appropriate value
            Grid            GridObject         = null;         // TODO: Initialize to an appropriate value
            Grid            GridObjectExpected = null;         // TODO: Initialize to an appropriate value
            GridColorScheme ColorScheme        = null;         // TODO: Initialize to an appropriate value

            MapWindow.Interfaces.Layer expected = null;        // TODO: Initialize to an appropriate value
            MapWindow.Interfaces.Layer actual;
            actual = target.Add(ref GridObject, ColorScheme);
            Assert.AreEqual(GridObjectExpected, GridObject);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Exemplo n.º 7
0
        public void AddTest14()
        {
            MapWindow.Interfaces.Layers target = new Layers(); // TODO: Initialize to an appropriate value
            string Filename  = string.Empty;                   // TODO: Initialize to an appropriate value
            string LayerName = string.Empty;                   // TODO: Initialize to an appropriate value
            bool   Visible   = false;                          // TODO: Initialize to an appropriate value
            bool   PlaceAboveCurrentlySelected = false;        // TODO: Initialize to an appropriate value

            MapWindow.Interfaces.Layer expected = null;        // TODO: Initialize to an appropriate value
            MapWindow.Interfaces.Layer actual;
            actual = target.Add(Filename, LayerName, Visible, PlaceAboveCurrentlySelected);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Exemplo n.º 8
0
        public bool LoadLabelInfo(MapWindow.Interfaces.IMapWin m_MapWin, MapWindow.Interfaces.Layer layer, ref Forms.Label label, System.Windows.Forms.Form owner)
        {
            if (layer == null)
            {
                return(false);
            }

            //make sure the file exists
            string filename = "";

            if (m_MapWin.View.LabelsUseProjectLevel)
            {
                if (m_MapWin.Project.FileName != null && m_MapWin.Project.FileName.Trim() != "")
                {
                    filename = System.IO.Path.GetFileNameWithoutExtension(m_MapWin.Project.FileName) + @"\" + System.IO.Path.ChangeExtension(System.IO.Path.GetFileName(layer.FileName), ".lbl");
                }
            }
            if (filename == "" || !System.IO.File.Exists(filename))
            {
                filename = System.IO.Path.ChangeExtension(layer.FileName, ".lbl");
            }
            if (!System.IO.File.Exists(filename))
            {
                return(false);
            }

            try
            {
                //load the xml file
                m_doc.Load(filename);

                //get the root of the file
                System.Xml.XmlElement root = m_doc.DocumentElement;

                label.points     = new System.Collections.ArrayList();
                label.labelShape = new System.Collections.ArrayList();

                XmlNodeList nodeList = root.GetElementsByTagName("Labels");

                //get the font
                int field  = int.Parse(nodeList[0].Attributes.GetNamedItem("Field").InnerText);
                int field2 = 0;
                if (nodeList[0].Attributes.GetNamedItem("Field2") != null)
                {
                    field2 = int.Parse(nodeList[0].Attributes.GetNamedItem("Field2").InnerText);
                }
                string fontName                  = nodeList[0].Attributes.GetNamedItem("Font").InnerText;
                float  size                      = float.Parse(nodeList[0].Attributes.GetNamedItem("Size").InnerText);
                System.Drawing.Color color       = System.Drawing.Color.FromArgb(int.Parse(nodeList[0].Attributes.GetNamedItem("Color").InnerText));
                int  justification               = int.Parse(nodeList[0].Attributes.GetNamedItem("Justification").InnerText);
                bool UseMinZoom                  = bool.Parse(nodeList[0].Attributes.GetNamedItem("UseMinZoomLevel").InnerText);
                bool Scaled                      = false;
                bool UseShadows                  = false;
                System.Drawing.Color ShadowColor = System.Drawing.Color.White;
                int    Offset                    = 0;
                double StandardViewWidth         = 0.0;
                bool   UseLabelCollision         = false;
                bool   RemoveDuplicateLabels     = false;
                string RotationField             = "";

                try
                {
                    if (nodeList[0].Attributes.GetNamedItem("Scaled") != null)
                    {
                        Scaled = bool.Parse(nodeList[0].Attributes.GetNamedItem("Scaled").InnerText);
                    }
                    if (nodeList[0].Attributes.GetNamedItem("UseShadows") != null)
                    {
                        UseShadows = bool.Parse(nodeList[0].Attributes.GetNamedItem("UseShadows").InnerText);
                    }
                    if (nodeList[0].Attributes.GetNamedItem("ShadowColor") != null)
                    {
                        ShadowColor = System.Drawing.Color.FromArgb(int.Parse(nodeList[0].Attributes.GetNamedItem("ShadowColor").InnerText));
                    }
                    if (nodeList[0].Attributes.GetNamedItem("Offset") != null)
                    {
                        Offset = int.Parse(nodeList[0].Attributes.GetNamedItem("Offset").InnerText);
                    }
                    if (nodeList[0].Attributes.GetNamedItem("StandardViewWidth") != null)
                    {
                        StandardViewWidth = double.Parse(nodeList[0].Attributes.GetNamedItem("StandardViewWidth").InnerText);
                    }
                }
                catch
                {
                    Scaled            = false;
                    UseShadows        = false;
                    ShadowColor       = System.Drawing.Color.White;
                    Offset            = 0;
                    StandardViewWidth = 0.0;
                }

                if (nodeList[0].Attributes.GetNamedItem("UseLabelCollision") != null)
                {
                    UseLabelCollision = bool.Parse(nodeList[0].Attributes.GetNamedItem("UseLabelCollision").InnerText);
                }
                if (nodeList[0].Attributes.GetNamedItem("RemoveDuplicateLabels") != null)
                {
                    RemoveDuplicateLabels = bool.Parse(nodeList[0].Attributes.GetNamedItem("RemoveDuplicateLabels").InnerText);
                }
                if (nodeList[0].Attributes.GetNamedItem("RotationField") != null)
                {
                    RotationField = nodeList[0].Attributes.GetNamedItem("RotationField").InnerText;
                }

                double xMin = double.Parse(nodeList[0].Attributes.GetNamedItem("xMin").InnerText);
                double yMin = double.Parse(nodeList[0].Attributes.GetNamedItem("yMin").InnerText);
                double xMax = double.Parse(nodeList[0].Attributes.GetNamedItem("xMax").InnerText);
                double yMax = double.Parse(nodeList[0].Attributes.GetNamedItem("yMax").InnerText);

                //set all the properties of the label
                label.font          = new System.Drawing.Font(fontName, size);
                label.color         = color;
                label.field         = field;
                label.field2        = field2;
                label.handle        = layer.Handle;
                label.alignment     = (MapWinGIS.tkHJustification)justification;
                label.UseMinExtents = UseMinZoom;

                label.Scaled            = Scaled;
                label.UseShadows        = UseShadows;
                label.shadowColor       = ShadowColor;
                label.Offset            = Offset;
                label.StandardViewWidth = StandardViewWidth;
                label.RotationField     = RotationField;

                if (nodeList[0].Attributes.GetNamedItem("UseLabelCollision") != null)
                {
                    label.UseLabelCollision = UseLabelCollision;
                }
                if (nodeList[0].Attributes.GetNamedItem("RemoveDuplicateLabels") != null)
                {
                    label.RemoveDuplicates = RemoveDuplicateLabels;
                }

                if (nodeList[0].Attributes.GetNamedItem("AppendLine1") != null)
                {
                    label.AppendLine1 = nodeList[0].Attributes.GetNamedItem("AppendLine1").InnerText;
                }
                if (nodeList[0].Attributes.GetNamedItem("AppendLine2") != null)
                {
                    label.AppendLine2 = nodeList[0].Attributes.GetNamedItem("AppendLine2").InnerText;
                }
                if (nodeList[0].Attributes.GetNamedItem("PrependLine1") != null)
                {
                    label.PrependLine1 = nodeList[0].Attributes.GetNamedItem("PrependLine1").InnerText;
                }
                if (nodeList[0].Attributes.GetNamedItem("PrependLine2") != null)
                {
                    label.PrependLine2 = nodeList[0].Attributes.GetNamedItem("PrependLine2").InnerText;
                }

                label.extents = new MapWinGIS.ExtentsClass();
                label.extents.SetBounds(xMin, yMin, 0, xMax, yMax, 0);
                label.Modified            = false;
                label.LabelExtentsChanged = false;
                label.updateHeaderOnly    = true;

                //add all the points to this label
                Forms.Point p;
                XmlNode     node;
                double      x, y, rotation = 0;
                System.Collections.IEnumerator enumerator = nodeList[0].ChildNodes.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    node = (XmlNode)enumerator.Current;
                    x    = double.Parse(node.Attributes.GetNamedItem("X").InnerText);
                    y    = double.Parse(node.Attributes.GetNamedItem("Y").InnerText);

                    if (nodeList[0].Attributes.GetNamedItem("Rotation") != null)
                    {
                        rotation = double.Parse(node.Attributes.GetNamedItem("Rotation").InnerText);
                    }


                    p          = new Forms.Point();
                    p.x        = x;
                    p.y        = y;
                    p.rotation = rotation;

                    label.points.Add(p);
                }
                label.xml_LblFile = m_doc.InnerXml;
            }
            catch
            {
                return(false);
            }

            return(true);
        }