private static Symbol CreateDefaultSymbol(GeometryType geomType)
        {
            Symbol symbol = null;

            switch (geomType)
            {
            case GeometryType.Point:
            case GeometryType.MultiPoint:
            {
                symbol = new SimpleMarkerSymbol()
                {
                    Color = new SolidColorBrush(Colors.Red)
                };
            } break;

            case GeometryType.Polygon:
            {
                symbol = new FillSymbol()
                {
                    BorderBrush = new SolidColorBrush(Colors.Black), Fill = new SolidColorBrush(Colors.Red)
                };
            } break;

            case GeometryType.Polyline:
            {
                symbol = new LineSymbol()
                {
                    Color = new SolidColorBrush(Colors.Red)
                };
            } break;
            }
            return(symbol);
        }
Example #2
0
 public void WriteSymbol(Symbol symbol)
 {
     if (IsSerializable(symbol))
     {
         FillSymbol fillSymbol = symbol as FillSymbol;
         if (fillSymbol != null)
         {
             WriteFillSymbol(fillSymbol);
         }
         else
         {
             LineSymbol lineSymbol = symbol as LineSymbol;
             if (lineSymbol != null)
             {
                 WriteLineSymbol(lineSymbol);
             }
             else
             {
                 MarkerSymbol markerSymbol = symbol as MarkerSymbol;
                 if (markerSymbol != null)
                 {
                     WriteMarkerSymbol(markerSymbol);
                 }
                 else
                     throw new NotSupportedException(symbol.GetType().FullName);
             }
         }
     }
 }
        public static void ChangeDefaultSymbolBorderColor(this GraphicsLayer layer, Brush borderBrush)
        {
            Symbol symbol = layer.GetDefaultSymbol();

            FSS.SimpleMarkerSymbol fsSimpleMarkerSymbol;
            if ((fsSimpleMarkerSymbol = symbol as FSS.SimpleMarkerSymbol) != null)
            {
                fsSimpleMarkerSymbol.OutlineColor = borderBrush;
            }
            else
            {
                FillSymbol fillSymbol = symbol as FillSymbol;
                if (fillSymbol != null)
                {
                    fillSymbol.BorderBrush = borderBrush;
                }
                else
                {
                    LineSymbol lineSymbol = symbol as LineSymbol;
                    if (lineSymbol != null)
                    {
                        lineSymbol.Color = borderBrush;
                    }
                }
            }
        }
        public static void DecreaseDefaultSymbolBorderWidth(this GraphicsLayer layer)
        {
            Symbol symbol = layer.GetDefaultSymbol();

            FSS.SimpleMarkerSymbol fsSimpleMarkerSymbol;
            if ((fsSimpleMarkerSymbol = symbol as FSS.SimpleMarkerSymbol) != null && fsSimpleMarkerSymbol.OutlineThickness > 0)
            {
                fsSimpleMarkerSymbol.OutlineThickness--;
            }
            else
            {
                FillSymbol fillSymbol = symbol as FillSymbol;
                if (fillSymbol != null)
                {
                    if (fillSymbol.BorderThickness > 0) // make sure it isn't -ve
                    {
                        double newSize = fillSymbol.BorderThickness - 1;
                        fillSymbol.BorderThickness = newSize;
                    }
                }
                else
                {
                    LineSymbol lineSymbol = symbol as LineSymbol;
                    if (lineSymbol != null)
                    {
                        if (lineSymbol.Width > 0)// make sure it isn't -ve
                        {
                            double newSize = lineSymbol.Width - 1;
                            lineSymbol.Width = newSize;
                        }
                    }
                }
            }
        }
        public static void IncreaseDefaultSymbolBorderWidth(this GraphicsLayer layer)
        {
            Symbol symbol = layer.GetDefaultSymbol();

            FSS.SimpleMarkerSymbol fsSimpleMarkerSymbol;
            if ((fsSimpleMarkerSymbol = symbol as FSS.SimpleMarkerSymbol) != null)
            {
                fsSimpleMarkerSymbol.OutlineThickness++;
            }
            else
            {
                FillSymbol fillSymbol = symbol as FillSymbol;
                if (fillSymbol != null)
                {
                    double newSize = fillSymbol.BorderThickness + 1;
                    fillSymbol.BorderThickness = newSize;
                }
                else
                {
                    LineSymbol lineSymbol = symbol as LineSymbol;
                    if (lineSymbol != null)
                    {
                        double newSize = lineSymbol.Width + 1;
                        lineSymbol.Width = newSize;
                    }
                }
            }
        }
Example #6
0
        /// <summary>
        /// 创建要素
        /// </summary>
        /// <returns></returns>
        public Symbol CreatNewSymbol()
        {
            Symbol newsymbol;

            switch (datatype)
            {
            case MySpaceDataType.MyPoint:
                newsymbol = new PointSymbol();
                break;

            case MySpaceDataType.MyPolyLine:
                newsymbol = new LineSymbol();
                break;

            case MySpaceDataType.MyPolygon:
                newsymbol = new PolygonSymbol();
                break;

            default:
                newsymbol = new Symbol();
                break;
                //防错TODO&栅格文件渲染方式再议
            }
            return(newsymbol);
        }
Example #7
0
        void OutlineColorSelector_ColorPicked(object sender, ColorChosenEventArgs e)
        {
            FillSymbol fillSymbol = Symbol as FillSymbol;
            LineSymbol lineSymbol = Symbol as LineSymbol;

            FSS.SimpleMarkerSymbol sms = Symbol as FSS.SimpleMarkerSymbol;
            if (sms != null)
            {
                SolidColorBrush brush = sms.OutlineColor as SolidColorBrush;
                if (brush != null)
                {
                    brush.Color = e.Color;
                    onCurrentSymbolChanged();
                }
            }
            else if (fillSymbol != null)
            {
                SolidColorBrush brush = fillSymbol.BorderBrush as SolidColorBrush;
                if (brush != null)
                {
                    brush.Color = e.Color;
                    onCurrentSymbolChanged();
                }
            }
            else if (lineSymbol != null)
            {
                SolidColorBrush brush = lineSymbol.Color as SolidColorBrush;
                if (brush != null)
                {
                    brush.Color = e.Color;
                    onCurrentSymbolChanged();
                }
            }
        }
        private bool Init()
        {
            if (!InitUI())
            {
                return(false);
            }

            if (!CreateGraphicsLayer())
            {
                return(false);
            }

            // create the symbols
            _lineSymbol = new SimpleLineSymbol(System.Windows.Media.Colors.Red, 4) as LineSymbol;
            _fillSymbol = new SimpleFillSymbol()
            {
                //Fill = Brushes.Yellow,
                Fill            = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromArgb(100, 255, 255, 0)),
                BorderBrush     = System.Windows.Media.Brushes.Green,
                BorderThickness = 1
            } as FillSymbol;

            _saFillSymbol = new SimpleFillSymbol()
            {
                //Fill = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromArgb(100, 90, 90, 90)),  // gray
                Fill = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromArgb(100, 255, 255, 0)),
                //BorderBrush = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Transparent),
                BorderBrush     = System.Windows.Media.Brushes.Green,
                BorderThickness = 1
            };

            _saLineSymbol = new SimpleLineSymbol()
            {
                Color = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromArgb(100, (byte)_random.Next(0, 255), (byte)_random.Next(0, 255), (byte)_random.Next(0, 255))),
                Width = 1,
            };


            // create the Geometry Service
            _geometryService = new GeometryService(_vm.GetPropValue("GeometryServiceUrl"));
            _geometryService.BufferCompleted += GeometryService_BufferCompleted;
            _geometryService.Failed          += GeometryService_Failed;


            // create the route task
            _facilitiesGraphicsLayer = new GraphicsLayer();
            _barriersGraphicsLayer   = new GraphicsLayer();
            _pointBarriers           = new List <Graphic>();
            _polylineBarriers        = new List <Graphic>();
            _polygonBarriers         = new List <Graphic>();
            string serviceAreaURL = _vm.GetPropValue("ServiceAreaServiceUrl");

            _routeTask = new RouteTask(serviceAreaURL);
            _routeTask.SolveServiceAreaCompleted += SolveServiceArea_Completed;
            _routeTask.Failed += SolveServiceArea_Failed;


            return(true);
        }
Example #9
0
 public LineSymbolSelect(LineSymbol nowsymbol)
 {
     symbol      = nowsymbol;
     layersymbol = nowsymbol;
     InitializeComponent();
     LineSymbolSelect_Load();
     symbol = new LineSymbol();
 }
