Beispiel #1
0
        /// <summary>
        /// Create a CIMPointGaphic which can be added to the MapView overlay.
        /// </summary>
        /// <param name="point">The location for the point (as a CIM point)</param>
        /// <returns></returns>
        public CIMPointGraphic MakeCIMPointGraphic(PointN point)
        {
            CIMMarker marker = SymbolFactory.Instance.ConstructMarker(Red, 10, SimpleMarkerStyle.Star);

            CIMSymbolLayer[] layers = new CIMSymbolLayer[1];
            layers[0] = marker;

            CIMPointSymbol pointSymbol = new CIMPointSymbol()
            {
                SymbolLayers = layers,
                ScaleX       = 1
            };
            CIMSymbolReference symbolRef = new CIMSymbolReference()
            {
                Symbol = pointSymbol
            };
            CIMPointGraphic pointGraphic = new CIMPointGraphic();

            ArcGIS.Core.Geometry.SpatialReference spatialRef = SpatialReferenceBuilder.CreateSpatialReference(point.SpatialReference.WKID);
            MapPoint mapPoint = MapPointBuilder.CreateMapPoint(point.X, point.Y, spatialRef);

            pointGraphic.Location = mapPoint;
            pointGraphic.Symbol   = symbolRef;

            return(pointGraphic);
        }
Beispiel #2
0
        /// <summary>
        /// Create a CIMPointGaphic which can be added to the MapView overlay.
        /// </summary>
        /// <param name="point">The location for the point (as a CIM point)</param>
        /// <returns></returns>
        public CIMPointGraphic MakeCIMPointGraphic(PointN point)
        {
            ////CIMMarker marker = SymbolHelper.ConstructMarker(Red, 10, SimpleMarkerStyle.Circle);

            CIMMarker marker = SymbolHelper.ConstructMarker(Red, 10, SimpleMarkerStyle.Star);

            CIMSymbolLayer[] layers = new CIMSymbolLayer[1];
            layers[0] = marker;

            CIMPointSymbol pointSymbol = new CIMPointSymbol();

            pointSymbol.SymbolLayers = layers;
            pointSymbol.ScaleX       = 1;

            CIMSymbolReference symbolRef = new CIMSymbolReference();

            symbolRef.Symbol = pointSymbol;

            CIMPointGraphic pointGraphic = new CIMPointGraphic();

            pointGraphic.Location = point;
            pointGraphic.Symbol   = symbolRef;

            return(pointGraphic);
        }
Beispiel #3
0
        public static CIMPointSymbol CreatePointSymbol(CIMMarker marker)
        {
            var symbol = new CIMPointSymbol();

            symbol.ScaleX       = 1.0;
            symbol.HaloSize     = 1.0;
            symbol.SymbolLayers = new CIMSymbolLayer[] { marker };
            return(symbol);
        }
        public async Task ConstructPointSymbol_4()
        {
            #region How to construct a point symbol from a file on disk

            //The following file formats can be used to create the marker: DAE, 3DS, FLT, EMF, JPG, PNG, BMP, GIF
            CIMMarker markerFromFile = await QueuedTask.Run(() => SymbolFactory.Instance.ConstructMarkerFromFile(@"C:\Temp\fileName.dae"));

            CIMPointSymbol pointSymbolFromFile = SymbolFactory.Instance.ConstructPointSymbol(markerFromFile);

            #endregion
        }
        public async Task ConstructPointSymbol_3()
        {
            #region How to construct a point symbol from a marker

            await QueuedTask.Run(() =>
            {
                CIMMarker marker = SymbolFactory.Instance.ConstructMarker(ColorFactory.Instance.GreenRGB, 8.0, SimpleMarkerStyle.Pushpin);
                CIMPointSymbol pointSymbolFromMarker = SymbolFactory.Instance.ConstructPointSymbol(marker);
            });

            #endregion
        }
 public void ConstructPointSymbolFromMarkerStream()
 {
     #region How to construct a point symbol from a in memory graphic
     //Create a stream for the image
     Image newImage = Image.FromFile(@"C:\PathToImage\Image.png");
     var   stream   = new System.IO.MemoryStream();
     newImage.Save(stream, ImageFormat.Png);
     stream.Position = 0;
     //Create marker using the stream
     CIMMarker markerFromStream = SymbolFactory.Instance.ConstructMarkerFromStream(stream);
     //Create the point symbol from the marker
     CIMPointSymbol pointSymbolFromStream = SymbolFactory.Instance.ConstructPointSymbol(markerFromStream);
     #endregion
 }
