예제 #1
0
        protected override void GenerateTestResultCore()
        {
            Collection <Feature> results = TopologyValidator.LinesMustBeLargerThanClusterTolerance(InputFeatureLayer.InternalFeatures, tolerance);

            OutputFeatureLayer.InternalFeatures.Clear();
            assistantLayer.InternalFeatures.Clear();
            foreach (Feature result in results)
            {
                OutputFeatureLayer.InternalFeatures.Add(result);
                if (result.GetShape() is LineBaseShape)
                {
                    foreach (Vertex vertex in ((LineShape)result.GetShape()).Vertices)
                    {
                        EllipseShape ellipseShape = new EllipseShape(new PointShape(vertex), tolerance);
                        assistantLayer.InternalFeatures.Add(new Feature(ellipseShape));

                        Feature pointFeature = new Feature(vertex);
                        assistantLayer.InternalFeatures.Add(pointFeature);
                    }
                }
                else
                {
                    EllipseShape ellipseShape = new EllipseShape(result, tolerance);
                    assistantLayer.InternalFeatures.Add(new Feature(ellipseShape));
                    assistantLayer.InternalFeatures.Add(result);
                }
            }
        }
        private void MapView_Loaded(object sender, RoutedEventArgs e)
        {
            mapView.MapUnit       = GeographyUnit.DecimalDegree;
            mapView.CurrentExtent = new RectangleShape(0, 100, 100, 0);

            // Setup the inMemoryLayer.
            InMemoryFeatureLayer inMemoryLayer = new InMemoryFeatureLayer();

            inMemoryLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.FillBrush        = new GeoSolidBrush(GeoColor.FromArgb(125, GeoColors.Gray));
            inMemoryLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.OutlinePen.Color = GeoColors.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 = GeoColors.Red;
            shortestLineLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel             = ApplyUntilZoomLevel.Level20;

            LayerOverlay inMemoryOverlay = new LayerOverlay();

            inMemoryOverlay.Layers.Add("InMemoryFeatureLayer", inMemoryLayer);
            mapView.Overlays.Add("InMemoryOverlay", inMemoryOverlay);

            LayerOverlay shortestLineOverlay = new LayerOverlay();

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

            mapView.Refresh();
        }
예제 #3
0
        /// <inheritdoc/>
        public override void Draw(object dc, EllipseShape ellipse, double dx, double dy, object db, object r)
        {
            var _gfx = dc as Graphics;

            Brush brush = ToSolidBrush(ellipse.Style.Fill);
            Pen   pen   = ToPen(ellipse.Style, _scaleToPage);

            var rect = CreateRect(
                ellipse.TopLeft,
                ellipse.BottomRight,
                dx, dy);

            if (ellipse.IsFilled)
            {
                _gfx.FillEllipse(
                    brush,
                    _scaleToPage(rect.X),
                    _scaleToPage(rect.Y),
                    _scaleToPage(rect.Width),
                    _scaleToPage(rect.Height));
            }

            if (ellipse.IsStroked)
            {
                _gfx.DrawEllipse(
                    pen,
                    _scaleToPage(rect.X),
                    _scaleToPage(rect.Y),
                    _scaleToPage(rect.Width),
                    _scaleToPage(rect.Height));
            }

            brush.Dispose();
            pen.Dispose();
        }
예제 #4
0
        public CommonDecorator()
        {
            _strokeStyleId = "Decorator-Stroke";
            _fillStyleId   = "Decorator-Fill";

            _line = new LineShape(new PointShape(0, 0, null), new PointShape(0, 0, null))
            {
                Points = new ObservableCollection <IPointShape>()
            };
            _line.StartPoint.Owner = _line;
            _line.Point.Owner      = _line;

            _ellipse = new EllipseShape(new PointShape(0, 0, null), new PointShape(0, 0, null))
            {
                Points = new ObservableCollection <IPointShape>(),
            };
            _ellipse.StartPoint.Owner = _ellipse;
            _ellipse.Point.Owner      = _ellipse;

            _rectangle = new RectangleShape(new PointShape(0, 0, null), new PointShape(0, 0, null))
            {
                Points = new ObservableCollection <IPointShape>(),
            };
            _rectangle.StartPoint.Owner = _rectangle;
            _rectangle.Point.Owner      = _rectangle;

            _text = new TextShape(new Text(), new PointShape(0, 0, null), new PointShape(0, 0, null))
            {
                Points = new ObservableCollection <IPointShape>(),
            };
            _text.StartPoint.Owner = _text;
            _text.Point.Owner      = _text;
        }