Example #10
0
 private void Yes_Click(object sender, EventArgs e)
 {
     layersymbol = symbol;
     ((SymbolSelect)this.ParentForm).NewSymbol = symbol;
     this.ParentForm.DialogResult = DialogResult.OK;
     //加赋值
     this.ParentForm.Close();
 }
        private static LineSymbol cloneLineSymbol(LineSymbol lineSymbol)
        {
            if (lineSymbol == null)
                return null;

            ESRI.ArcGIS.Mapping.Core.Symbols.SimpleLineSymbol mappingSimpleLineSymbol = lineSymbol as ESRI.ArcGIS.Mapping.Core.Symbols.SimpleLineSymbol;
            if (mappingSimpleLineSymbol != null)
            {
                ESRI.ArcGIS.Mapping.Core.Symbols.SimpleLineSymbol ls = new ESRI.ArcGIS.Mapping.Core.Symbols.SimpleLineSymbol()
                {
                    Color = CloneBrush(mappingSimpleLineSymbol.Color),
                    ControlTemplate = mappingSimpleLineSymbol.ControlTemplate,
                    SelectionColor = CloneBrush(mappingSimpleLineSymbol.SelectionColor),
                    Width = mappingSimpleLineSymbol.Width,
                };
                return ls;
            }

            SimpleLineSymbol simpleLineSymbol = lineSymbol as SimpleLineSymbol;
            if (simpleLineSymbol != null)
            {
                SimpleLineSymbol ls = new SimpleLineSymbol()
                {
                    Color = CloneBrush(simpleLineSymbol.Color),
                    ControlTemplate = simpleLineSymbol.ControlTemplate,
                    Style = simpleLineSymbol.Style,
                    Width = simpleLineSymbol.Width,
                };
                return ls;
            }

            CartographicLineSymbol cLineSymbol = lineSymbol as CartographicLineSymbol;
            if (cLineSymbol != null)
            {
                CartographicLineSymbol cs = new CartographicLineSymbol()
                {
                    Color = CloneBrush(cLineSymbol.Color),
                    ControlTemplate = cLineSymbol.ControlTemplate,
                    DashArray = cLineSymbol.DashArray,
                    DashCap = cLineSymbol.DashCap,
                    DashOffset = cLineSymbol.DashOffset,
                    EndLineCap = cLineSymbol.EndLineCap,
                    LineJoin = cLineSymbol.LineJoin,
                    MiterLimit = cLineSymbol.MiterLimit,
                    StartLineCap = cLineSymbol.StartLineCap,
                    Width = cLineSymbol.Width,
                };
                return cs;
            }

            LineSymbol l = new LineSymbol()
            {
                Color = CloneBrush(lineSymbol.Color),
                ControlTemplate = lineSymbol.ControlTemplate,
                Width = lineSymbol.Width,
            };
            return l;
        }
        public FindClosestResourceToolbar(MapWidget mapWidget, ObservableCollection <ESRI.ArcGIS.OperationsDashboard.DataSource> resourceDatasources, String resourceTypeField,
                                          ObservableCollection <ESRI.ArcGIS.OperationsDashboard.DataSource> barriersDataSources)
        {
            InitializeComponent();
            this.DataContext = this;

            // Store a reference to the MapWidget that the toolbar has been installed to.
            _mapWidget = mapWidget;

            //set up the route task with find closest facility option
            _routeTask = new RouteTask("http://route.arcgis.com/arcgis/rest/services/World/ClosestFacility/NAServer/ClosestFacility_World/solveClosestFacility");
            _routeTask.SolveClosestFacilityCompleted += SolveClosestFacility_Completed;
            _routeTask.Failed += SolveClosestFacility_Failed;

            //check if the graphicslayers need to be added to the map.
            setupGraphicsLayer();

            //set up the resources/facilities datasource in the combobox
            setupResourcesDataSource(resourceDatasources);

            ResourceTypes      = new ObservableCollection <ResourceType>();
            _resourceTypeField = resourceTypeField;

            //set up the barriers types combobox
            //this will have to be read from the config file...
            BarriersDataSouces = new ObservableCollection <ResourceLayer>();
            //set up facilities type dropdown
            ResourceLayer barrierLayer = new ResourceLayer();

            barrierLayer.Name       = "Select Barrier";
            barrierLayer.DataSource = null;
            BarriersDataSouces.Add(barrierLayer);

            //Barriers - passed from the configurar
            foreach (ESRI.ArcGIS.OperationsDashboard.DataSource datasource in barriersDataSources)
            {
                barrierLayer            = new ResourceLayer();
                barrierLayer.Name       = datasource.Name;
                barrierLayer.DataSource = datasource;
                BarriersDataSouces.Add(barrierLayer);
            }

            cmbBarriers.ItemsSource = BarriersDataSouces;

            _incidentMarkerSymbol = new SimpleMarkerSymbol
            {
                Size  = 20,
                Style = SimpleMarkerSymbol.SimpleMarkerStyle.Circle
            };

            //polyline barrier layer symbol
            _polylineBarrierSymbol = new client.Symbols.SimpleLineSymbol()
            {
                Color = new SolidColorBrush(Color.FromRgb(138, 43, 226)),
                Width = 5
            };
        }
Example #13
0
        public static bool IsLineRel(this starPadSDK.MathExpr.Expr expr, out LineSymbol ls)
        {
            ls = null;
            var compExpr = expr as CompositeExpr;

            if (compExpr == null)
            {
                return(false);
            }

            if (compExpr.Head.Equals(WellKnownSym.times) &&
                compExpr.Args.Count() == 2)
            {
                var underExpr = compExpr.Args[1] as CompositeExpr;
                if (underExpr == null)
                {
                    return(false);
                }
                if (underExpr.Head.Equals(WellKnownSym.divide) &&
                    underExpr.Args.Count() == 1)
                {
                    var expr1 = underExpr.Args[0] as CompositeExpr;
                    if (expr1 == null)
                    {
                        return(false);
                    }

                    if (expr1.Head.Equals(WellKnownSym.times) &&
                        expr1.Args.Count() == 2)
                    {
                        object obj1, obj2;
                        var    result1 = expr1.Args[0].IsLabel(out obj1);
                        var    result2 = expr1.Args[1].IsLabel(out obj2);

                        if (result1 && result2)
                        {
                            var str1 = obj1 as string;
                            var str2 = obj2 as string;
                            Debug.Assert(str1 != null);
                            Debug.Assert(str2 != null);
                            var label = str1 + str2;
                            var line  = new Line(label);
                            ls = new LineSymbol(line);
                            return(true);
                        }
                        return(false);
                    }
                    else
                    {
                        return(false);
                    }
                }
                return(false);
            }
            return(false);
        }
Example #14
0
 /// <summary>
 /// 加入图片
 /// </summary>
 private void listview_Load()
 {
     for (int i = 0; i < 5; i++)
     {
         LineSymbol newsymbol = new LineSymbol();
         newsymbol.Style = SetDashStyle(i + 1);
         newsymbol.SetColor(Color.Black);
         Label  newlabel = new Label();
         Bitmap bit      = newsymbol.GetBitmap();
         newlabel.Image    = bit;
         newlabel.Size     = new Size(60, 60);
         newlabel.Location = new Point(10 + 70 * (int)(i % 5), 10);
         SymbolListView.Controls.Add(newlabel);
     }
 }