Beispiel #7
0
        public static void SetShipAngle()
        {
            var task = QueuedTask.Run(() =>
            {
                //Create a list of the above two CIMUniqueValueClasses
                List <CIMUniqueValueClass> listUniqueValueClasses = new List <CIMUniqueValueClass>();
                for (int i = 0; i < 360; i++)
                {
                    List <CIMUniqueValue> listUniqueValues = new List <CIMUniqueValue>();
                    CIMUniqueValue cuv = new CIMUniqueValue {
                        FieldValues = new string[] { i.ToString() }
                    };
                    //CIMMarker cm = SymbolFactory.Instance.ConstructMarker(ColorFactory.Instance.BlackRGB, GetShipSymbolSize(5,8,i), SetShipRotate(i));
                    CIMMarker cm = SymbolFactory.Instance.ConstructMarker(ColorFactory.Instance.BlackRGB, GetShipSymbolSize2(10, i), SetShipRotate(i));
                    listUniqueValues.Add(cuv);
                    CIMUniqueValueClass UniqueValueClass = new CIMUniqueValueClass
                    {
                        Editable = true,
                        Patch    = PatchShape.Default,
                        Symbol   = SymbolFactory.Instance.ConstructPointSymbol(cm).MakeSymbolReference(),
                        Visible  = true,
                        Values   = listUniqueValues.ToArray()
                    };
                    listUniqueValueClasses.Add(UniqueValueClass);
                }

                //Create a list of CIMUniqueValueGroup
                CIMUniqueValueGroup uvg = new CIMUniqueValueGroup
                {
                    Classes = listUniqueValueClasses.ToArray(),
                };
                List <CIMUniqueValueGroup> listUniqueValueGroups = new List <CIMUniqueValueGroup> {
                    uvg
                };
                CIMMarker cm1 = SymbolFactory.Instance.ConstructMarker(ColorFactory.Instance.BlackRGB, 8, SetShipRotate(0));
                //Create the CIMUniqueValueRenderer
                CIMUniqueValueRenderer uvr = new CIMUniqueValueRenderer
                {
                    UseDefaultSymbol = true,
                    DefaultSymbol    = SymbolFactory.Instance.ConstructPointSymbol(cm1).MakeSymbolReference(),
                    Groups           = listUniqueValueGroups.ToArray(),
                    Fields           = new string[] { ConstDefintion.ConstFieldName_cog }
                };
                //Set the feature layer's renderer.
                FeatureLayer featureLayer = MapView.Active.Map.GetLayersAsFlattenedList().First() as FeatureLayer;
                featureLayer.SetRenderer(uvr);
            });
        }
Beispiel #8
0
        public async Task UpdateAsync(double x, double y, double size)
        {
            Settings           settings = Settings.Instance;
            MySpatialReference spatRel  = settings.CycloramaViewerCoordinateSystem;

            await QueuedTask.Run(() =>
            {
                MapView thisView = MapView.Active;
                Map map          = thisView?.Map;
                SpatialReference mapSpatialReference = map?.SpatialReference;
                SpatialReference spatialReference    = spatRel?.ArcGisSpatialReference ?? mapSpatialReference;
                MapPoint point = MapPointBuilder.CreateMapPoint(x, y, spatialReference);
                MapPoint mapPoint;

                if (mapSpatialReference != null && spatialReference.Wkid != mapSpatialReference.Wkid)
                {
                    ProjectionTransformation projection = ProjectionTransformation.Create(spatialReference, mapSpatialReference);
                    mapPoint = GeometryEngine.Instance.ProjectEx(point, projection) as MapPoint;
                }
                else
                {
                    mapPoint = (MapPoint)point.Clone();
                }

                if (mapPoint != null && !mapPoint.IsEmpty)
                {
                    CIMColor cimColor          = ColorFactory.Instance.CreateColor(Color.Black);
                    CIMMarker cimMarker        = SymbolFactory.Instance.ConstructMarker(cimColor, size, SimpleMarkerStyle.Cross);
                    CIMPointSymbol pointSymbol = SymbolFactory.Instance.ConstructPointSymbol(cimMarker);
                    CIMSymbolReference pointSymbolReference = pointSymbol.MakeSymbolReference();
                    IDisposable disposeCross = thisView.AddOverlay(mapPoint, pointSymbolReference);

                    _disposeCross?.Dispose();
                    _disposeCross = disposeCross;
                }
            });
        }
Beispiel #9
0
 public static CIMPointSymbol MakePointSymbol(this CIMMarker marker)
 {
     return(CreatePointSymbol(marker));
 }