예제 #5
0
 /// <summary>
 /// Initialize new instance of <see cref="ToolEllipseSelection"/> class.
 /// </summary>
 /// <param name="layer">The selection shapes layer.</param>
 /// <param name="shape">The selected shape.</param>
 /// <param name="style">The selection shapes style.</param>
 /// <param name="point">The selection point shape.</param>
 public ToolEllipseSelection(LayerContainer layer, EllipseShape shape, ShapeStyle style, BaseShape point)
 {
     _layer   = layer;
     _ellipse = shape;
     _style   = style;
     _point   = point;
 }
예제 #6
0
        internal void Copy()
        {
            Shape shape = new Shape();

            if (selection != null)
            {
                shape = selection;
                if (shape.ShapeType == "Rectangle")
                {
                    shape = new RectangleShape(new Rectangle((int)shape.Location.X, (int)shape.Location.Y,
                                                             (int)shape.Width, (int)shape.Height));

                    CopyHelp(shape);
                }
                if (shape.ShapeType == "Ellipse")
                {
                    shape = new EllipseShape(new Rectangle((int)shape.Location.X, (int)shape.Location.Y,
                                                           (int)shape.Width, (int)shape.Height));
                    CopyHelp(shape);
                }


                ShapeList.Add(shape);
            }
        }
예제 #7
0
    /// <summary>
    /// New elliptical arc from center point, major axis, minor axis ration, and angles.
    /// </summary>
    /// <param name="center">Center of circle</param>
    /// <param name="major">Major axis of the ellipse</param>
    /// <param name="ratio">Ratio of minor axis to major axis</param>
    /// <param name="angle">Starting angle of arc (in degrees)</param>
    /// <param name="sweep">Sweep of arc (in degrees)</param>
    public static EllipseShape Create(Vector2 center, Vector2 major, float ratio, float angle, float sweep)
    {
        EllipseShape shape = Create();

        shape.position  = center;
        shape.majorAxis = major;
        float majorLength = major.magnitude;
        float minorLength = major.magnitude * ratio;

        shape.eccentricity = Mathf.Sqrt((majorLength * majorLength) - (minorLength * minorLength)) / majorLength;

        shape.startAngle = angle * Mathf.Deg2Rad;
        shape.sweepAngle = sweep * Mathf.Deg2Rad;

        if (Mathf.Approximately(sweep, 0f) || (Mathf.Abs(sweep) >= 360f))
        {
            shape.closed = true;
        }
        else
        {
            shape.closed = false;
        }

        return(shape);
    }
 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);
 }
예제 #9
0
        private void FindShortestLineBetweenTwoFeatures_Load(object sender, EventArgs e)
        {
            winformsMap1.MapUnit       = GeographyUnit.DecimalDegree;
            winformsMap1.CurrentExtent = new RectangleShape(0, 100, 100, 0);
            winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.StandardColors.White);

            // 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.Layers.Add("InMemoryFeatureLayer", inMemoryLayer);
            winformsMap1.Overlays.Add("InMemoryOverlay", inMemoryOverlay);

            LayerOverlay shortestLineOverlay = new LayerOverlay();

            shortestLineOverlay.Layers.Add("ShortestLineLayer", shortestLineLayer);
            winformsMap1.Overlays.Add("ShortestLineOverlay", shortestLineOverlay);

            winformsMap1.Refresh();
        }