Example #15
0
        /// <summary>
        /// Add leader lines to expanded cluster elements
        /// </summary>
        private void _CreateLeaderLines()
        {
            List <Graphic> _leaderLines = new List <Graphic>();

            foreach (DataGraphicObject dataGraphic in _clusteringLayer.MapLayer.Graphics)
            {
                // TODO: remove hardcode
                LineSymbol simpleLineSymbol = new LineSymbol()
                {
                    Color = (SolidColorBrush)App.Current.FindResource("ClusteringLineBrush"),
                    Width = 2
                };

                ESRI.ArcGIS.Client.Geometry.PointCollection points = new ESRI.ArcGIS.Client.Geometry.PointCollection();

                MapPoint             graphicPosition = dataGraphic.Geometry as MapPoint;
                MapPoint             startPoint      = (MapPoint)_expandedClusterGraphic.Geometry;
                System.Windows.Point point           = _mapctrl.map.MapToScreen(startPoint);

                MarkerSymbol symbol = dataGraphic.Symbol as MarkerSymbol;
                point.X -= symbol.OffsetX;
                point.Y -= symbol.OffsetY;

                MapPoint endPoint = _mapctrl.map.ScreenToMap(point);
                endPoint.X -= startPoint.X - graphicPosition.X;
                endPoint.Y -= startPoint.Y - graphicPosition.Y;

                points.Add(startPoint);
                points.Add(endPoint);

                Polyline lineGeometry = new Polyline();
                lineGeometry.Paths.Add(points);

                Graphic lineGraphic = new Graphic()
                {
                    Symbol   = simpleLineSymbol,
                    Geometry = lineGeometry
                };

                _leaderLines.Add(lineGraphic);
            }

            foreach (Graphic graphic in _leaderLines)
            {
                _leaderLinesLayer.Graphics.Add(graphic);
            }
        }
 //private void WriteFeatureServiceMarkerSymbolProperties(string symbolType, double angle,
 //    double xOffsetFromCenter, double yOffsetFromCenter, Brush color, Brush selectionColor, Point renderTransformPoint)
 //{
 //    WriteAttribute("Angle", angle);
 //    WriteAttribute("XOffsetFromCenter", xOffsetFromCenter);
 //    WriteAttribute("YOffsetFromCenter", yOffsetFromCenter);
 //    if (color != null)
 //    {
 //        writer.WriteStartElement(symbolType + ".Color", Namespaces[Constants.esriFSSymbolsPrefix]);
 //        new BrushXamlWriter(writer, Namespaces).WriteBrush(color);
 //        writer.WriteEndElement();
 //    }
 //    if (selectionColor != null)
 //    {
 //        writer.WriteStartElement(symbolType + ".SelectionColor", Namespaces[Constants.esriFSSymbolsPrefix]);
 //        new BrushXamlWriter(writer, Namespaces).WriteBrush(selectionColor);
 //        writer.WriteEndElement();
 //    }
 //}
 private void WriteLineSymbol(LineSymbol lineSymbol)
 {
     if (lineSymbol is ESRI.ArcGIS.Client.FeatureService.Symbols.SimpleLineSymbol)
     {
         StartType(lineSymbol, Constants.esriFSSymbolsPrefix);
         WriteJsonAttribute(lineSymbol as IJsonSerializable);
     }
     else
     {
         StartType(lineSymbol, Constants.esriPrefix);
         if (lineSymbol.Width != 1.0)
         {
             WriteAttribute("Width", lineSymbol.Width);
         }
         if (lineSymbol is SimpleLineSymbol)
         {
             SimpleLineSymbol sls = lineSymbol as SimpleLineSymbol;
             if (sls.Style != SimpleLineSymbol.LineStyle.Solid)
             {
                 WriteAttribute("Style", (lineSymbol as SimpleLineSymbol).Style.ToString());
             }
         }
         //else if (lineSymbol is ESRI.ArcGIS.Client.FeatureService.Symbols.SimpleLineSymbol)
         //{
         //    ESRI.ArcGIS.Client.FeatureService.Symbols.SimpleLineSymbol slsfs = lineSymbol as ESRI.ArcGIS.Client.FeatureService.Symbols.SimpleLineSymbol;
         //    WriteAttribute("Style", slsfs.Style.ToString());
         //    if (slsfs.SelectionColor != null)
         //    {
         //        writer.WriteStartElement("SimpleLineSymbol.SelectionColor", Namespaces[Constants.esriFSSymbolsPrefix]);
         //        new BrushXamlWriter(writer, Namespaces).WriteBrush(slsfs.SelectionColor);
         //        writer.WriteEndElement();
         //    }
         //}
         SolidColorBrush sb = lineSymbol.Color as SolidColorBrush;
         if (sb != null)
         {
             WriteAttribute("Color", sb.Color);
         }
         else
         {
             writer.WriteStartElement(lineSymbol.GetType().Name + ".Color", Namespaces[Constants.esriPrefix]);
             new BrushXamlWriter(writer, Namespaces).WriteBrush(lineSymbol.Color);
             writer.WriteEndElement();
         }
     }
     writer.WriteEndElement();
 }
        /// <summary>
        /// 唯一值渲染和分级渲染时的绘制要素
        /// </summary>
        /// <param name="g"></param>
        /// <param name="bounds"></param>
        /// <param name="centerPos"></param>
        /// <param name="scale"></param>
        /// <param name="fid2Symbol"></param>
        internal override void DrawSpaceData(Graphics g, Rectangle bounds, PointF centerPos, double scale, Dictionary <int, Symbol> fid2Symbol)
        {
            //选中要素的样式
            Pen selectedPen = new Pen(Color.Cyan);

            selectedPen.Width = 2.5F;

            MyPoint xyCenter = ETCProjection.LngLat2XY(new MyPoint(centerPos.X, centerPos.Y));
            double  xmin     = xyCenter.X - scale * bounds.Width / 2;
            double  xmax     = xyCenter.X + scale * bounds.Width / 2;
            double  ymin     = xyCenter.Y - scale * bounds.Height / 2;
            double  ymax     = xyCenter.Y + scale * bounds.Height / 2;

            for (int i = 0; i < polylines.Count; i++)
            {
                //从symbol中获取样式
                LineSymbol ls    = (LineSymbol)fid2Symbol[polylines[i].FID];
                Pen        mypen = ls.GetPen;

                List <int> parts = new List <int>(polylines[i].firstIndex);
                parts.Add(polylines[i].PointCount);
                for (int k = 0; k < polylines[i].firstIndex.Length; k++)  //对于每一条多线的子线段
                {
                    List <PointF> pointfs = new List <PointF>();
                    for (int j = parts[k]; j < parts[k + 1]; j++)
                    {
                        MyPoint xyProjection = ETCProjection.LngLat2XY(polylines[i].Points[j]);
                        double  xScreen      = bounds.Width * (xyProjection.X - xmin) / (xmax - xmin);
                        double  yScreen      = bounds.Height * (xyProjection.Y - ymin) / (ymax - ymin);
                        PointF  p            = new PointF((float)xScreen, bounds.Height - (float)yScreen);
                        pointfs.Add(p);
                    }
                    if (GeometryTools.IsPointsPartInRectangle(pointfs.ToArray(), new MyRectangle(bounds.X, bounds.Width, bounds.Y, bounds.Height)) == true)
                    {
                        if (polylines[i].Selected == false)
                        {
                            g.DrawLines(mypen, pointfs.ToArray());
                        }
                        else
                        {
                            g.DrawLines(selectedPen, pointfs.ToArray());
                        }
                    }
                }
            }
        }
Example #18
0
        public static Symbol CloneSymbol(this Symbol symbol)
        {
            ICustomSymbol customSymbol = symbol as ICustomSymbol;

            if (customSymbol != null)
            {
                return(customSymbol.Clone());
            }
            if (symbol is IJsonSerializable && symbol.GetType().Namespace.StartsWith("ESRI.ArcGIS.Client.FeatureService.Symbols", StringComparison.Ordinal))
            {
                string json = GetJsonForSymbol(symbol as IJsonSerializable);
                if (!string.IsNullOrEmpty(json))
                {
                    if (symbol is ESRI.ArcGIS.Client.FeatureService.Symbols.SimpleMarkerSymbol)
                    {
                        json = json.Replace(",\"outline\":null", string.Empty);//WORKAROUND for core bug
                    }
                    return(Symbol.FromJson(json));
                }
            }
            FillSymbol fillSymbol = symbol as FillSymbol;

            if (fillSymbol != null)
            {
                return(cloneFillSymbol(fillSymbol));
            }
            else
            {
                LineSymbol lineSymbol = symbol as LineSymbol;
                if (lineSymbol != null)
                {
                    return(cloneLineSymbol(lineSymbol));
                }
                else
                {
                    ESRI.ArcGIS.Client.Symbols.MarkerSymbol markerSymbol = symbol as ESRI.ArcGIS.Client.Symbols.MarkerSymbol;
                    if (markerSymbol != null)
                    {
                        return(cloneMarkerSymbol(markerSymbol));
                    }
                }
            }
            return(symbol);
        }
Example #19
0
        public void Init(GroupLayer gl, MapPoint start, MapPoint finish, ResourceDictionary rd)
        {
            Start = new csPoint() { Mp = start };
            Finish = new csPoint() { Mp = finish };
            MLayer = new GraphicsLayer() { ID = Guid.NewGuid().ToString() };
            _start = new Graphic();
            _finish = new Graphic();
            Line = new Graphic();

            LineSymbol ls = new LineSymbol() { Color = Brushes.Black, Width = 4 };
            Line.Symbol = ls;
            UpdateLine();

            MLayer.Graphics.Add(Line);

            _start.Geometry = start;
            _start.Attributes["position"] = start;

            _start.Symbol = rd["Start"] as Symbol;
            _start.Attributes["finish"] = _finish;
            _start.Attributes["start"] = _start;
            _start.Attributes["line"] = Line;
            _start.Attributes["state"] = "start";
            _start.Attributes["measure"] = this;
            _start.Attributes["menuenabled"] = true;
            MLayer.Graphics.Add(_start);

            _finish.Geometry = finish;
            _finish.Attributes["position"] = finish;
            _finish.Symbol = rd["Finish"] as Symbol;
            _finish.Attributes["finish"] = _finish;
            _finish.Attributes["start"] = _start;
            _finish.Attributes["line"] = Line;
            _finish.Attributes["measure"] = this;
            _finish.Attributes["state"] = "finish";
            MLayer.Graphics.Add(_finish);

            Layer.ChildLayers.Add(MLayer);
            MLayer.Initialize();

            AppStateSettings.Instance.ViewDef.MapManipulationDelta += ViewDef_MapManipulationDelta;

        }
Example #20
0
 public UniqueValueRenderer(Layer layer)
 {
     this._Layer    = layer;
     this._Field    = null;
     _ValueColorDic = new Dictionary <string, Color>();
     this.ValueDic  = new DictionaryPropertyGridAdapter(_ValueColorDic);
     if (_Layer.GeoType == typeof(PointD))
     {
         _DefaultSymbol = new PointSymbol(PointSymbol.PointStyleConstant.FillCircle, 4, Color.Black);
     }
     else if (_Layer.GeoType == typeof(MultiPolyLine))
     {
         _DefaultSymbol = new LineSymbol(DashStyle.Solid, 2, Color.Black);
     }
     else
     {
         LineSymbol outlineSymbol = new LineSymbol(DashStyle.Solid, 1, Color.Black);
         _DefaultSymbol = new PolygonSymbol(Color.Red, outlineSymbol);
     }
 }
        public static Color GetDefaultSymbolBorderColor(this GraphicsLayer layer)
        {
            Symbol symbol = layer.GetDefaultSymbol();

            SolidColorBrush solidColorBrush;

            FSS.SimpleMarkerSymbol fsSimpleMarkerSymbol;
            if ((fsSimpleMarkerSymbol = symbol as FSS.SimpleMarkerSymbol) != null)
            {
                if ((solidColorBrush = fsSimpleMarkerSymbol.OutlineColor as SolidColorBrush) != null)
                {
                    return(solidColorBrush.Color);
                }
            }
            else
            {
                FillSymbol fillSymbol = symbol as FillSymbol;
                if (fillSymbol != null)
                {
                    solidColorBrush = fillSymbol.BorderBrush as SolidColorBrush;
                    if (solidColorBrush != null)
                    {
                        return(solidColorBrush.Color);
                    }
                }
                else
                {
                    LineSymbol lineSymbol = symbol as LineSymbol;
                    if (lineSymbol != null)
                    {
                        solidColorBrush = lineSymbol.Color as SolidColorBrush;
                        if (solidColorBrush != null)
                        {
                            return(solidColorBrush.Color);
                        }
                    }
                }
            }
            return(Colors.Transparent);
        }
