Example #1
1
        /// <summary>
        /// �޸Ļ�վ��Ϣ����ͼ��Դ�ļ�
        /// </summary>
        /// <param name="f"></param>
        /// <param name="pointCode"></param>
        /// <param name="iType"></param>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <param name="pointname"></param>
        private void ModifyPoint(Feature f, string pointCode, int iType, double x, double y, string pointname, bool IsBusy)
        {
            MapInfo.Geometry.Point g = new MapInfo.Geometry.Point(GetCoordSys(), x, y);
            SimpleVectorPointStyle vs = null;
            MapInfo.Data.Table table = MapInfo.Engine.Session.Current.Catalog.GetTable(strTempMapPointTable);
            //vs = new SimpleVectorPointStyle(34, System.Drawing.Color.Red, 12);

            //��ȡ��վ��ʾЧ��
            vs = GetSimpleVectorPointStyleByiType(iType);

            SimpleLineStyle ls = new SimpleLineStyle(new LineWidth(1, LineWidthUnit.Pixel), 1, System.Drawing.Color.Red);
            SimpleInterior si = new SimpleInterior(1, System.Drawing.Color.Red, System.Drawing.Color.Red);
            AreaStyle a = new AreaStyle(ls, si);
            CompositeStyle cs = new CompositeStyle(a, null, null, vs);
            cs = GetCompositeStyleByIsBusy(IsBusy, iType);

            //Columns cols = new Columns();
            //cols.Add(MapInfo.Data.ColumnFactory.CreateStringColumn("Caption", 50));
            //Feature f = new Feature(g, cs, cols);

            f["Obj"] = g;
            f["MI_Style"] = cs;
            f["ID"] = pointCode;
            f["Caption"] = pointname;
            table.UpdateFeature(f);

            MapInfo.Data.TableInfo tableInfo = table.TableInfo;
            tableInfo.WriteTabFile(); //����Ϊ.tab�ļ�
        }
        private void cmbRestrictionStyle_SelectedIndexChanged(object sender, SelectionChangedEventArgs e)
        {
            if (wpfMap1.Overlays.Count > 0)
            {
                LayerOverlay dynamicOverlay = (LayerOverlay)wpfMap1.Overlays[1];
                RestrictionLayer currentRestrictionLayer = (RestrictionLayer)dynamicOverlay.Layers["RestrictionLayer"];
                if (currentRestrictionLayer.CustomStyles.Count > 0)
                {
                    currentRestrictionLayer.CustomStyles.Clear();
                }

                switch (cmbRestrictionStyle.SelectedItem.ToString().Split(':')[1].Trim())
                {
                    case "HatchPattern":
                        currentRestrictionLayer.RestrictionStyle = RestrictionStyle.HatchPattern;
                        break;
                    case "CircleWithSlashImage":
                        currentRestrictionLayer.RestrictionStyle = RestrictionStyle.CircleWithSlashImage;
                        break;
                    case "UseCustomStyles":
                        currentRestrictionLayer.RestrictionStyle = RestrictionStyle.UseCustomStyles;
                        AreaStyle customStyle = new AreaStyle(new GeoSolidBrush(new GeoColor(150, GeoColor.StandardColors.Gray)));
                        currentRestrictionLayer.CustomStyles.Add(customStyle);
                        break;
                    default:
                        break;
                }

                wpfMap1.Overlays["RestrictionOverlay"].Refresh();
            }
        }
        public RadiusMearsureTrackInteractiveOverlay(DistanceUnit distanceUnit, GeographyUnit mapUnit)
        {
            DistanceUnit = distanceUnit;
            MapUnit = mapUnit;

            textBlock = new TextBlock();
            textBlock.Visibility = Visibility.Collapsed;
            OverlayCanvas.Children.Add(textBlock);

            PolygonTrackMode = PolygonTrackMode.LineWithFill;
            RenderMode = RenderMode.DrawingVisual;

            areaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(80, GeoColor.SimpleColors.LightGreen), GeoColor.SimpleColors.White, 2);
            pointStyle = PointStyles.CreateSimpleCircleStyle(GeoColor.SimpleColors.DarkBlue, 8);
            lineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.SimpleColors.White, 3, true);

            SetStylesForInMemoryFeatureLayer(TrackShapeLayer);
            SetStylesForInMemoryFeatureLayer(TrackShapesInProcessLayer);
        }
        private void AddValueCircleLegendItems(LegendAdornmentLayer legendAdornmentLayer)
        {
            ValueCircleStyle valueCircleStyle = (ValueCircleStyle)CurrentStyleBuilder.GetStyles(mapModel.DefaultFeatureLayer.FeatureSource)[0];

            // Here we generate 4 legend items, with the area of 160, 320, 640 and 1280 square pixels seperately.
            int[] circleAreas = new int[] { 160, 320, 640, 1280 };
            foreach (int circleArea in circleAreas)
            {
                LegendItem legendItem = new LegendItem();
                double radius = Math.Sqrt(circleArea / Math.PI);
                legendItem.ImageStyle = new PointStyle(PointSymbolType.Circle, new GeoSolidBrush(valueCircleStyle.InnerColor), new GeoPen(new GeoSolidBrush(valueCircleStyle.OuterColor)), (int)(radius * 2));
                AreaStyle maskStyle = new AreaStyle(new GeoPen(GeoColor.StandardColors.LightGray, 1), new GeoSolidBrush(GeoColor.SimpleColors.Transparent));
                legendItem.ImageMask = maskStyle;
                legendItem.ImageWidth = 48;
                legendItem.TextTopPadding = 16;
                legendItem.TextRightPadding = 5;
                legendItem.BottomPadding = 16;
                legendItem.TopPadding = 16;
                legendItem.RightPadding = 5;

                double drawingRadius = circleArea / valueCircleStyle.DrawingRadiusRatio * valueCircleStyle.BasedScale / valueCircleStyle.DefaultZoomLevel.Scale;
                double ratio = (valueCircleStyle.MaxValidValue - valueCircleStyle.MinValidValue) / (valueCircleStyle.MaxCircleAreaInDefaultZoomLevel - valueCircleStyle.MinCircleAreaInDefaultZoomLevel);
                double resultValue = (drawingRadius - valueCircleStyle.MinCircleAreaInDefaultZoomLevel) * ratio + valueCircleStyle.MinValidValue;

                string text = TextFormatter.GetFormatedStringForLegendItem(valueCircleStyle.ColumnName, resultValue);
                legendItem.TextStyle = new TextStyle(text, new GeoFont("Segoe UI", 10), new GeoSolidBrush(GeoColor.SimpleColors.Black));

                legendAdornmentLayer.LegendItems.Add(legendItem);
            }
        }
Example #5
0
        // add geometry to temp layer with hollow style
        private void ShowSearchGeometry(FeatureGeometry g, bool clear)
        {
            if (clear)
            {
                // first clear out any other geometries from table
                (_tempTable as IFeatureCollection).Clear();
            }

            Style s=null;
            if (g is IGenericSurface) // closed geometry, use area style
            {
                s  = new AreaStyle(new SimpleLineStyle(new LineWidth(2, LineWidthUnit.Pixel), 2, Color.Red, false), new SimpleInterior(0));
            }
            else if (g is MapInfo.Geometry.Point)
            {
                s = new SimpleVectorPointStyle(34, Color.Red, 18);
            }
            Feature f = new Feature(g, s);

            // Add feature to temp table
            _tempTable.InsertFeature(f);
        }