예제 #10
0
        public void CreateEllipse()
        {
            List <Point> points = getListPoints();

            if (points.Count == 2)
            {
                Point point1 = points[0];
                Point point2 = points[1];

                double centerX = Math.Abs(point1.X + point2.X) / 2;
                double centerY = Math.Abs(point1.Y + point2.Y) / 2;

                double center1X = Math.Abs(point1.X + point1.X) / 2;
                double center1Y = Math.Abs(point1.Y + point2.Y) / 2;


                double center2X = Math.Abs(point1.X + point2.X) / 2;
                double center2Y = Math.Abs(point2.Y + point2.Y) / 2;

                double radius1 = Math.Sqrt(Math.Pow(centerX - center1X, 2) + Math.Pow(centerY - center1Y, 2));
                double radius2 = Math.Sqrt(Math.Pow(centerX - center2X, 2) + Math.Pow(centerY - center2Y, 2));

                double startX;
                double startY;

                CheckStartPoint(point1.X, point1.Y, point2.X, point2.Y, out startX, out startY);

                EllipseShape ellipseShape = new EllipseShape(genereteName("Ellipse"), new Point(startX, startY), radius1, radius2);
                Shapes.Add(ellipseShape);

                RemoveAllPoint();
            }
        }
예제 #11
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            Rectangle3d rec = new Rectangle3d();

            DA.GetData(0, ref rec);

            Pen outline = null;

            DA.GetData(1, ref outline);

            Pen fill = null;

            DA.GetData(2, ref fill);

            EllipseShape shape = new EllipseShape(rec);

            if (outline != null)
            {
                shape.outline(outline);
            }
            if (fill != null)
            {
                shape.fill(fill);
            }

            DA.SetData(0, shape);
        }
        TextShape CreateCustomTextualMarker(ComplexShape markerShape)
        {
            RectangleF2D box = new RectangleF2D(-15, -15, 30, 30);

            EllipseShape eShape = new EllipseShape(box);
            TextShape    txt    = new TextShape();

            eShape.BeginUpdate();
            eShape.Name = "bg";
            eShape.Appearance.ContentBrush = new SolidBrushObject(Color.White);
            eShape.Appearance.BorderBrush  = new SolidBrushObject(Color.Black);
            eShape.Appearance.BorderWidth  = 2;
            eShape.EndUpdate();

            txt.BeginUpdate();
            txt.Name = "marketText";
            txt.Text = "Test";
            txt.Box  = box;
            txt.AppearanceText.TextBrush = new SolidBrushObject(Color.Black);
            txt.AppearanceText.Font      = new Font("Tahoma", 8f);
            txt.ShadingFlags             = ShadingFlags.NoShading;
            txt.EndUpdate();

            markerShape.AddRange(new BaseShape[] { eShape, txt });
            return(txt);
        }
예제 #13
0
    protected static EllipseShape Create()
    {
        //EllipseShape shape = ScriptableObject.CreateInstance<EllipseShape>();
        EllipseShape shape = new EllipseShape();

        return(shape);
    }
예제 #14
0
		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);
		}
        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();
        }
예제 #16
0
        private Shape GetShape(MouseEventArgs e)
        {
            Color     color = Color.Black;
            Rectangle rect  = GetRect(e);

            if (redToolStripMenuItem.Checked)
            {
                color = Color.Red;
            }
            else if (blueToolStripMenuItem.Checked)
            {
                color = Color.Blue;
            }
            else if (greenToolStripMenuItem.Checked)
            {
                color = Color.Green;
            }
            Shape shape;

            if (ellipseToolStripMenuItem.Checked)
            {
                shape = new EllipseShape(color, rect);
            }
            else if (triangleToolStripMenuItem.Checked)
            {
                shape = new TriangleShape(color, rect);
            }
            else
            {
                shape = new RectangleShape(color, rect);
            }
            return(shape);
        }