Example #22
0
        /// <summary>
        /// 自动生成符号大小等级渲染符号列表
        /// </summary>
        /// <param name="minsize"></param>
        /// <param name="maxsize"></param>
        private void AutoSetSize(double minsize, double maxsize)
        {
            double k = (double)(maxsize - minsize) / (breaks.Count);        //平均每级的变化幅度

            for (int i = 0; i < breaks.Count + 1; i++)
            {
                if (datatype == MySpaceDataType.MyPoint)
                {
                    Symbol      basesymbol = CreatNewSymbol();
                    PointSymbol newsymbol  = (PointSymbol)basesymbol;
                    newsymbol.Size = (float)(minsize + i * k);
                    symbolstyles.Add(newsymbol);
                }
                if (datatype == MySpaceDataType.MyPolyLine)
                {
                    Symbol     basesymbol = CreatNewSymbol();
                    LineSymbol newsymbol  = (LineSymbol)basesymbol;
                    newsymbol.Size = (float)(minsize + i * k);
                    symbolstyles.Add(newsymbol);
                }
            }
        }
Example #23
0
        public DrawControl(Map map)
        {
            _drawControl           = new Draw();
            _drawControl.IsEnabled = false;

            _drawControl.Map = map;

            _defaultFillSymbol = new ESRI.ArcGIS.Client.Symbols.FillSymbol();
            _defaultFillSymbol.BorderThickness = 3;
            _defaultFillSymbol.BorderBrush     = new SolidColorBrush(Colors.Red);
            _defaultFillSymbol.Fill            = new SolidColorBrush(Color.FromArgb(100, 255, 0, 0));

            _drawControl.FillSymbol = _defaultFillSymbol;

            _defaultLineSymbo       = new ESRI.ArcGIS.Client.Symbols.LineSymbol();
            _defaultLineSymbo.Color = new SolidColorBrush(Colors.Red);
            _defaultLineSymbo.Width = 5;

            _drawControl.LineSymbol = _defaultLineSymbo;

            _drawControl.DrawComplete += _drawControl_DrawComplete;
        }
        private void setNonSerializablePropertiesOfSymbolToNull()
        {
            // Control templates cannot be serialized
            Symbol.ControlTemplate = null;

            // Set all brushes to null - we can't serialize brushes
            ImageFillSymbol imageFillSymbol = Symbol as ImageFillSymbol;

            if (imageFillSymbol != null)
            {
                imageFillSymbol.Fill  = null;
                imageFillSymbol.Color = null;
            }
            else
            {
                ESRI.ArcGIS.Mapping.Core.Symbols.MarkerSymbol markerSymbol = Symbol as ESRI.ArcGIS.Mapping.Core.Symbols.MarkerSymbol;
                if (markerSymbol != null)
                {
                    markerSymbol.Color = null;
                }
                else
                {
                    FillSymbol fillSymbol = Symbol as FillSymbol;
                    if (fillSymbol != null)
                    {
                        fillSymbol.BorderBrush = null;
                        fillSymbol.Fill        = null;
                    }
                    else
                    {
                        LineSymbol lineSymbol = Symbol as LineSymbol;
                        if (lineSymbol != null)
                        {
                            lineSymbol.Color = null;
                        }
                    }
                }
            }
        }
Example #25
0
        public ClassBreakRenderer(Layer layer)
        {
            this._Layer      = layer;
            this._Field      = null;
            this._StartColor = Color.FromArgb(237, 248, 233);
            this._EndColor   = Color.FromArgb(35, 139, 69);

            //生成默认符号
            if (_Layer.GeoType == typeof(PointD))
            {
                _DefaultSymbol = new PointSymbol(PointSymbol.PointStyleConstant.FillCircle, 4, Color.Black);
            }
            else if (_Layer.GeoType == typeof(MultiPolyLine))
            {
                _DefaultSymbol = new LineSymbol(DashStyle.Solid, 2, Color.Black);
            }
            else
            {
                LineSymbol outlineSymbol = new LineSymbol(DashStyle.Solid, 1, Color.Black);
                _DefaultSymbol = new PolygonSymbol(Color.Red, outlineSymbol);
            }
        }
Example #26
0
        void SymbolBorderThickness_ThicknessValueChanged(object sender, EventArgs e)
        {
            if (SymbolBorderThickness == null)
            {
                return;
            }

            double newSize = SymbolBorderThickness.TargetThickness.Bottom;

            if (newSize < 0)
            {
                return;
            }

            FillSymbol fillSymbol = Symbol as FillSymbol;

            FSS.SimpleMarkerSymbol sms = Symbol as FSS.SimpleMarkerSymbol;
            if (sms != null)
            {
                sms.OutlineThickness = newSize;
                onCurrentSymbolChanged();
            }
            else if (fillSymbol != null)
            {
                fillSymbol.BorderThickness = newSize;
                onCurrentSymbolChanged();
            }
            else
            {
                LineSymbol lineSymbol = Symbol as LineSymbol;
                if (lineSymbol != null)
                {
                    lineSymbol.Width = newSize;
                    onCurrentSymbolChanged();
                }
            }
        }
 private static Symbol CreateDefaultSymbol(GeometryType geomType)
 {
     Symbol symbol = null;
     switch (geomType)
     {
         case GeometryType.Point:
         case GeometryType.MultiPoint:
             {
                 symbol = new SimpleMarkerSymbol() { Color = new SolidColorBrush(Colors.Red) };
             } break;
         case GeometryType.Polygon:
             {
                 symbol = new FillSymbol() { BorderBrush = new SolidColorBrush(Colors.Black), Fill = new SolidColorBrush(Colors.Red) };
             } break;
         case GeometryType.Polyline:
             {
                 symbol = new LineSymbol() { Color = new SolidColorBrush(Colors.Red) };
             } break;
     }
     return symbol;
 }
Example #28
0
        /// <summary>
        /// 分级渲染单个图层
        /// </summary>
        /// <param name="g"></param>
        /// <param name="layer"></param>
        private void RenderAsClassBreaksRenderer(Graphics g, Layer layer)
        {
            ClassBreaksRenderer cRenderer = layer.Renderer as ClassBreaksRenderer; // 强转,使图层渲染器为分级渲染器
            string field = cRenderer.Field;

            //图层为点图层
            if (layer.FeatureType == typeof(PointD))
            {
                for (int i = 0; i < layer.Features.Count; i++)
                {
                    double      value   = Convert.ToDouble(layer.Table.Rows[i][field]); //获取feature的相应值
                    PointSymbol pSymbol = cRenderer.FindSymbol(value) as PointSymbol;   //获取符号类型
                    PointD      point   = layer.Features[i] as PointD;                  //获取id为i的点

                    //转换为屏幕坐标,绘制
                    PointD screenPoint = FromMapPoint(point);
                    PointF DrawPoint   = new PointF((float)screenPoint.X, (float)screenPoint.Y);
                    pSymbol.DrawPoint(g, DrawPoint);
                }
            }

            //图层为折线图层
            else if (layer.FeatureType == typeof(Polyline))
            {
                for (int i = 0; i < layer.Features.Count; i++)
                {
                    double     value   = Convert.ToDouble(layer.Table.Rows[i][field]); //获取feature的相应值
                    LineSymbol lSymbol = cRenderer.FindSymbol(value) as LineSymbol;    //获取符号类型

                    Polyline      line       = layer.Features[i] as Polyline;          //获得折线
                    List <PointF> screenLine = new List <PointF>();

                    for (int j = 0; j < line.Data.Count; j++)
                    {
                        PointD point = FromMapPoint(line.Data[j]);                  //坐标转换
                        screenLine.Add(new PointF((float)point.X, (float)point.Y)); //添加到绘制队列
                    }
                    lSymbol.DrawLine(g, screenLine.ToArray());                      //绘制
                }
            }

            //图层为复合折线图层
            else if (layer.FeatureType == typeof(MultiPolyline))
            {
                for (int i = 0; i < layer.Features.Count; i++)
                {
                    double     value   = Convert.ToDouble(layer.Table.Rows[i][field]); //获取feature的相应值
                    LineSymbol lSymbol = cRenderer.FindSymbol(value) as LineSymbol;    //获取符号类型

                    MultiPolyline lines = layer.Features[i] as MultiPolyline;          //获得复合折线
                    for (int j = 0; j < lines.Data.Count; j++)
                    {
                        Polyline      line       = lines.Data[j];
                        List <PointF> screenLine = new List <PointF>();
                        for (int k = 0; k < line.Data.Count; k++)
                        {
                            PointD point = FromMapPoint(line.Data[k]);                  //坐标转换
                            screenLine.Add(new PointF((float)point.X, (float)point.Y)); //添加到绘制队列
                        }
                        lSymbol.DrawLine(g, screenLine.ToArray());                      //绘制
                    }
                }
            }

            //图层为多边形图层
            else if (layer.FeatureType == typeof(Polygon))
            {
                for (int i = 0; i < layer.Features.Count; i++)
                {
                    double        value   = Convert.ToDouble(layer.Table.Rows[i][field]); //获取feature的相应值
                    PolygonSymbol pSymbol = cRenderer.FindSymbol(value) as PolygonSymbol; //获取符号类型

                    Polygon       polygon       = layer.Features[i] as Polygon;           //获得折线
                    List <PointF> screenPolygon = new List <PointF>();

                    for (int j = 0; j < polygon.Data.Count; j++)
                    {
                        PointD point = FromMapPoint(polygon.Data[j]);                  //坐标转换
                        screenPolygon.Add(new PointF((float)point.X, (float)point.Y)); //添加到绘制队列
                    }
                    pSymbol.DrawPolygon(g, screenPolygon.ToArray());                   //绘制
                }
            }

            //图层为复合折线图层
            else if (layer.FeatureType == typeof(MultiPolygon))
            {
                for (int i = 0; i < layer.Features.Count; i++)
                {
                    double        value   = Convert.ToDouble(layer.Table.Rows[i][field]); //获取feature的相应值
                    PolygonSymbol pSymbol = cRenderer.FindSymbol(value) as PolygonSymbol; //获取符号类型

                    MultiPolygon polygons = layer.Features[i] as MultiPolygon;            //获得复合折线
                    for (int j = 0; j < polygons.Data.Count; j++)
                    {
                        Polygon       polygon       = polygons.Data[j];
                        List <PointF> screenPolygon = new List <PointF>();
                        for (int k = 0; k < polygon.Data.Count; k++)
                        {
                            PointD point = FromMapPoint(polygon.Data[k]);                  //坐标转换
                            screenPolygon.Add(new PointF((float)point.X, (float)point.Y)); //添加到绘制队列
                        }
                        pSymbol.DrawPolygon(g, screenPolygon.ToArray());                   //绘制
                    }
                }
            }
        }
