private void WpfMap_Loaded(object sender, RoutedEventArgs e)
        {
            wpfMap1.MapUnit = GeographyUnit.DecimalDegree;
            wpfMap1.CurrentExtent = new RectangleShape(0, 100, 100, 0);

            // Setup the inMemoryLayer.
            InMemoryFeatureLayer inMemoryLayer = new InMemoryFeatureLayer();
            inMemoryLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.FillSolidBrush.Color = GeoColor.FromArgb(125, GeoColor.StandardColors.Gray);
            inMemoryLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.OutlinePen.Color = GeoColor.StandardColors.Black;
            inMemoryLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            inMemoryLayer.InternalFeatures.Add("AreaShape1", new Feature("POLYGON((10 20,30 60,40 10,10 20))", "AreaShape1"));
            BaseShape shape = new EllipseShape(new PointShape(70, 70), 10, 20);
            shape.Id = "AreaShape2";
            inMemoryLayer.InternalFeatures.Add("AreaShape2", new Feature(shape));

            InMemoryFeatureLayer shortestLineLayer = new InMemoryFeatureLayer();
            shortestLineLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle.OuterPen.Color = GeoColor.StandardColors.Red;
            shortestLineLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            LayerOverlay inMemoryOverlay = new LayerOverlay();
            inMemoryOverlay.TransitionEffect = TransitionEffect.None;
            inMemoryOverlay.Layers.Add("InMemoryFeatureLayer", inMemoryLayer);
            wpfMap1.Overlays.Add("InMemoryOverlay", inMemoryOverlay);

            LayerOverlay shortestLineOverlay = new LayerOverlay();
            shortestLineOverlay.TileType = TileType.SingleTile;
            shortestLineOverlay.Layers.Add("ShortestLineLayer", shortestLineLayer);
            wpfMap1.Overlays.Add("ShortestLineOverlay", shortestLineOverlay);

            wpfMap1.Refresh();
        }
		public void EllipseThrow()
		{
			EllipseShape ls = new EllipseShape();
			Point from = new Point (1,1);
			Point to = new Point (10,10);
			GraphicsPath p = ls.CreatePath(from,to);
		}
		public void CheckGraphicsPathBounds()
		{
			EllipseShape ls = new EllipseShape();
			Point from = new Point(1,1);
			Size size = new Size (10,10);
			Rectangle rect = new Rectangle (from,size);
			GraphicsPath p = ls.CreatePath(rect);
			RectangleF r = p.GetBounds();
			Assert.AreEqual(from.X,r.Left);
			Assert.AreEqual(from.Y,r.Top);
			Assert.AreEqual(r.Size.Width + from.X, r.Right);
			Assert.AreEqual(r.Size.Height + from.Y, r.Bottom);
		}
        private void btnAddAFeature_Click(object sender, RoutedEventArgs e)
        {
            InMemoryFeatureLayer inMemoryLayer = (InMemoryFeatureLayer)wpfMap1.FindFeatureLayer("InMemoryFeatureLayer");

            BaseShape shape = new EllipseShape(new PointShape(50, 50), 10, 10);
            shape.Id = "Ellipse";

            inMemoryLayer.Open();
            inMemoryLayer.EditTools.BeginTransaction();
            inMemoryLayer.EditTools.Add(new Feature(shape));
            inMemoryLayer.EditTools.CommitTransaction();
            inMemoryLayer.Close();

            wpfMap1.Refresh(wpfMap1.Overlays["InMemoryOverlay"]);
        }
Example #5
0
        public void TestBranchIteration()
        {
            var a = new EllipseShape ();
            var b = new RectangleShape ();
            var c = new LineShape (0.0, 0.0, 32.0, 32.0);
            var look = new Look (SolidBrush.Red, SolidPen.Black);
            var op = new ShapeTree (look, a);
            op.AddChild (look, b).AddChild (look, c);

            // Iterate through each member of the branch.
            var list = new List<ShapeBase> ();
            foreach (var item in op) {
                list.Add (item);
            }

            Assert.True (list[0] == b);
            Assert.True (list[1] == c);
        }
Example #6
0
        public void TestDrawEllipse()
        {
            var bytes = new byte[1024 * 4];
            var format = Cairo.Format.ARGB32;
            var image = new Cairo.ImageSurface (bytes, format, 32, 32, 32 * 4);
            var shape = new EllipseShape ();
            shape.Rectangle = new Rectangle () {
                X = 10.0,
                Y = 4.0,
                Width = 12.0,
                Height = 18.0
            };
            var look = new Look (SolidBrush.Red, SolidPen.Black);
            var op = new ShapeTree (look, shape);
            using (var context = new Cairo.Context (image)) {
                op.Draw (context);
            }

            image.WriteToPng ("testimages/ellipse.png");
            image.Dispose ();
        }
		public void CreateEllipseShape()
		{
			EllipseShape ls = new EllipseShape();
			Assert.NotNull(ls);
		}
        //-----------------------------------------------------------------------
        void parseEllipse(ref MultiShape @out, XmlNode pEllipseNode) {
            float rx = getAttribReal(pEllipseNode, "rx");
            float ry = getAttribReal(pEllipseNode, "ry");
            if (rx <= 0.0f || ry <= 0.0f) return;
            Shape s = new EllipseShape().setNumSeg(mNumSeg).setRadiusX(rx).setRadiusY(ry).realizeShape();
            //	if(pEllipseNode->first_attribute("id"))
            //	ss.id = pEllipseNode->first_attribute("id")->value();

            float position_x = getAttribReal(pEllipseNode, "cx");
            float position_y = getAttribReal(pEllipseNode, "cy");
            Vector2 position = new Vector2(position_x, position_y);
            Vector2 trans = getAttribTranslate(pEllipseNode);
            position += trans;
            s.translate(position);
            @out.addShape(s);
        }