예제 #17
0
        private void DrawMethod(CGNode node, ref Dictionary <CGNode, EllipseShape> visited)
        {
            ArrowShape arrow = null;
            // When autoSize is on the rectangle parameter will be 'ignored'.
            EllipseShape blockShape = new EllipseShape(new Rectangle(1, 1, 70, 70));

            blockShape.Title = String.Format("{0}", node.Method.Name);
            visited.Add(node, blockShape);
            scene.Shapes.Add(blockShape);

            ConnectorGluePoint gluePointStart = null;
            ConnectorGluePoint gluePointEnd   = null;

            foreach (CGNode child in node.MethodCalls)
            {
                DrawMethod(child, ref visited);
                gluePointStart = new ConnectorGluePoint(new PointD(visited[node].Location.X + visited[node].Width / 2, visited[node].Location.Y + visited[node].Height));
                gluePointEnd   = new ConnectorGluePoint(new PointD(visited[child].Location.X + visited[child].Width / 2, visited[child].Location.Y));

                arrow = new ArrowShape(visited[node], gluePointStart, visited[child], gluePointEnd);
                arrow.ArrowKindHead = SolidV.Cairo.ArrowKinds.TriangleRoundArrow;
                arrow.ArrowKindTail = SolidV.Cairo.ArrowKinds.NoArrow;

                gluePointEnd.Parent   = visited[child];
                gluePointStart.Parent = visited[node];

                scene.Shapes.Add(arrow);
                visited[node].Items.Add(gluePointStart);
                visited[child].Items.Add(gluePointEnd);
            }
        }
예제 #18
0
        private void SelectInformation(PointShape worldPoint)
        {
            try
            {
                Collection <Feature> selectedFeatures = new Collection <Feature>();

                foreach (Layer layer in ((LayerOverlay)winformsMap1.Overlays[0]).Layers)
                {
                    FeatureLayer featureLayer = layer as FeatureLayer;
                    if (featureLayer != null)
                    {
                        featureLayer.Open();
                        Collection <Feature> nearestFeatures = featureLayer.QueryTools.GetFeaturesNearestTo(worldPoint, winformsMap1.MapUnit, 1, ReturningColumnsType.AllColumns);
                        double       radius           = 10.0 / winformsMap1.Width * winformsMap1.CurrentExtent.Width;
                        EllipseShape searchingEllipse = new EllipseShape(worldPoint, radius, radius);

                        foreach (Feature feature in nearestFeatures)
                        {
                            Feature selectedFeature = feature;
                            selectedFeature.Tag = featureLayer.Name;

                            BaseShape currentShape = feature.GetShape();

                            if (currentShape is AreaBaseShape)
                            {
                                if (currentShape.Contains(worldPoint))
                                {
                                    selectedFeatures.Add(selectedFeature);
                                }
                            }
                            else if (currentShape is LineBaseShape)
                            {
                                if (currentShape.Intersects(searchingEllipse))
                                {
                                    selectedFeatures.Add(selectedFeature);
                                }
                            }
                            else if (currentShape is PointBaseShape)
                            {
                                if (searchingEllipse.Contains(currentShape))
                                {
                                    selectedFeatures.Add(selectedFeature);
                                }
                            }
                        }
                        featureLayer.Close();
                    }
                }

                if (selectedFeatures.Count > 0)
                {
                    FormInformation frmInformation = new FormInformation(selectedFeatures);
                    frmInformation.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, ex.GetType().ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, (MessageBoxOptions)0);
            }
        }
예제 #19
0
        public void CreateDemoContainer(LayerContainerViewModel vm)
        {
            var container = new LayerContainer()
            {
                Width           = 720,
                Height          = 630,
                PrintBackground = new ArgbColor(0, 255, 255, 255),
                WorkBackground  = new ArgbColor(255, 128, 128, 128),
                InputBackground = new ArgbColor(255, 211, 211, 211)
            };

            var workingContainer = new LayerContainer();

            var style = new ShapeStyle(new ArgbColor(255, 0, 255, 0), new ArgbColor(80, 0, 255, 0), 2.0, true, true);

            var pointShape = new EllipseShape(new PointShape(-4, -4, null), new PointShape(4, 4, null))
            {
                Style = new ShapeStyle(new ArgbColor(0, 0, 0, 0), new ArgbColor(255, 255, 255, 0), 2.0, true, true)
            };

            var guideTool = vm.Tools.FirstOrDefault(t => t.Title == "Guide") as GuideTool;

            container.Styles.Add(guideTool.Settings.GuideStyle);
            container.Styles.Add(pointShape.Style);
            container.Styles.Add(style);

            vm.CurrentContainer = container;
            vm.WorkingContainer = workingContainer;
            vm.CurrentStyle     = style;
            vm.PointShape       = pointShape;
        }