Example #29
0
        /// <summary>
        /// 简单渲染单个图层
        /// </summary>
        /// <param name="g"></param>
        /// <param name="layer"></param>
        private void RenderAsSimpleRenderer(Graphics g, Layer layer)
        {
            SimpleRenderer sRenderer = layer.Renderer as SimpleRenderer; // 强转,使图层渲染器为唯一值渲染器

            //图层类型为点
            if (layer.FeatureType == typeof(PointD))
            {
                PointSymbol pSymbol = sRenderer.Symbol as PointSymbol;  //强转,使符号为点符号
                for (int i = 0; i < layer.Features.Count; i++)
                {
                    PointD point = layer.Features[i] as PointD;

                    //转换为屏幕坐标,绘制
                    PointD screenPoint = FromMapPoint(point);
                    PointF DrawPoint   = new PointF((float)screenPoint.X, (float)screenPoint.Y);
                    pSymbol.DrawPoint(g, DrawPoint);
                }
            }

            //图层类型为折线
            else if (layer.FeatureType == typeof(Polyline))
            {
                LineSymbol lSymbol = sRenderer.Symbol as LineSymbol;  //强转,使符号为线符号
                for (int i = 0; i < layer.Features.Count; i++)
                {
                    Polyline      line       = layer.Features[i] as Polyline; //获得折线
                    List <PointF> screenLine = new List <PointF>();

                    for (int j = 0; j < line.Data.Count; j++)
                    {
                        PointD point = FromMapPoint(line.Data[j]);                  //坐标转换
                        screenLine.Add(new PointF((float)point.X, (float)point.Y)); //添加到绘制队列
                    }
                    lSymbol.DrawLine(g, screenLine.ToArray());                      //绘制
                }
            }

            //图层类型为复合折线
            else if (layer.FeatureType == typeof(MultiPolyline))
            {
                LineSymbol lSymbol = sRenderer.Symbol as LineSymbol;  //强转,使符号为线符号
                for (int i = 0; i < layer.Features.Count; i++)
                {
                    MultiPolyline lines = layer.Features[i] as MultiPolyline;  //获得复合折线
                    for (int j = 0; j < lines.Data.Count; j++)
                    {
                        Polyline      line       = lines.Data[j];
                        List <PointF> screenLine = new List <PointF>();
                        for (int k = 0; k < line.Data.Count; k++)
                        {
                            PointD point = FromMapPoint(line.Data[k]);                  //坐标转换
                            screenLine.Add(new PointF((float)point.X, (float)point.Y)); //添加到绘制队列
                        }
                        lSymbol.DrawLine(g, screenLine.ToArray());                      //绘制
                    }
                }
            }

            //图层类型为多边形
            else if (layer.FeatureType == typeof(Polygon))
            {
                PolygonSymbol pSymbol = sRenderer.Symbol as PolygonSymbol;  //强转,使符号为面符号
                for (int i = 0; i < layer.Features.Count; i++)
                {
                    Polygon       polygon       = layer.Features[i] as Polygon; //获得折线
                    List <PointF> screenPolygon = new List <PointF>();

                    for (int j = 0; j < polygon.Data.Count; j++)
                    {
                        PointD point = FromMapPoint(polygon.Data[j]);                  //坐标转换
                        screenPolygon.Add(new PointF((float)point.X, (float)point.Y)); //添加到绘制队列
                    }
                    pSymbol.DrawPolygon(g, screenPolygon.ToArray());                   //绘制
                }
            }

            //图层类型为复合多边形
            else if (layer.FeatureType == typeof(MultiPolygon))
            {
                PolygonSymbol pSymbol = sRenderer.Symbol as PolygonSymbol;  //强转,使符号为线符号
                for (int i = 0; i < layer.Features.Count; i++)
                {
                    MultiPolygon polygons = layer.Features[i] as MultiPolygon;  //获得复合折线
                    for (int j = 0; j < polygons.Data.Count; j++)
                    {
                        Polygon       polygon       = polygons.Data[j];
                        List <PointF> screenPolygon = new List <PointF>();
                        for (int k = 0; k < polygon.Data.Count; k++)
                        {
                            PointD point = FromMapPoint(polygon.Data[k]);                  //坐标转换
                            screenPolygon.Add(new PointF((float)point.X, (float)point.Y)); //添加到绘制队列
                        }
                        pSymbol.DrawPolygon(g, screenPolygon.ToArray());                   //绘制
                    }
                }
            }
        }