예제 #20
0
 public CommonHelper()
 {
     _stroke      = new ArgbColor(255, 0, 255, 255);
     _fill        = new ArgbColor(255, 0, 255, 255);
     _strokeStyle = new ShapeStyle(_stroke, _fill, 2.0, true, false);
     _fillStyle   = new ShapeStyle(_stroke, _fill, 2.0, false, true);
     _line        = new LineShape(new PointShape(0, 0, null), new PointShape(0, 0, null));
     _ellipse     = new EllipseShape(new PointShape(0, 0, null), new PointShape(0, 0, null));
 }
예제 #21
0
        public void DrawEllipse(object dc, EllipseShape ellipse, string styleId, double dx, double dy, double scale)
        {
            var geometry = new SKPath()
            {
                FillType = SKPathFillType.Winding
            };

            SkiaHelper.AddOval(null, ellipse, dx, dy, geometry);
            _rootNodes[_currentRootNode].Children.Add(new ChildNode(ellipse, styleId, dx, dy, scale, geometry));
        }
예제 #22
0
        protected override void FinishDrawing()
        {
            RectangleF   rect = GetNormalRectangle(_Points[0].layerCoord, _Points[1].layerCoord);
            EllipseShape go   = new EllipseShape(rect.X, rect.Y, rect.Width, rect.Height);

            // deselect the text tool
            _grac.SetGraphToolFromInternal(Altaxo.Gui.Graph.Viewing.GraphToolType.ObjectPointer);
            _grac.ActiveLayer.GraphObjects.Add(go);
            _grac.WinFormsController.RefreshGraph();
        }
예제 #23
0
        public void AddCustomEllipse(int x, int y, Color col)
        {
            EllipseShape elipse = new EllipseShape(new Rectangle(211, 100, x, y));

            elipse.FillColor   = col;
            elipse.BorderColor = Pens.Black;
            elipse.ShapeType   = "Ellipse";

            ShapeList.Add(elipse);
        }
        protected override void FinishDrawing()
        {
            RectangleF   rect = GetNormalRectangle(_Points[0].layerCoord, _Points[1].layerCoord);
            EllipseShape go   = new EllipseShape(rect.X, rect.Y, rect.Width, rect.Height);

            // deselect the text tool
            this._grac.CurrentGraphToolType = typeof(GraphControllerMouseHandlers.ObjectPointerMouseHandler);
            _grac.Layers[_grac.CurrentLayerNumber].GraphObjects.Add(go);
            _grac.RefreshGraph();
        }
예제 #25
0
        /// <inheritdoc/>
        public override void Draw(object dc, EllipseShape ellipse, double dx, double dy, object db, object r)
        {
            var canvas = dc as SKCanvas;

            using (SKPaint brush = ToSKPaintBrush(ellipse.Style.Fill))
                using (SKPaint pen = ToSKPaintPen(ellipse.Style, _scaleToPage, _sourceDpi, _targetDpi))
                {
                    var rect = CreateRect(ellipse.TopLeft, ellipse.BottomRight, dx, dy, _scaleToPage);
                    DrawEllipseInternal(canvas, brush, pen, ellipse.IsStroked, ellipse.IsFilled, ref rect);
                }
        }
예제 #26
0
        protected override void FinishDrawing()
        {
            var rect = GetNormalRectangle(_Points[0].LayerCoordinates, _Points[1].LayerCoordinates);
            var go   = new EllipseShape(_grac.Doc.GetPropertyContext());

            go.SetParentSize(_grac.ActiveLayer.Size, false);
            go.SetRelativeSizePositionFromAbsoluteValues(rect.Size, rect.LeftTop);

            // deselect the text tool
            _grac.SetGraphToolFromInternal(GraphToolType.ObjectPointer);
            _grac.ActiveLayer.GraphObjects.Add(go);
        }
예제 #27
0
        /// <summary>
        /// Transfer selection state to Point2.
        /// </summary>
        public void ToStatePoint2()
        {
            _ellipse           = EllipseShape.Create(0, 0, _style, null);
            _p1HelperPoint     = PointShape.Create(0, 0, _point);
            _p2HelperPoint     = PointShape.Create(0, 0, _point);
            _centerHelperPoint = PointShape.Create(0, 0, _point);

            _layer.Shapes = _layer.Shapes.Add(_ellipse);
            _layer.Shapes = _layer.Shapes.Add(_p1HelperPoint);
            _layer.Shapes = _layer.Shapes.Add(_p2HelperPoint);
            _layer.Shapes = _layer.Shapes.Add(_centerHelperPoint);
        }