Example #30
0
        public void Init(GroupLayer gl, MapPoint start, MapPoint finish, ResourceDictionary rd)
        {
            Start = new EffectsPoint() { Mp = start };
            Finish = new EffectsPoint() { Mp = finish };
            MLayer = new GraphicsLayer() { ID = Guid.NewGuid().ToString() };
            ContoursLayer = new GraphicsLayer() { ID = Guid.NewGuid().ToString() };
            _start = new Graphic();
            _finish = new Graphic();
            Line = new Graphic();
            BaseEffectsModelShapes = new GraphicCollection();
            EffectsModelShapes = new GraphicCollection();

            
            
//            var testJson = new FileInfo(@"Plugins\USDomainPlugin\Effects\Data\testshape.json");
//            JObject geoJson = null;
//            using (var reader = testJson.OpenText())
//            {
//                var strJson = reader.ReadToEnd();
//                geoJson = JObject.Parse(strJson);
//                reader.Close();
//            }
//            var strWkt = @"POLYGON ((281.4968022018320000 0,281.3579005227060000 8.8420282352252900,280.9413325645150000 17.6753304560934000,280.2475094295410000 26.4911892597699000,279.2771158374510000 35.2809044579670000,278.0311094495650000 44.0358016629793000,276.5107199237550000 52.7472408482570000,274.7174477009240000 61.4066248750691000,272.6530625242520000 70.0054079768411000,270.3196016926710000 78.5351041927953000,267.7193680503000000 86.9872957425693000,264.8549277138150000 95.3536413335488000,261.7291075400000000 103.6258843927170000,258.3449923359800000 111.7958612148940000,254.7059218148940000 119.8555090193290000,250.8154872999950000 127.7968739066940000,246.6775281804520000 135.6121187086160000,242.2961281223330000 143.2935307220230000,237.6756110385240000 150.8335293206440000,232.8205368215440000 158.2246734361790000,227.7356968434850000 165.4596689017280000,222.4261092275060000 172.5313756502600000,216.8970138955490000 179.4328147609900000,211.1538673971700000 186.1571753467370000,205.2023375245860000 192.6978212754450000,199.0482977192440000 199.0482977192440000,192.6978212754450000 205.2023375245860000,186.1571753467370000 211.1538673971700000,179.4328147609900000 216.8970138955490000,172.5313756502600000 222.4261092275060000,165.4596689017280000 227.7356968434850000,158.2246734361790000 232.8205368215440000,150.8335293206440000 237.6756110385240000,143.2935307220230000 242.2961281223330000,135.6121187086160000 246.6775281804520000,127.7968739066940000 250.8154872999950000,119.8555090193290000 254.7059218148940000,111.7958612148940000 258.3449923359800000,103.6258843927170000 261.7291075400000000,95.3536413335487000 264.8549277138150000,86.9872957425692000 267.7193680503000000,78.5351041927953000 270.3196016926710000,70.0054079768411000 272.6530625242520000,61.4066248750690000 274.7174477009240000,52.7472408482570000 276.5107199237550000,44.0358016629793000 278.0311094495650000,35.2809044579670000 279.2771158374510000,26.4911892597699000 280.2475094295410000,17.6753304560934000 280.9413325645150000,8.8420282352253100 281.3579005227060000,0.0000000000000172 281.4968022018320000,-8.8420282352252800 281.3579005227060000,-17.6753304560934000 280.9413325645150000,-26.4911892597699000 280.2475094295410000,-35.2809044579670000 279.2771158374510000,-44.0358016629793000 278.0311094495650000,-52.7472408482571000 276.5107199237550000,-61.4066248750690000 274.7174477009240000,-70.0054079768410000 272.6530625242520000,-78.5351041927953000 270.3196016926710000,-86.9872957425692000 267.7193680503000000,-95.3536413335488000 264.8549277138150000,-103.6258843927170000 261.7291075400000000,-111.7958612148940000 258.3449923359800000,-119.8555090193300000 254.7059218148940000,-127.7968739066940000 250.8154872999950000,-135.6121187086170000 246.6775281804520000,-143.2935307220230000 242.2961281223330000,-150.8335293206440000 237.6756110385240000,-158.2246734361790000 232.8205368215440000,-165.4596689017280000 227.7356968434850000,-172.5313756502600000 222.4261092275060000,-179.4328147609900000 216.8970138955490000,-186.1571753467370000 211.1538673971700000,-192.6978212754450000 205.2023375245860000,-199.0482977192440000 199.0482977192440000,-205.2023375245860000 192.6978212754450000,-211.1538673971700000 186.1571753467370000,-216.8970138955490000 179.4328147609900000,-222.4261092275060000 172.5313756502600000,-227.7356968434850000 165.4596689017280000,-232.8205368215440000 158.2246734361790000,-237.6756110385240000 150.8335293206440000,-242.2961281223330000 143.2935307220230000,-246.6775281804520000 135.6121187086160000,-250.8154872999950000 127.7968739066940000,-254.7059218148940000 119.8555090193290000,-258.3449923359800000 111.7958612148940000,-261.7291075400000000 103.6258843927170000,-264.8549277138150000 95.3536413335488000,-267.7193680503000000 86.9872957425693000,-270.3196016926710000 78.5351041927953000,-272.6530625242520000 70.0054079768411000,-274.7174477009240000 61.4066248750690000,-276.5107199237550000 52.7472408482571000,-278.0311094495650000 44.0358016629793000,-279.2771158374510000 35.2809044579671000,-280.2475094295410000 26.4911892597699000,-280.9413325645150000 17.6753304560935000,-281.3579005227060000 8.8420282352252700,-281.4968022018320000 0.0000000000000345,-281.3579005227060000 -8.8420282352253200,-280.9413325645150000 -17.6753304560934000,-280.2475094295410000 -26.4911892597699000,-279.2771158374510000 -35.2809044579670000,-278.0311094495650000 -44.0358016629794000,-276.5107199237550000 -52.7472408482570000,-274.7174477009240000 -61.4066248750692000,-272.6530625242520000 -70.0054079768412000,-270.3196016926710000 -78.5351041927953000,-267.7193680503000000 -86.9872957425693000,-264.8549277138150000 -95.3536413335488000,-261.7291075400000000 -103.6258843927170000,-258.3449923359800000 -111.7958612148940000,-254.7059218148940000 -119.8555090193290000,-250.8154872999950000 -127.7968739066940000,-246.6775281804520000 -135.6121187086160000,-242.2961281223330000 -143.2935307220230000,-237.6756110385240000 -150.8335293206440000,-232.8205368215440000 -158.2246734361790000,-227.7356968434850000 -165.4596689017280000,-222.4261092275060000 -172.5313756502600000,-216.8970138955490000 -179.4328147609900000,-211.1538673971700000 -186.1571753467370000,-205.2023375245860000 -192.6978212754450000,-199.0482977192440000 -199.0482977192440000,-192.6978212754450000 -205.2023375245860000,-186.1571753467370000 -211.1538673971700000,-179.4328147609900000 -216.8970138955490000,-172.5313756502600000 -222.4261092275060000,-165.4596689017280000 -227.7356968434850000,-158.2246734361790000 -232.8205368215440000,-150.8335293206440000 -237.6756110385240000,-143.2935307220230000 -242.2961281223330000,-135.6121187086160000 -246.6775281804520000,-127.7968739066940000 -250.8154872999950000,-119.8555090193290000 -254.7059218148940000,-111.7958612148940000 -258.3449923359800000,-103.6258843927170000 -261.7291075400000000,-95.3536413335488000 -264.8549277138150000,-86.9872957425693000 -267.7193680503000000,-78.5351041927954000 -270.3196016926710000,-70.0054079768412000 -272.6530625242520000,-61.4066248750690000 -274.7174477009240000,-52.7472408482570000 -276.5107199237550000,-44.0358016629793000 -278.0311094495650000,-35.2809044579671000 -279.2771158374510000,-26.4911892597698000 -280.2475094295410000,-17.6753304560934000 -280.9413325645150000,-8.8420282352252900 -281.3579005227060000,-0.0000000000000517 -281.4968022018320000,8.8420282352251800 -281.3579005227060000,17.6753304560935000 -280.9413325645150000,26.4911892597699000 -280.2475094295410000,35.2809044579670000 -279.2771158374510000,44.0358016629792000 -278.0311094495650000,52.7472408482572000 -276.5107199237550000,61.4066248750692000 -274.7174477009240000,70.0054079768411000 -272.6530625242520000,78.5351041927953000 -270.3196016926710000,86.9872957425694000 -267.7193680503000000,95.3536413335489000 -264.8549277138150000,103.6258843927170000 -261.7291075400000000,111.7958612148940000 -258.3449923359800000,119.8555090193290000 -254.7059218148940000,127.7968739066940000 -250.8154872999950000,135.6121187086160000 -246.6775281804520000,143.2935307220230000 -242.2961281223330000,150.8335293206440000 -237.6756110385240000,158.2246734361790000 -232.8205368215440000,165.4596689017280000 -227.7356968434850000,172.5313756502600000 -222.4261092275060000,179.4328147609900000 -216.8970138955490000,186.1571753467370000 -211.1538673971700000,192.6978212754450000 -205.2023375245860000,199.0482977192440000 -199.0482977192440000,205.2023375245860000 -192.6978212754450000,211.1538673971700000 -186.1571753467370000,216.8970138955490000 -179.4328147609900000,222.4261092275060000 -172.5313756502600000,227.7356968434850000 -165.4596689017280000,232.8205368215440000 -158.2246734361790000,237.6756110385240000 -150.8335293206440000,242.2961281223330000 -143.2935307220230000,246.6775281804520000 -135.6121187086160000,250.8154872999950000 -127.7968739066940000,254.7059218148940000 -119.8555090193290000,258.3449923359800000 -111.7958612148940000,261.7291075400000000 -103.6258843927170000,264.8549277138150000 -95.3536413335488000,267.7193680503000000 -86.9872957425693000,270.3196016926710000 -78.5351041927954000,272.6530625242520000 -70.0054079768413000,274.7174477009240000 -61.4066248750690000,276.5107199237550000 -52.7472408482570000,278.0311094495650000 -44.0358016629794000,279.2771158374510000 -35.2809044579671000,280.2475094295410000 -26.4911892597698000,280.9413325645150000 -17.6753304560934000,281.3579005227060000 -8.8420282352253000,281.4968022018320000 -0.0000000000000689))";

//            BaseEffectsModelShapes.AddRange(geoJson.ToGraphic(new SpatialReference(28992)));
//            BaseEffectsModelShapes.AddRange(strWkt.ToGraphic(new SpatialReference(28992)));
//            BaseEffectsModelShapes.ForEach(shape =>
//            {
//                var clone = new Graphic();
//                clone.Geometry = ((Polygon) shape.Geometry).Clone();
//                clone.Symbol = new SimpleFillSymbol
//                {
//                    BorderBrush = new SolidColorBrush(Colors.Black),
//                    BorderThickness = 4,
//                    Fill = new SolidColorBrush(Colors.Red) { Opacity = 0.8f }
//                };
//                clone.Attributes.Add("base", shape);
//                EffectsModelShapes.Add(clone);
//            });
//            ContoursLayer.Graphics.AddRange(EffectsModelShapes);
//            ContoursLayer.Graphics.AddRange(BaseEffectsModelShapes);
            Layer.ChildLayers.Add(ContoursLayer);
            Layer.ChildLayers.Add(MLayer);

            LineSymbol ls = new LineSymbol() { Color = Brushes.Black, Width = 4 };
            Line.Symbol = ls;
            UpdateLine();

            MLayer.Graphics.Add(Line);
            _start.Geometry = start;
            _start.Attributes["position"] = start;

            _start.Symbol = rd["Start"] as Symbol;
            _start.Attributes["finish"] = _finish;
            _start.Attributes["start"] = _start;
            _start.Attributes["line"] = Line;
            _start.Attributes["state"] = "start";
            _start.Attributes["direction"] = this;
            _start.Attributes["menuenabled"] = true;

            MLayer.Graphics.Add(_start);

            _finish.Geometry = finish;
            _finish.Attributes["position"] = finish;
            _finish.Symbol = rd["Finish"] as Symbol;
            _finish.Attributes["finish"] = _finish;
            _finish.Attributes["start"] = _start;
            _finish.Attributes["line"] = Line;
            _finish.Attributes["direction"] = this;
            _finish.Attributes["state"] = "finish";
            MLayer.Graphics.Add(_finish);


            MLayer.Initialize();

            _start.SetZIndex(10);
            _finish.SetZIndex(10);
            Line.SetZIndex(10);

            SettingsViewModel = new EffectsModelSettingsViewModel();
            SettingsViewModel.PropertyChanged += SettingsViewModelOnPropertyChanged;
            SettingsViewModel.Initialize();

            AppStateSettings.Instance.ViewDef.MapManipulationDelta += ViewDef_MapManipulationDelta;

        }
Example #31
0
        private static BaseSymbol GetSymbolFromType(int objectType, byte symType)
        {
            BaseSymbol bs = null;

            switch (objectType)
            {
                case 1:
                    bs = new PointSymbol();
                    break;
                case 2:
                    if (symType == 0x01)
                        bs = new LineTextSymbol();
                    else
                        bs = new LineSymbol();
                    break;
                case 3:
                    bs = new AreaSymbol();
                    break;
                case 4:
                    bs = new TextSymbol();
                    break;
                case 5:
                    bs = new RectangleSymbol();
                    break;
                default:
                    throw new ApplicationException("Unknown objectType: " + objectType);
            }
            return bs;
        }
Example #32
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="symbol"></param>
 public void SetSelectionLineSymbol(LineSymbol symbol)
 {
     lineSymbol = symbol;
 }
 public void DrawLine(object pen, float x1, float y1, float x2, float y2)
 {
     LineSymDef symdef = (LineSymDef) pen;
     PointKind[] kinds = {PointKind.Normal, PointKind.Normal};
     PointF[] points = { Geometry.TransformPoint(new PointF(x1, y1), currentTransform), Geometry.TransformPoint(new PointF(x2, y2), currentTransform) };
     SymPath path = new SymPath(points, kinds);
     LineSymbol symbol = new LineSymbol(symdef, path);
     map.AddSymbol(symbol);
 }
Example #34
0
        /// <summary>
        /// Add leader lines to expanded cluster elements
        /// </summary>
        private void _CreateLeaderLines()
        {
            List<Graphic> _leaderLines = new List<Graphic>();

            foreach (DataGraphicObject dataGraphic in _clusteringLayer.MapLayer.Graphics)
            {
                // TODO: remove hardcode
                LineSymbol simpleLineSymbol = new LineSymbol()
                {
                    Color = (SolidColorBrush)App.Current.FindResource("ClusteringLineBrush"),
                    Width = 2
                };

                ESRI.ArcGIS.Client.Geometry.PointCollection points = new ESRI.ArcGIS.Client.Geometry.PointCollection();

                MapPoint graphicPosition = dataGraphic.Geometry as MapPoint;
                MapPoint startPoint = (MapPoint)_expandedClusterGraphic.Geometry;
                System.Windows.Point point = _mapctrl.map.MapToScreen(startPoint);

                MarkerSymbol symbol = dataGraphic.Symbol as MarkerSymbol;
                point.X -= symbol.OffsetX;
                point.Y -= symbol.OffsetY;

                MapPoint endPoint = _mapctrl.map.ScreenToMap(point);
                endPoint.X -= startPoint.X - graphicPosition.X;
                endPoint.Y -= startPoint.Y - graphicPosition.Y;

                points.Add(startPoint);
                points.Add(endPoint);

                Polyline lineGeometry = new Polyline();
                lineGeometry.Paths.Add(points);

                Graphic lineGraphic = new Graphic()
                {
                    Symbol = simpleLineSymbol,
                    Geometry = lineGeometry
                };

                _leaderLines.Add(lineGraphic);
            }

            foreach (Graphic graphic in _leaderLines)
                _leaderLinesLayer.Graphics.Add(graphic);
        }
        public FindClosestResourceToolbar(MapWidget mapWidget, ObservableCollection<ESRI.ArcGIS.OperationsDashboard.DataSource> resourceDatasources, String resourceTypeField, 
            ObservableCollection<ESRI.ArcGIS.OperationsDashboard.DataSource> barriersDataSources)
        {

            InitializeComponent();
            this.DataContext = this; 

            // Store a reference to the MapWidget that the toolbar has been installed to.
            _mapWidget = mapWidget;

            //set up the route task with find closest facility option 
            _routeTask = new RouteTask("http://route.arcgis.com/arcgis/rest/services/World/ClosestFacility/NAServer/ClosestFacility_World/solveClosestFacility");
            _routeTask.SolveClosestFacilityCompleted += SolveClosestFacility_Completed;
            _routeTask.Failed += SolveClosestFacility_Failed;

            //check if the graphicslayers need to be added to the map. 
            setupGraphicsLayer(); 

            //set up the resources/facilities datasource in the combobox 
            setupResourcesDataSource(resourceDatasources); 

            ResourceTypes = new ObservableCollection<ResourceType>();
            _resourceTypeField = resourceTypeField; 

            //set up the barriers types combobox 
            //this will have to be read from the config file...
            BarriersDataSouces = new ObservableCollection<ResourceLayer>();
            //set up facilities type dropdown 
            ResourceLayer barrierLayer = new ResourceLayer();
            barrierLayer.Name = "Select Barrier";
            barrierLayer.DataSource = null;
            BarriersDataSouces.Add(barrierLayer);

            //Barriers - passed from the configurar
            foreach (ESRI.ArcGIS.OperationsDashboard.DataSource datasource in barriersDataSources)
            {
                barrierLayer = new ResourceLayer();
                barrierLayer.Name = datasource.Name; 
                barrierLayer.DataSource = datasource; 
                BarriersDataSouces.Add(barrierLayer);
            }

            cmbBarriers.ItemsSource = BarriersDataSouces;

            _incidentMarkerSymbol = new SimpleMarkerSymbol
            {
                Size = 20,
                Style = SimpleMarkerSymbol.SimpleMarkerStyle.Circle
            };

            //polyline barrier layer symbol
            _polylineBarrierSymbol = new client.Symbols.SimpleLineSymbol()
            {
                Color = new SolidColorBrush(Color.FromRgb(138, 43, 226)),
                Width = 5
            };

        }
 //private void WriteFeatureServiceMarkerSymbolProperties(string symbolType, double angle, 
 //    double xOffsetFromCenter, double yOffsetFromCenter, Brush color, Brush selectionColor, Point renderTransformPoint)
 //{
 //    WriteAttribute("Angle", angle);
 //    WriteAttribute("XOffsetFromCenter", xOffsetFromCenter);
 //    WriteAttribute("YOffsetFromCenter", yOffsetFromCenter);
 //    if (color != null)
 //    {
 //        writer.WriteStartElement(symbolType + ".Color", Namespaces[Constants.esriFSSymbolsPrefix]);
 //        new BrushXamlWriter(writer, Namespaces).WriteBrush(color);
 //        writer.WriteEndElement();
 //    }
 //    if (selectionColor != null)
 //    {
 //        writer.WriteStartElement(symbolType + ".SelectionColor", Namespaces[Constants.esriFSSymbolsPrefix]);
 //        new BrushXamlWriter(writer, Namespaces).WriteBrush(selectionColor);
 //        writer.WriteEndElement();
 //    }
 //}
 private void WriteLineSymbol(LineSymbol lineSymbol)
 {
     if (lineSymbol is ESRI.ArcGIS.Client.FeatureService.Symbols.SimpleLineSymbol)
     {
         StartType(lineSymbol, Constants.esriFSSymbolsPrefix);
         WriteJsonAttribute(lineSymbol as IJsonSerializable);
     }
     else
     {
         StartType(lineSymbol, Constants.esriPrefix);
         if (lineSymbol.Width != 1.0)
             WriteAttribute("Width", lineSymbol.Width);
         if (lineSymbol is SimpleLineSymbol)
         {
             SimpleLineSymbol sls = lineSymbol as SimpleLineSymbol;
             if (sls.Style != SimpleLineSymbol.LineStyle.Solid)
                 WriteAttribute("Style", (lineSymbol as SimpleLineSymbol).Style.ToString());
         }
         //else if (lineSymbol is ESRI.ArcGIS.Client.FeatureService.Symbols.SimpleLineSymbol)
         //{
         //    ESRI.ArcGIS.Client.FeatureService.Symbols.SimpleLineSymbol slsfs = lineSymbol as ESRI.ArcGIS.Client.FeatureService.Symbols.SimpleLineSymbol;
         //    WriteAttribute("Style", slsfs.Style.ToString());
         //    if (slsfs.SelectionColor != null)
         //    {
         //        writer.WriteStartElement("SimpleLineSymbol.SelectionColor", Namespaces[Constants.esriFSSymbolsPrefix]);
         //        new BrushXamlWriter(writer, Namespaces).WriteBrush(slsfs.SelectionColor);
         //        writer.WriteEndElement();
         //    }
         //}
         SolidColorBrush sb = lineSymbol.Color as SolidColorBrush;
         if (sb != null)
         {
             WriteAttribute("Color", sb.Color);
         }
         else
         {
             writer.WriteStartElement(lineSymbol.GetType().Name + ".Color", Namespaces[Constants.esriPrefix]);
             new BrushXamlWriter(writer, Namespaces).WriteBrush(lineSymbol.Color);
             writer.WriteEndElement();
         }
     }
     writer.WriteEndElement();
 }
Example #37
0
 public LineElement(LineSymbol symbol, IMultiLineString line)
     : this(symbol, Polyline.FromCommon(line))
 {
 }
Example #38
0
 public LineElement(LineSymbol symbol, Polyline line)
 {
     Symbol = symbol;
     Line   = line;
 }
Example #39
0
        public void Init(GroupLayer gl, MapPoint start, MapPoint finish, ResourceDictionary rd)
        {
            startPoint = new csPoint
            {
                Mp = start
            };
            finishPoint = new csPoint
            {
                Mp = finish
            };
            MLayer = new GraphicsLayer
            {
                ID = Guid.NewGuid().ToString()
            };
            _start = new Graphic();
            _finish = new Graphic();
            Line = new Graphic();

            var ls = new LineSymbol
            {
                Color = Brushes.Black,
                Width = 4
            };
            Line.Symbol = ls;
            UpdateLine();

            MLayer.Graphics.Add(Line);

            _start.Geometry = start;
            _start.Symbol = rd["Start"] as Symbol;
            _start.Attributes["position"] = start;
            _start.Attributes["finish"] = _finish;
            _start.Attributes["start"] = _start;
            _start.Attributes["line"] = Line;
            _start.Attributes["state"] = "start";
            _start.Attributes["measure"] = this;
            _start.Attributes["menuenabled"] = true;
            MLayer.Graphics.Add(_start);

            _finish.Geometry = finish;
            _finish.Attributes["position"] = finish;
            _finish.Symbol = rd["Finish"] as Symbol;
            _finish.Attributes["finish"] = _finish;
            _finish.Attributes["start"] = _start;
            _finish.Attributes["line"] = Line;
            _finish.Attributes["measure"] = this;
            _finish.Attributes["state"] = "finish";
            _finish.Attributes["menuenabled"] = true;
            MLayer.Graphics.Add(_finish);

            Layer.ChildLayers.Add(MLayer);
            MLayer.Initialize();

            AppStateSettings.Instance.ViewDef.MapManipulationDelta += ViewDef_MapManipulationDelta;

            if (AppState.Imb != null && AppState.Imb.Imb != null)
            {
                _3d = AppState.Imb.Imb.Publish(AppState.Imb.Imb.ClientHandle + ".3d");
                //AppState.Imb.Imb.Publish(_channel);
            }

            _updateTimer.Interval = 50;
            _updateTimer.Elapsed += UpdateTimerElapsed;
            _updateTimer.Start();
        }
        private static geStyle ConvertToLineStyle(LineSymbol lineSym)
        {
            geLineStyle lineStyle;
              geStyle style;
              string hashId;

              hashId = lineSym.GetHashCode().ToString();
              style = new geStyle(hashId);

              lineStyle = new geLineStyle();
              geColor color = new geColor();
              color.SysColor = ((SolidColorBrush)lineSym.Color).Color;
              lineStyle.Color = color;
              lineStyle.Width = (float)lineSym.Width;

              style.LineStyle = lineStyle;

              return style;
        }