예제 #28
0
        /// <summary>
        /// Remove selection.
        /// </summary>
        public void Remove()
        {
            if (_ellipse != null)
            {
                _layer.Shapes = _layer.Shapes.Remove(_ellipse);
                _ellipse      = null;
            }

            if (_startLine != null)
            {
                _layer.Shapes = _layer.Shapes.Remove(_startLine);
                _startLine    = null;
            }

            if (_endLine != null)
            {
                _layer.Shapes = _layer.Shapes.Remove(_endLine);
                _endLine      = null;
            }

            if (_p1HelperPoint != null)
            {
                _layer.Shapes  = _layer.Shapes.Remove(_p1HelperPoint);
                _p1HelperPoint = null;
            }

            if (_p2HelperPoint != null)
            {
                _layer.Shapes  = _layer.Shapes.Remove(_p2HelperPoint);
                _p2HelperPoint = null;
            }

            if (_centerHelperPoint != null)
            {
                _layer.Shapes      = _layer.Shapes.Remove(_centerHelperPoint);
                _centerHelperPoint = null;
            }

            if (_startHelperPoint != null)
            {
                _layer.Shapes     = _layer.Shapes.Remove(_startHelperPoint);
                _startHelperPoint = null;
            }

            if (_endHelperPoint != null)
            {
                _layer.Shapes   = _layer.Shapes.Remove(_endHelperPoint);
                _endHelperPoint = null;
            }

            _layer.Invalidate();
        }
예제 #29
0
 public void Unload()
 {
     Instance              = null;
     multiWandWheel        = null;
     autoHammerWheel       = null;
     paintWheel            = null;
     fillWandSelection     = null;
     mirrorWandSelection   = null;
     shapesDrawerSelection = null;
     rectangleShape        = null;
     ellipseShape          = null;
     bezierCurve           = null;
 }
예제 #30
0
        public static Shape NewShapeForCancas(EllipseShape ellipseShape)
        {
            Ellipse ellipse = new Ellipse
            {
                Width  = 2 * ellipseShape.Radius1,
                Height = 2 * ellipseShape.Radius2,
                Margin = new Thickness(ellipseShape.Point.X + ellipseShape.Margin.X, ellipseShape.Point.Y + ellipseShape.Margin.Y, 0, 0),
                Stroke = Brushes.Black,
                Fill   = new SolidColorBrush(ellipseShape.Color)
            };

            return(ellipse);
        }
예제 #31
0
		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);
		}
예제 #32
0
    /// <summary>
    /// New ellipse from center point, major axis, and minor axis ratio (DXF format).
    /// </summary>
    /// <param name="center">Center of circle</param>
    /// <param name="major">Major axis of the ellipse</param>
    /// <param name="ratio">Ratio of minor axis to major axis</param>
    public static EllipseShape Create(Vector2 center, Vector2 major, float ratio)
    {
        EllipseShape shape = Create();

        shape.position  = center;
        shape.majorAxis = major;
        float majorLength = major.magnitude;
        float minorLength = major.magnitude * ratio;

        shape.eccentricity = Mathf.Sqrt((majorLength * majorLength) - (minorLength * minorLength)) / majorLength;

        return(shape);
    }
예제 #33
0
        public void AddRandomEllispe()
        {
            Random rnd = new Random();
            int    x   = rnd.Next(100, 700);
            int    y   = rnd.Next(100, 1000);

            EllipseShape ellipse = new EllipseShape(new Rectangle(x, y, 100, 300));

            ellipse.BorderColor = Color.Black;
            ellipse.FillColor   = Color.White;
            ellipse.BorderWidth = 5;
            ShapeList.Add(ellipse);
        }
        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"]);
        }
예제 #35
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);
        }
예제 #36
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 ();
        }
예제 #37
0
		public void CreateEllipseShape()
		{
			EllipseShape ls = new EllipseShape();
			Assert.NotNull(ls);
		}
예제 #38
0
        //-----------------------------------------------------------------------
        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);
        }