Example #41
0
        private static LineSymbol cloneLineSymbol(LineSymbol lineSymbol)
        {
            if (lineSymbol == null)
            {
                return(null);
            }

            ESRI.ArcGIS.Mapping.Core.Symbols.SimpleLineSymbol mappingSimpleLineSymbol = lineSymbol as ESRI.ArcGIS.Mapping.Core.Symbols.SimpleLineSymbol;
            if (mappingSimpleLineSymbol != null)
            {
                ESRI.ArcGIS.Mapping.Core.Symbols.SimpleLineSymbol ls = new ESRI.ArcGIS.Mapping.Core.Symbols.SimpleLineSymbol()
                {
                    Color           = CloneBrush(mappingSimpleLineSymbol.Color),
                    ControlTemplate = mappingSimpleLineSymbol.ControlTemplate,
                    SelectionColor  = CloneBrush(mappingSimpleLineSymbol.SelectionColor),
                    Width           = mappingSimpleLineSymbol.Width,
                };
                return(ls);
            }

            SimpleLineSymbol simpleLineSymbol = lineSymbol as SimpleLineSymbol;

            if (simpleLineSymbol != null)
            {
                SimpleLineSymbol ls = new SimpleLineSymbol()
                {
                    Color           = CloneBrush(simpleLineSymbol.Color),
                    ControlTemplate = simpleLineSymbol.ControlTemplate,
                    Style           = simpleLineSymbol.Style,
                    Width           = simpleLineSymbol.Width,
                };
                return(ls);
            }

            CartographicLineSymbol cLineSymbol = lineSymbol as CartographicLineSymbol;

            if (cLineSymbol != null)
            {
                CartographicLineSymbol cs = new CartographicLineSymbol()
                {
                    Color           = CloneBrush(cLineSymbol.Color),
                    ControlTemplate = cLineSymbol.ControlTemplate,
                    DashArray       = cLineSymbol.DashArray,
                    DashCap         = cLineSymbol.DashCap,
                    DashOffset      = cLineSymbol.DashOffset,
                    EndLineCap      = cLineSymbol.EndLineCap,
                    LineJoin        = cLineSymbol.LineJoin,
                    MiterLimit      = cLineSymbol.MiterLimit,
                    StartLineCap    = cLineSymbol.StartLineCap,
                    Width           = cLineSymbol.Width,
                };
                return(cs);
            }

            LineSymbol l = new LineSymbol()
            {
                Color           = CloneBrush(lineSymbol.Color),
                ControlTemplate = lineSymbol.ControlTemplate,
                Width           = lineSymbol.Width,
            };

            return(l);
        }
Example #42
0
        protected override void AddToMap(Map map, SymDef symdef)
        {
            SymPath[] gappedPaths = LegGap.SplitPathWithGaps(path, gaps);

            foreach (SymPath p in gappedPaths) {
                LineSymbol sym = new LineSymbol((LineSymDef) symdef, p);
                map.AddSymbol(sym);
            }
        }
Example #43
0
        public void Init(GroupLayer gl, MapPoint start, MapPoint finish, ResourceDictionary rd)
        {
            remoteClient.ComputeFieldOfViewAsImageCompleted += ClientOnComputeFieldOfViewCompleted;
            localClient .ComputeFieldOfViewAsImageCompleted += ClientOnComputeFieldOfViewCompleted;

            StartPoint = new csPoint
            {
                Mp = start
            };
            FinishPoint = new csPoint
            {
                Mp = finish
            };
            MLayer = new GraphicsLayer
            {
                ID = Guid.NewGuid().ToString()
            };

            ImageLayer = new ElementLayer();
            Image = new System.Windows.Controls.Image
            {
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment = VerticalAlignment.Stretch,
                Stretch = Stretch.Fill,
                StretchDirection = StretchDirection.Both
            };
            ElementLayer.SetEnvelope(Image, AppState.ViewDef.MapControl.Extent);
            ImageLayer.Children.Add(Image);

            Start = new Graphic();
            Finish = new Graphic();
            Line = new Graphic();

            var ls = new LineSymbol
            {
                Color = Brushes.Black,
                Width = 4
            };
            Line.Symbol = ls;
            UpdateLine();

            MLayer.Graphics.Add(Line);

            Start.Geometry = start;
            Start.Symbol = rd["Start"] as Symbol;
            Start.Attributes["position"] = start;
            Start.Attributes["finish"] = Finish;
            Start.Attributes["start"] = Start;
            Start.Attributes["line"] = Line;
            Start.Attributes["state"] = "start";
            Start.Attributes["measure"] = this;
            Start.Attributes["menuenabled"] = true;
            MLayer.Graphics.Add(Start);

            Finish.Geometry = finish;
            Finish.Attributes["position"] = finish;
            Finish.Symbol = rd["Finish"] as Symbol;
            Finish.Attributes["finish"] = Finish;
            Finish.Attributes["start"] = Start;
            Finish.Attributes["line"] = Line;
            Finish.Attributes["measure"] = this;
            Finish.Attributes["state"] = "finish";
            Finish.Attributes["menuenabled"] = true;
            MLayer.Graphics.Add(Finish);
            Layer.ChildLayers.Add(ImageLayer);
            Layer.ChildLayers.Add(MLayer);
            MLayer.Initialize();

            AppStateSettings.Instance.ViewDef.MapManipulationDelta += ViewDef_MapManipulationDelta;

            if (AppState.Imb != null && AppState.Imb.Imb != null)
            {
                _3D = AppState.Imb.Imb.Publish(AppState.Imb.Imb.ClientHandle + ".3d");
                //AppState.Imb.Imb.Publish(_channel);
            }

            updateTimer.Interval = 50;
            updateTimer.Elapsed += UpdateTimerElapsed;
            updateTimer.Start();
        }
Example #44
0
        /// <summary>
        /// Required method for ArcGIS Component Category unregistration -
        /// Do not modify the contents of this method with the code editor.
        /// </summary>
        private static void ArcGISCategoryUnregistration(Type registerType)
        {
            string str = string.Format("HKEY_CLASSES_ROOT\\CLSID\\{{{0}}}", registerType.GUID);

            LineSymbol.Unregister(str);
        }
        private bool Init()
        {
            if (!InitUI())
            return false;

              if (!CreateGraphicsLayer())
            return false;

              // create the symbols
              _lineSymbol = new SimpleLineSymbol(System.Windows.Media.Colors.Red, 4) as LineSymbol;
              _fillSymbol = new SimpleFillSymbol()
              {
            //Fill = Brushes.Yellow,
            Fill = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromArgb(100, 255, 255, 0)),
            BorderBrush = System.Windows.Media.Brushes.Green,
            BorderThickness = 1
              } as FillSymbol;

              _saFillSymbol = new SimpleFillSymbol()
              {
            //Fill = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromArgb(100, 90, 90, 90)),  // gray
            Fill = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromArgb(100, 255, 255, 0)),
            //BorderBrush = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Transparent),
            BorderBrush = System.Windows.Media.Brushes.Green,
            BorderThickness = 1
              };

              _saLineSymbol = new SimpleLineSymbol()
              {
            Color = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromArgb(100, (byte)_random.Next(0, 255), (byte)_random.Next(0, 255), (byte)_random.Next(0, 255))),
            Width = 1,
              };

              // create the Geometry Service
              _geometryService = new GeometryService(_vm.GetPropValue("GeometryServiceUrl"));
              _geometryService.BufferCompleted += GeometryService_BufferCompleted;
              _geometryService.Failed += GeometryService_Failed;

              // create the route task
              _facilitiesGraphicsLayer = new GraphicsLayer();
              _barriersGraphicsLayer = new GraphicsLayer();
              _pointBarriers = new List<Graphic>();
              _polylineBarriers = new List<Graphic>();
              _polygonBarriers = new List<Graphic>();
              string serviceAreaURL = _vm.GetPropValue("ServiceAreaServiceUrl");
              _routeTask = new RouteTask(serviceAreaURL);
              _routeTask.SolveServiceAreaCompleted += SolveServiceArea_Completed;
              _routeTask.Failed += SolveServiceArea_Failed;

              return true;
        }
Example #46
0
        protected override void AddToMap(Map map, SymDef symdef)
        {
            SymPath symPath = CreateSymPath();

            LineSymbol sym = new LineSymbol((LineSymDef)symdef, symPath);
            map.AddSymbol(sym);
        }