/// <summary>
	  /// Executes the chart demo.
	  /// </summary>
	  /// <param name="context"> the context </param>
	  /// <returns> the built intent </returns>
	  public override Intent execute(Context context)
	  {
		string[] titles = new string[] {"Crete", "Corfu", "Thassos", "Skiathos"};
		IList<double[]> x = new List<double[]>();
		for (int i = 0; i < titles.Length; i++)
		{
		  x.Add(new double[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12});
		}
		IList<double[]> values = new List<double[]>();
		values.Add(new double[] {12.3, 12.5, 13.8, 16.8, 20.4, 24.4, 26.4, 26.1, 23.6, 20.3, 17.2, 13.9});
		values.Add(new double[] {10, 10, 12, 15, 20, 24, 26, 26, 23, 18, 14, 11});
		values.Add(new double[] {5, 5.3, 8, 12, 17, 22, 24.2, 24, 19, 15, 9, 6});
		values.Add(new double[] {9, 10, 11, 15, 19, 23, 26, 25, 22, 18, 13, 10});
		int[] colors = new int[] {Color.BLUE, Color.GREEN, Color.CYAN, Color.YELLOW};
		PointStyle[] styles = new PointStyle[] {PointStyle.CIRCLE, PointStyle.DIAMOND, PointStyle.TRIANGLE, PointStyle.SQUARE};
		XYMultipleSeriesRenderer renderer = buildRenderer(colors, styles);
		int length = renderer.SeriesRendererCount;
		for (int i = 0; i < length; i++)
		{
		  ((XYSeriesRenderer) renderer.getSeriesRendererAt(i)).FillPoints = true;
		}
		setChartSettings(renderer, "Average temperature", "Month", "Temperature", 0.5, 12.5, 0, 32, Color.LTGRAY, Color.LTGRAY);
		renderer.XLabels = 12;
		renderer.YLabels = 10;
		renderer.ShowGrid = true;
		renderer.XLabelsAlign = Align.RIGHT;
		renderer.YLabelsAlign = Align.RIGHT;
		renderer.ZoomButtonsVisible = true;
		renderer.PanLimits = new double[] {-10, 20, -10, 40};
		renderer.ZoomLimits = new double[] {-10, 20, -10, 40};
		Intent intent = ChartFactory.getCubicLineChartIntent(context, buildDataset(titles, x, values), renderer, 0.33f, "Average temperature");
		return intent;
	  }
	  /// <summary>
	  /// Executes the chart demo. </summary>
	  /// <param name="context"> the context </param>
	  /// <returns> the built intent </returns>
	  public override Intent execute(Context context)
	  {
		string[] titles = new string[] {"sin", "cos"};
		IList<double[]> x = new List<double[]>();
		IList<double[]> values = new List<double[]>();
		int step = 4;
		int count = 360 / step + 1;
		x.Add(new double[count]);
		x.Add(new double[count]);
		double[] sinValues = new double[count];
		double[] cosValues = new double[count];
		values.Add(sinValues);
		values.Add(cosValues);
		for (int i = 0; i < count; i++)
		{
		  int angle = i * step;
		  x[0][i] = angle;
		  x[1][i] = angle;
		  double rAngle = Math.toRadians(angle);
		  sinValues[i] = Math.Sin(rAngle);
		  cosValues[i] = Math.Cos(rAngle);
		}
		int[] colors = new int[] {Color.BLUE, Color.CYAN};
		PointStyle[] styles = new PointStyle[] {PointStyle.POINT, PointStyle.POINT};
		XYMultipleSeriesRenderer renderer = buildRenderer(colors, styles);
		setChartSettings(renderer, "Trigonometric functions", "X (in degrees)", "Y", 0, 360, -1, 1, Color.GRAY, Color.LTGRAY);
		renderer.XLabels = 20;
		renderer.YLabels = 10;
		return ChartFactory.getLineChartIntent(context, buildDataset(titles, x, values), renderer);
	  }
	  /// <summary>
	  /// Executes the chart demo.
	  /// </summary>
	  /// <param name="context"> the context </param>
	  /// <returns> the built intent </returns>
	  public override Intent execute(Context context)
	  {
		string[] titles = new string[] {"Series 1", "Series 2", "Series 3", "Series 4", "Series 5"};
		IList<double[]> x = new List<double[]>();
		IList<double[]> values = new List<double[]>();
		int count = 20;
		int length = titles.Length;
		Random r = new Random();
		for (int i = 0; i < length; i++)
		{
		  double[] xValues = new double[count];
		  double[] yValues = new double[count];
		  for (int k = 0; k < count; k++)
		  {
			xValues[k] = k + r.Next() % 10;
			yValues[k] = k * 2 + r.Next() % 10;
		  }
		  x.Add(xValues);
		  values.Add(yValues);
		}
		int[] colors = new int[] {Color.BLUE, Color.CYAN, Color.MAGENTA, Color.LTGRAY, Color.GREEN};
		PointStyle[] styles = new PointStyle[] {PointStyle.X, PointStyle.DIAMOND, PointStyle.TRIANGLE, PointStyle.SQUARE, PointStyle.CIRCLE};
		XYMultipleSeriesRenderer renderer = buildRenderer(colors, styles);
		setChartSettings(renderer, "Scatter chart", "X", "Y", -10, 30, -10, 51, Color.GRAY, Color.LTGRAY);
		renderer.XLabels = 10;
		renderer.YLabels = 10;
		length = renderer.SeriesRendererCount;
		for (int i = 0; i < length; i++)
		{
		  ((XYSeriesRenderer) renderer.getSeriesRendererAt(i)).FillPoints = true;
		}
		return ChartFactory.getScatterChartIntent(context, buildDataset(titles, x, values), renderer);
	  }
 public CustomStartEndLineStyle(string startFontName, int startCharacterIndex, Color startColor, float startSize,
                                string endFontName, int endCharacterIndex, Color endColor, float endSize,
                                Color lineColor, float lineSize)
 {
     var startFont = new GeoFont(startFontName, startSize);
     var endFont = new GeoFont(endFontName, endSize);
     _startPointStyle = new PointStyle(startFont, startCharacterIndex, new GeoSolidBrush(GeoColor.FromArgb(startColor.A, startColor.R, startColor.G, startColor.B)));
     _endPointStyle = new PointStyle(endFont, endCharacterIndex, new GeoSolidBrush(GeoColor.FromArgb(endColor.A, endColor.R, endColor.G, endColor.B)));
     _lineStyle = new LineStyle(new GeoPen(GeoColor.FromArgb(lineColor.A, lineColor.R, lineColor.G, lineColor.B), lineSize));
 }
 public void Add(OverlayShape overlayShape)
 {
     if (CustomLineStyle == null)
     {
         if (LineStyle == null)
         {
             LineColor = overlayShape.Color;
             LineWidth = overlayShape.Width;
         }
         if (PointStyle == null)
             PointStyle = new PointStyle(PointSymbolType.Circle, new GeoSolidBrush(GeoColor.FromArgb(LineColor.A, LineColor.R, LineColor.G, LineColor.B)), (int)LineWidth);
     }
     var wellKnownText = overlayShape.WellKnownText;
     if (wellKnownText != null) _layer.InternalFeatures.Add(new Feature(BaseShape.CreateShapeFromWellKnownData(overlayShape.WellKnownText)));
 }
	  /// <summary>
	  /// Executes the chart demo.
	  /// </summary>
	  /// <param name="context"> the context </param>
	  /// <returns> the built intent </returns>
	  public override Intent execute(Context context)
	  {
		string[] titles = new string[] {"Air temperature"};
		IList<double[]> x = new List<double[]>();
		for (int i = 0; i < titles.Length; i++)
		{
		  x.Add(new double[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12});
		}
		IList<double[]> values = new List<double[]>();
		values.Add(new double[] {12.3, 12.5, 13.8, 16.8, 20.4, 24.4, 26.4, 26.1, 23.6, 20.3, 17.2, 13.9});
		int[] colors = new int[] {Color.BLUE, Color.YELLOW};
		PointStyle[] styles = new PointStyle[] {PointStyle.POINT, PointStyle.POINT};
		XYMultipleSeriesRenderer renderer = new XYMultipleSeriesRenderer(2);
		setRenderer(renderer, colors, styles);
		int length = renderer.SeriesRendererCount;
		for (int i = 0; i < length; i++)
		{
		  XYSeriesRenderer r = (XYSeriesRenderer) renderer.getSeriesRendererAt(i);
		  r.LineWidth = 3f;
		}
		setChartSettings(renderer, "Average temperature", "Month", "Temperature", 0.5, 12.5, 0, 32, Color.LTGRAY, Color.LTGRAY);
		renderer.XLabels = 12;
		renderer.YLabels = 10;
		renderer.ShowGrid = true;
		renderer.XLabelsAlign = Align.RIGHT;
		renderer.YLabelsAlign = Align.RIGHT;
		renderer.ZoomButtonsVisible = true;
		renderer.PanLimits = new double[] {-10, 20, -10, 40};
		renderer.ZoomLimits = new double[] {-10, 20, -10, 40};
		renderer.ZoomRate = 1.05f;
		renderer.LabelsColor = Color.WHITE;
		renderer.XLabelsColor = Color.GREEN;
		renderer.setYLabelsColor(0, colors[0]);
		renderer.setYLabelsColor(1, colors[1]);

		renderer.setYTitle("Hours", 1);
		renderer.setYAxisAlign(Align.RIGHT, 1);
		renderer.setYLabelsAlign(Align.LEFT, 1);

		XYMultipleSeriesDataset dataset = buildDataset(titles, x, values);
		values.Clear();
		values.Add(new double[] {4.3, 4.9, 5.9, 8.8, 10.8, 11.9, 13.6, 12.8, 11.4, 9.5, 7.5, 5.5});
		addXYSeries(dataset, new string[] {"Sunshine hours"}, x, values, 1);

		Intent intent = ChartFactory.getCubicLineChartIntent(context, dataset, renderer, 0.3f, "Average temperature");
		return intent;
	  }
        public static void QueryFeatures(this MapView map, CartoSQLService service, LocalVectorDataSource source, PointStyle style, string query)
        {
            System.Threading.Tasks.Task.Run(delegate
            {
                FeatureCollection features = service.QueryFeatures(query, map.Options.BaseProjection);

                for (int i = 0; i < features.FeatureCount; i++)
                {
                    Feature feature = features.GetFeature(i);

                    PointGeometry geometry = (PointGeometry)feature.Geometry;

                    var point = new Point(geometry, style);
                    source.Add(point);
                }

            });
        }
        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);
        }
	  /// <summary>
	  /// Executes the chart demo.
	  /// </summary>
	  /// <param name="context"> the context </param>
	  /// <returns> the built intent </returns>
	  public override Intent execute(Context context)
	  {
		string[] titles = new string[] {"Sales for 2008", "Sales for 2007", "Difference between 2008 and 2007 sales"};
		IList<double[]> values = new List<double[]>();
		values.Add(new double[] {14230, 12300, 14240, 15244, 14900, 12200, 11030, 12000, 12500, 15500, 14600, 15000});
		values.Add(new double[] {10230, 10900, 11240, 12540, 13500, 14200, 12530, 11200, 10500, 12500, 11600, 13500});
		int length = values[0].Length;
		double[] diff = new double[length];
		for (int i = 0; i < length; i++)
		{
		  diff[i] = values[0][i] - values[1][i];
		}
		values.Add(diff);
		int[] colors = new int[] {Color.BLUE, Color.CYAN, Color.GREEN};
		PointStyle[] styles = new PointStyle[] {PointStyle.POINT, PointStyle.POINT, PointStyle.POINT};
		XYMultipleSeriesRenderer renderer = buildRenderer(colors, styles);
		setChartSettings(renderer, "Monthly sales in the last 2 years", "Month", "Units sold", 0.75, 12.25, -5000, 19000, Color.GRAY, Color.LTGRAY);
		renderer.XLabels = 12;
		renderer.YLabels = 10;
		renderer.ChartTitleTextSize = 20;
		renderer.setTextTypeface("sans_serif", Typeface.BOLD);
		renderer.LabelsTextSize = 14f;
		renderer.AxisTitleTextSize = 15;
		renderer.LegendTextSize = 15;
		length = renderer.SeriesRendererCount;

		for (int i = 0; i < length; i++)
		{
		  XYSeriesRenderer seriesRenderer = (XYSeriesRenderer) renderer.getSeriesRendererAt(i);
		  if (i == length - 1)
		  {
			XYSeriesRenderer.FillOutsideLine fill = new XYSeriesRenderer.FillOutsideLine(XYSeriesRenderer.FillOutsideLine.Type.BOUNDS_ALL);
			fill.Color = Color.GREEN;
			seriesRenderer.addFillOutsideLine(fill);
		  }
		  seriesRenderer.LineWidth = 2.5f;
		  seriesRenderer.DisplayChartValues = true;
		  seriesRenderer.ChartValuesTextSize = 10f;
		}
		return ChartFactory.getCubicLineChartIntent(context, buildBarDataset(titles, values), renderer, 0.5f);
	  }
	  protected internal virtual void setRenderer(XYMultipleSeriesRenderer renderer, int[] colors, PointStyle[] styles)
	  {
		renderer.AxisTitleTextSize = 16;
		renderer.ChartTitleTextSize = 20;
		renderer.LabelsTextSize = 15;
		renderer.LegendTextSize = 15;
		renderer.PointSize = 5f;
		renderer.Margins = new int[] {20, 30, 15, 20};
		int length = colors.Length;
		for (int i = 0; i < length; i++)
		{
		  XYSeriesRenderer r = new XYSeriesRenderer();
		  r.Color = colors[i];
		  r.PointStyle = styles[i];
		  renderer.addSeriesRenderer(r);
		}
	  }
 public static PointStyle EditStyles(this StylePluginManager styleManager, StyleBuilderArguments styleArguments, PointStyle pointStyle)
 {
     return(EditStyles <PointStyle>(styleManager, styleArguments, pointStyle, s => new Collection <PointStyle>(s.CustomPointStyles.OfType <PointStyle>().ToList())));
 }
	  /// <summary>
	  /// Builds an XY multiple series renderer.
	  /// </summary>
	  /// <param name="colors"> the series rendering colors </param>
	  /// <param name="styles"> the series point styles </param>
	  /// <returns> the XY multiple series renderers </returns>
	  protected internal virtual XYMultipleSeriesRenderer buildRenderer(int[] colors, PointStyle[] styles)
	  {
		XYMultipleSeriesRenderer renderer = new XYMultipleSeriesRenderer();
		setRenderer(renderer, colors, styles);
		return renderer;
	  }
Exemple #13
0
 public ImageMapStyle(double minVis, double maxVis, bool enabled)
     : base(minVis, maxVis, enabled)
 {
     this._polyStyle = new PolygonStyle(minVis, maxVis, enabled);
     this._ps = new PointStyle(5, minVis, maxVis, enabled);
     this._ls = new LineStyle(5, minVis, maxVis, enabled);
 }
Exemple #14
0
 public SizedPointStyle(PointStyle pointStyle, string sizeColumnName, float ratio)
 {
     this.pointStyle     = pointStyle;
     this.sizeColumnName = sizeColumnName;
     this.ratio          = ratio;
 }
Exemple #15
0
        private void pointToolStripMenuItem_Click(object sender, EventArgs e)
        {
            PointNode pn = new PointNode();
            pn.SetPoint(new Vector3(100, 100, 100));

            PointStyle ps = new PointStyle();
            ps.SetMarker("plus");
            ps.SetPointSize(10);
            pn.SetPointStyle(ps);

            renderView.ShowSceneNode(pn);
            renderView.RequestDraw();
        }
Exemple #16
0
        private void largePointsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            const float len = 100.0f;
            const int nDim = 50;
            float[] pointBuffer = new float[nDim * nDim * nDim * 3];
            float[] colorBuffer = new float[nDim*nDim*nDim*3];
            int idx = -1;
            for (int ii = 0; ii < nDim; ++ii)
                for (int jj = 0; jj < nDim; ++jj)
                    for (int kk = 0; kk < nDim; ++kk)
                    {
                        ++idx;
                        pointBuffer[idx * 3] = ii * len;
                        pointBuffer[idx * 3 + 1] = jj * len;
                        pointBuffer[idx * 3 + 2] = kk * len;

                        colorBuffer[idx*3] = ((float)ii)/((float)nDim);
                        colorBuffer[idx*3 + 1] = ((float)jj)/((float)nDim);
                        colorBuffer[idx * 3 + 2] = ((float)kk) / ((float)nDim);
                    }

            PointStyle pointStyle = new PointStyle();
            pointStyle.SetPointSize(4.0f);

            PointCloudNode pcn = new PointCloudNode();
            pcn.SetPointStyle(pointStyle);
            pcn.SetPoints(pointBuffer);
            pcn.SetColors(colorBuffer);
            pcn.ComputeBBox();
            AABox bbox = pcn.GetBBox();
            Vector3 pt = bbox.MinPt;
            renderView.SceneManager.AddNode(pcn);

            renderView.RequestDraw();
        }
 /// <summary>
 /// Points the style.
 /// </summary>
 /// <param name="value">The value.</param>
 /// <returns>LineDatasetBuilder.</returns>
 public LineDatasetBuilder PointStyle(PointStyle value)
 {
     Dataset.PointStyle = value;
     return(this);
 }
 /// <summary>
 /// Adds a collection of stylized points to the display list.
 /// </summary>
 /// <param name="points">Points to add.</param>
 /// <param name="color">Color of points.</param>
 /// <param name="style">Display style of points.</param>
 /// <param name="radius">Radius of point widgets.</param>
 public void AddPoints(IEnumerable<Point3d> points, Color color, PointStyle style, int radius)
 {
   if (m_disposed) { throw new ObjectDisposedException("This CustomDisplay instance has been disposed and cannot be modified"); }
   foreach (Point3d point in points)
   {
     AddPoint(point, color, style, radius);
   }
 }
	  /// <summary>
	  /// Executes the chart demo.
	  /// </summary>
	  /// <param name="context"> the context </param>
	  /// <returns> the built intent </returns>
	  public override Intent execute(Context context)
	  {
		string[] titles = new string[] {"Inside", "Outside"};
		long now = Math.Round((DateTime.Now).Ticks / DAY) * DAY;
		IList<DateTime[]> x = new List<DateTime[]>();
		for (int i = 0; i < titles.Length; i++)
		{
		  DateTime[] dates = new DateTime[HOURS];
		  for (int j = 0; j < HOURS; j++)
		  {
			dates[j] = new DateTime(now - (HOURS - j) * HOUR);
		  }
		  x.Add(dates);
		}
		IList<double[]> values = new List<double[]>();

		values.Add(new double[] {21.2, 21.5, 21.7, 21.5, 21.4, 21.4, 21.3, 21.1, 20.6, 20.3, 20.2, 19.9, 19.7, 19.6, 19.9, 20.3, 20.6, 20.9, 21.2, 21.6, 21.9, 22.1, 21.7, 21.5});
		values.Add(new double[] {1.9, 1.2, 0.9, 0.5, 0.1, -0.5, -0.6, MathHelper.NULL_VALUE, MathHelper.NULL_VALUE, -1.8, -0.3, 1.4, 3.4, 4.9, 7.0, 6.4, 3.4, 2.0, 1.5, 0.9, -0.5, MathHelper.NULL_VALUE, -1.9, -2.5, -4.3});

		int[] colors = new int[] {Color.GREEN, Color.BLUE};
		PointStyle[] styles = new PointStyle[] {PointStyle.CIRCLE, PointStyle.DIAMOND};
		XYMultipleSeriesRenderer renderer = buildRenderer(colors, styles);
		int length = renderer.SeriesRendererCount;
		for (int i = 0; i < length; i++)
		{
		  ((XYSeriesRenderer) renderer.getSeriesRendererAt(i)).FillPoints = true;
		}
		setChartSettings(renderer, "Sensor temperature", "Hour", "Celsius degrees", x[0][0].Ticks, x[0][HOURS - 1].Ticks, -5, 30, Color.LTGRAY, Color.LTGRAY);
		renderer.XLabels = 10;
		renderer.YLabels = 10;
		renderer.ShowGrid = true;
		renderer.XLabelsAlign = Align.CENTER;
		renderer.YLabelsAlign = Align.RIGHT;
		Intent intent = ChartFactory.getTimeChartIntent(context, buildDateDataset(titles, x, values), renderer, "h:mm a");
		return intent;
	  }
Exemple #20
0
 /// <summary>
 /// Creates a new instance of <see cref="MapPointData"/>.
 /// </summary>
 /// <param name="name">The name of the <see cref="MapPointData"/>.</param>
 /// <param name="style">The style of the data.</param>
 /// <exception cref="ArgumentException">Thrown when <paramref name="name"/> is
 /// <c>null</c> or only whitespace.</exception>
 /// <exception cref="ArgumentNullException">Thrown when <paramref name="style"/>
 /// is <c>null</c>.</exception>
 public RemovableMapPointData(string name, PointStyle style) : base(name, style)
 {
 }
Exemple #21
0
        public static void QueryFeatures(this MapView map, CartoSQLService service, LocalVectorDataSource source, PointStyle style, string query)
        {
            System.Threading.Tasks.Task.Run(delegate
            {
                FeatureCollection features = service.QueryFeatures(query, map.Options.BaseProjection);

                for (int i = 0; i < features.FeatureCount; i++)
                {
                    Feature feature = features.GetFeature(i);

                    PointGeometry geometry = (PointGeometry)feature.Geometry;

                    var point = new Point(geometry, style);
                    source.Add(point);
                }
            });
        }
Exemple #22
0
        public void InitAcadValues()
        {
            //using (var docLock = Tools.GetActiveAcadDocument().LockDocument())
            {
                _pointsStyleCollection.Clear();
                _pointsLabelStylesCollection.Clear();

                /*_pointsStyleCollection.Add(CogoPointEditor.GeDefailtPointStyleId(), CogoPointEditor.GeDefailtPointStyleName());
                 * _pointsLabelStylesCollection.Add(CogoPointEditor.GeDefailtPointLableStyleId(), CogoPointEditor.GeDefailtPointLableStyleName());
                 */
                _pointsStyleCollection.Add(ObjectId.Null, "<По умолчанию>");
                _pointsLabelStylesCollection.Add(ObjectId.Null, "<По умолчанию>");

                var styles      = CogoPointEditor.GetAllPointsStyles();
                var lableStyles = CogoPointEditor.GetAllPointsLabelStyles();

                using (Transaction trans = HostApplicationServices.WorkingDatabase.TransactionManager.StartTransaction())
                {
                    foreach (ObjectId styleId in styles)
                    {
                        PointStyle ps = null;
                        try
                        {
                            ps = styleId.GetObject(OpenMode.ForRead, true, true) as PointStyle;
                            if (ps == null || ps.Id.IsNull)
                            {
                                continue;
                            }
                        }
                        catch
                        {
                            Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog("Только для Autocad Civil 3D");
                            return;
                        }

                        if (!_pointsStyleCollection.ContainsKey(styleId))
                        {
                            _pointsStyleCollection.Add(styleId, ps.Name);
                        }
                        else
                        {
                            _pointsStyleCollection[styleId] = ps.Name;
                        }
                    }

                    foreach (ObjectId labelStyleId in lableStyles)
                    {
                        LabelStyle ls = null;
                        try
                        {
                            ls = labelStyleId.GetObject(OpenMode.ForRead, true, true) as LabelStyle;
                            if (ls == null || ls.Id.IsNull)
                            {
                                continue;
                            }
                        }
                        catch
                        {
                            Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog("Только для Autocad Civil 3D");
                            return;
                        }

                        if (!_pointsLabelStylesCollection.ContainsKey(labelStyleId))
                        {
                            _pointsLabelStylesCollection.Add(labelStyleId, ls.Name);
                        }
                        else
                        {
                            _pointsLabelStylesCollection[labelStyleId] = ls.Name;
                        }
                    }
                }
            }
        }
Exemple #23
0
        private void Map1_Loaded(object sender, RoutedEventArgs e)
        {
            Map1.MapUnit = GeographyUnit.DecimalDegree;

            ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(@"../../Data/Countries02.shp");
            AreaStyle             areaStyle  = new AreaStyle();

            areaStyle.FillSolidBrush       = new GeoSolidBrush(GeoColor.FromArgb(255, 233, 232, 214));
            areaStyle.OutlinePen           = new GeoPen(GeoColor.FromArgb(255, 118, 138, 69), 1);
            areaStyle.OutlinePen.DashStyle = LineDashStyle.Solid;

            worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle    = areaStyle;
            worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            PointStyle pointStyle = new PointStyle();

            pointStyle.SymbolType       = PointSymbolType.Square;
            pointStyle.SymbolSolidBrush = new GeoSolidBrush(GeoColor.StandardColors.White);
            pointStyle.SymbolPen        = new GeoPen(GeoColor.StandardColors.Black, 1);
            pointStyle.SymbolSize       = 6;

            PointStyle stackStyle = new PointStyle();

            stackStyle.SymbolType       = PointSymbolType.Square;
            stackStyle.SymbolSolidBrush = new GeoSolidBrush(GeoColor.StandardColors.Maroon);
            stackStyle.SymbolPen        = new GeoPen(GeoColor.StandardColors.Transparent, 0);
            stackStyle.SymbolSize       = 2;

            pointStyle.CustomPointStyles.Add(stackStyle);
            ShapeFileFeatureLayer capitalLayer = new ShapeFileFeatureLayer(@"../../Data/WorldCapitals.shp");

            // We can customize our own Style. Here we passed in a color and a size.
            capitalLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.CreateSimpleCircleStyle(GeoColor.StandardColors.White, 7, GeoColor.StandardColors.Brown);
            // The Style we set here is available from ZoomLevel01 to ZoomLevel05. That means if we zoom in a bit more, the appearance we set here will not be visible anymore.
            capitalLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;


            capitalLayer.ZoomLevelSet.ZoomLevel06.DefaultPointStyle = pointStyle;
            // The Style we set here is available from ZoomLevel06 to ZoomLevel20. That means if we zoom out a bit more, the appearance we set here will not be visible any more.
            capitalLayer.ZoomLevelSet.ZoomLevel06.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            ShapeFileFeatureLayer capitalLabelLayer = new ShapeFileFeatureLayer(@"../../Data/WorldCapitals.shp");
            // We can customize our own TextStyle. Here we passed in the font, the size, the style and the color.
            GeoFont       font      = new GeoFont("Arial", 9, DrawingFontStyles.Bold);
            GeoSolidBrush txtBrush  = new GeoSolidBrush(GeoColor.StandardColors.Maroon);
            TextStyle     textStyle = new TextStyle("CITY_NAME", font, txtBrush);

            textStyle.XOffsetInPixel = 0;
            textStyle.YOffsetInPixel = -6;
            capitalLabelLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = TextStyles.CreateSimpleTextStyle("CITY_NAME", "Arial", 8, DrawingFontStyles.Italic, GeoColor.StandardColors.Black, 3, 3);
            // The TextStyle we set here is available from ZoomLevel01 to ZoomLevel05.
            capitalLabelLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level05;

            capitalLabelLayer.ZoomLevelSet.ZoomLevel06.DefaultTextStyle = textStyle;
            // The TextStyle we set here is available from ZoomLevel06 to ZoomLevel20.
            capitalLabelLayer.ZoomLevelSet.ZoomLevel06.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            LayerOverlay layerOverlay = new LayerOverlay();

            layerOverlay.Layers.Add(new BackgroundLayer(new GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean)));
            layerOverlay.Layers.Add(worldLayer);
            layerOverlay.Layers.Add(capitalLayer);
            layerOverlay.Layers.Add(capitalLabelLayer);

            Map1.Overlays.Add(layerOverlay);
            Map1.CurrentExtent = new RectangleShape(-136.60, 60.06, -53.81, 11.63);
            Map1.Refresh();
        }
Exemple #24
0
 /// <summary>
 /// Asserts the point style.
 /// </summary>
 /// <param name="pointStyle">The <see cref="PointStyle"/>to assert.</param>
 /// <param name="color">The expected <see cref="Color"/>.</param>
 /// <param name="width">The expected width of the point.</param>
 /// <param name="symbol">The expected <see cref="PointSymbol"/>.</param>
 /// <exception cref="AssertionException">Thrown when one of the parameters
 /// doesn't have the expected corresponding value.</exception>
 public static void AssertEqualStyle(PointStyle pointStyle, Color color, int width, PointSymbol symbol)
 {
     Assert.AreEqual(color, pointStyle.Color);
     Assert.AreEqual(width, pointStyle.Size);
     Assert.AreEqual(symbol, pointStyle.Symbol);
 }
	  /// <summary>
	  /// Executes the chart demo.
	  /// </summary>
	  /// <param name="context"> the context </param>
	  /// <returns> the built intent </returns>
	  public override Intent execute(Context context)
	  {
		string[] titles = new string[] {"New tickets", "Fixed tickets"};
		IList<DateTime[]> dates = new List<DateTime[]>();
		IList<double[]> values = new List<double[]>();
		int length = titles.Length;
		for (int i = 0; i < length; i++)
		{
		  dates.Add(new DateTime[12]);
		  dates[i][0] = new DateTime(108, 9, 1);
		  dates[i][1] = new DateTime(108, 9, 8);
		  dates[i][2] = new DateTime(108, 9, 15);
		  dates[i][3] = new DateTime(108, 9, 22);
		  dates[i][4] = new DateTime(108, 9, 29);
		  dates[i][5] = new DateTime(108, 10, 5);
		  dates[i][6] = new DateTime(108, 10, 12);
		  dates[i][7] = new DateTime(108, 10, 19);
		  dates[i][8] = new DateTime(108, 10, 26);
		  dates[i][9] = new DateTime(108, 11, 3);
		  dates[i][10] = new DateTime(108, 11, 10);
		  dates[i][11] = new DateTime(108, 11, 17);
		}
		values.Add(new double[] {142, 123, 142, 152, 149, 122, 110, 120, 125, 155, 146, 150});
		values.Add(new double[] {102, 90, 112, 105, 125, 112, 125, 112, 105, 115, 116, 135});
		length = values[0].Length;
		int[] colors = new int[] {Color.BLUE, Color.GREEN};
		PointStyle[] styles = new PointStyle[] {PointStyle.POINT, PointStyle.POINT};
		XYMultipleSeriesRenderer renderer = buildRenderer(colors, styles);
		setChartSettings(renderer, "Project work status", "Date", "Tickets", dates[0][0].Ticks, dates[0][11].Ticks, 50, 190, Color.GRAY, Color.LTGRAY);
		renderer.XLabels = 0;
		renderer.YLabels = 10;
		renderer.addYTextLabel(100, "test");
		length = renderer.SeriesRendererCount;
		for (int i = 0; i < length; i++)
		{
		  SimpleSeriesRenderer seriesRenderer = renderer.getSeriesRendererAt(i);
		  seriesRenderer.DisplayChartValues = true;
		}
		renderer.XRoundedLabels = false;
		return ChartFactory.getTimeChartIntent(context, buildDateDataset(titles, dates, values), renderer, "MM/dd/yyyy");
	  }
 private static IFeatureCategory CreateCategory(PointStyle pointStyle)
 {
     return(new PointCategory(CreatePointSymbolizer(pointStyle)));
 }
 /// <summary>Draws a point with a given radius, style and color.</summary>
 /// <param name="point">Location of point in world coordinates.</param>
 /// <param name="style">Point display style.</param>
 /// <param name="radius">Point size in pixels.</param>
 /// <param name="color">
 /// Color of point. If style is ControlPoint, this will be the border color.
 /// </param>
 public void DrawPoint(Point3d point, PointStyle style, int radius, System.Drawing.Color color)
 {
   int argb = color.ToArgb();
   Point3d[] pts = new Point3d[] { point };
   UnsafeNativeMethods.CRhinoDisplayPipeline_DrawPoints(m_ptr, 1, pts, (int)style, radius, argb);
 }
Exemple #28
0
        private void curveIntersectionToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TopoShape ellipseArc = GlobalInstance.BrepTools.MakeEllipseArc(Vector3.ZERO, 100, 50, 0, 90, Vector3.UNIT_Z);
            TopoShape circle = GlobalInstance.BrepTools.MakeCircle(Vector3.ZERO, 60, Vector3.UNIT_Z);

            IntersectionLineCurve intersector = new IntersectionLineCurve();
            intersector.SetCurve(ellipseArc);
            if (intersector.Perform(circle))
            {
                PointStyle ps = new PointStyle();
                ps.SetMarker("plus");
                ps.SetPointSize(10);
                

                int nCount = intersector.GetPointCount();
                for (int ii = 1; ii <= nCount; ++ii)
                {
                    if (intersector.GetSquareDistance(ii) < 0.001)
                    {
                        Vector3 pt = intersector.GetPoint(ii);

                        PointNode pn = new PointNode();
                        pn.SetPoint(pt);
                        pn.SetPointStyle(ps);
                        renderView.ShowSceneNode(pn);
                    }
                }
            }

            renderView.ShowGeometry(ellipseArc, ++shapeId);
            renderView.ShowGeometry(circle, ++shapeId);
            renderView.RequestDraw();
        }
Exemple #29
0
        private void TestForm_Load(object sender, EventArgs e)
        {
            winformsMap1.MapUnit       = GeographyUnit.DecimalDegree;
            winformsMap1.CurrentExtent = new RectangleShape(-97.7591, 30.3126, -97.7317, 30.2964);
            winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.FromArgb(255, 198, 255, 255));

            //Displays the World Map Kit as a background.
            WorldStreetsAndImageryOverlay worldMapKitDesktopOverlay = new WorldStreetsAndImageryOverlay();

            winformsMap1.Overlays.Add(worldMapKitDesktopOverlay);

            //EditInteractiveOverlay used because it already have the logic for dragging.
            EditInteractiveOverlay editInteractiveOverlay = new EditInteractiveOverlay();

            //Sets the property IsActive for DragControlPointsLayer to false so that the control point (as four arrows) is not visible.
            editInteractiveOverlay.DragControlPointsLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle.IsActive = false;
            editInteractiveOverlay.DragControlPointsLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel        = ApplyUntilZoomLevel.Level20;

            //Sets the property IsActive for all the Styles of EditShapesLayer because we are using a ValueStyle instead.
            editInteractiveOverlay.EditShapesLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle.IsActive = false;
            editInteractiveOverlay.EditShapesLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle.IsActive  = false;
            editInteractiveOverlay.EditShapesLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.IsActive  = false;

            //ValueStyle used for displaying the feature according to the value of the column "Type" for displaying with a bus or car icon.
            ValueStyle valueStyle = new ValueStyle();

            valueStyle.ColumnName = "Type";

            PointStyle carPointStyle = new PointStyle(new GeoImage("../../data/car_normal.png"));

            carPointStyle.PointType = PointType.Bitmap;
            PointStyle busPointStyle = new PointStyle(new GeoImage("../../data/bus_normal.png"));

            busPointStyle.PointType = PointType.Bitmap;

            valueStyle.ValueItems.Add(new ValueItem("Car", carPointStyle));
            valueStyle.ValueItems.Add(new ValueItem("Bus", busPointStyle));

            editInteractiveOverlay.EditShapesLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(valueStyle);
            editInteractiveOverlay.EditShapesLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            editInteractiveOverlay.EditShapesLayer.Open();
            editInteractiveOverlay.EditShapesLayer.Columns.Add(new FeatureSourceColumn("Type"));
            editInteractiveOverlay.EditShapesLayer.Close();

            Feature carFeature = new Feature(new PointShape(-97.7507, 30.3092));

            carFeature.ColumnValues["Type"] = "Car";

            Feature busFeature = new Feature(new PointShape(-97.7428, 30.3053));

            busFeature.ColumnValues["Type"] = "Bus";

            editInteractiveOverlay.EditShapesLayer.InternalFeatures.Add("Car", carFeature);
            editInteractiveOverlay.EditShapesLayer.InternalFeatures.Add("Bus", busFeature);

            //Sets the properties of EditInteractiveOverlay to have the appropriate behavior.
            //Make sure CanDrag is set to true.
            editInteractiveOverlay.CanAddVertex    = false;
            editInteractiveOverlay.CanDrag         = true;
            editInteractiveOverlay.CanRemoveVertex = false;
            editInteractiveOverlay.CanResize       = false;
            editInteractiveOverlay.CanRotate       = false;
            editInteractiveOverlay.CalculateAllControlPoints();

            winformsMap1.EditOverlay = editInteractiveOverlay;

            winformsMap1.Refresh();
        }
Exemple #30
0
 public MyPointStyle(PointStyle style)
 {
     this.style = style;
 }
Exemple #31
0
        public PointStyleViewModel(PointStyle style)
            : base(style)
        {
            if (style is SymbolPointStyle)
            {
                HelpKey = "CustomPointStyleHelp";
            }
            else
            {
                HelpKey = "PointStyleHelp";
            }

            ActualObject     = style;
            actualPointStyle = style;
            if (actualPointStyle.CharacterIndex == 0)
            {
                actualPointStyle.CharacterIndex = 33;
            }

            if (style is SymbolPointStyle || style is FontPointStyle)
            {
                iconSource = new IconSource(this);
                if (string.IsNullOrEmpty(ImagePath))
                {
                    if (actualPointStyle.Image != null &&
                        !String.IsNullOrEmpty(actualPointStyle.Image.GetPathFilename()) &&
                        actualPointStyle.Image.GetPathFilename().StartsWith(iconFalgs))
                    {
                        var selectedIconUri = actualPointStyle.Image.GetPathFilename().Replace(iconFalgs, "");
                        var catogeries      = selectedIconUri.Split(delimiter.ToCharArray().FirstOrDefault());
                        if (catogeries.Length == 3)
                        {
                            iconSource.SelectedCategory    = iconSource.IconCategories.FirstOrDefault(c => c.CategoryName.Equals(catogeries[0]));
                            iconSource.SelectedSubCategory = iconSource.SelectedCategory.SubCategories.FirstOrDefault(c => c.CategoryName.Equals(catogeries[1]));
                            iconSource.SelectedIcon        = iconSource.SelectedSubCategory.Icons.FirstOrDefault(icon => icon.IconName.Equals(catogeries[2]));
                        }
                        else if (catogeries.Length == 2)
                        {
                            var category = iconSource.IconCategories.FirstOrDefault(c => c.CategoryName.Equals(catogeries[0]));
                            if (category != null)
                            {
                                iconSource.SelectedCategory = category;
                            }
                            var iconEntity = iconSource.SelectedCategory.Icons.FirstOrDefault(icon => icon.IconName.Equals(catogeries[1]));
                            if (iconEntity != null)
                            {
                                iconSource.SelectedIcon = iconEntity;
                            }
                        }
                    }
                }
                else
                {
                    ImagePath = ImagePath;
                }
            }

            if (iconSource != null)
            {
                iconSource.PropertyChanged += (s, e) =>
                {
                    if (e.PropertyName.Equals("SelectedIcon"))
                    {
                        if (iconSource.SelectedIcon != null)
                        {
                            var image = iconSource.SelectedIcon.Icon as BitmapImage;
                            if (image != null)
                            {
                                MemoryStream ms       = new MemoryStream();
                                Image        tmpImage = null;
                                string       filePath = null;
                                if (image.StreamSource == null)
                                {
                                    tmpImage = Image.FromFile(image.UriSource.AbsolutePath);
                                    filePath = image.UriSource.AbsolutePath;
                                }
                                else
                                {
                                    tmpImage = Image.FromStream(image.StreamSource);
                                }
                                tmpImage.Save(ms, ImageFormat.Png);

                                if (ms != null)
                                {
                                    actualPointStyle.Image = new GeoImage(ms);
                                }
                                else
                                {
                                    actualPointStyle.Image = new GeoImage(filePath);
                                }
                            }
                        }
                    }
                };
            }

            if (symbolTypeList == null)
            {
                symbolTypeList = GetSymbolTypeListItems();
            }
        }
Exemple #32
0
        void Chart1_MouseMove(object sender, MouseEventArgs e)
        {
            ChartGroup grp = Chart1.ChartGroups.Group0;
            ps = grp.ChartData.PointStylesList[0];
            // if both are changed to valid values, then something needs to be highlighted
            int seriesIndex = -1, pointIndex = -1;

            // check if the mouse is in the PlotArea.
            if (Chart1.ChartRegionFromCoord(e.X, e.Y) == ChartRegionEnum.PlotArea)
            {

                int dist = 0;

                // find the closest XCoord.
                if (grp.CoordToDataIndex(e.X, e.Y, CoordinateFocusEnum.XCoord, ref seriesIndex, ref pointIndex, ref dist))
                {
                    // if there are multiple series in the chart, then find the closest series.
                    if (grp.CoordToSeriesIndex(e.X, e.Y, PlotElementEnum.Series, ref seriesIndex, ref dist))
                    {
                        ps.PointIndex = pointIndex;
                        ps.SeriesIndex = seriesIndex;
                        label3.Text = tlist[pointIndex].ToString();
                        label4.Text = ylist[pointIndex].ToString();
                    }
                }

                if (seriesIndex == -1 || pointIndex == -1)
                {
                    ps.PointIndex = -1;
                    ps.SeriesIndex = -1;
                }
            }
        }
Exemple #33
0
 public TimeBasedPointStyle(string timeZoneColumnName, PointStyle daytimePointStyle, PointStyle nighttimePointStyle)
 {
     this.timeZoneColumnName  = timeZoneColumnName;
     this.daytimePointStyle   = daytimePointStyle;
     this.nighttimePointStyle = nighttimePointStyle;
 }
    /// <summary>
    /// Adds a new stylized point to the display list.
    /// </summary>
    /// <param name="point">Point to add.</param>
    /// <param name="color">Color of point.</param>
    /// <param name="style">Display style of point.</param>
    /// <param name="radius">Radius of point widget.</param>
    public void AddPoint(Point3d point, Color color, PointStyle style, int radius)
    {
      if (m_disposed) { throw new ObjectDisposedException("This CustomDisplay instance has been disposed and cannot be modified"); }
      if (!point.IsValid) { return; }

      CDU_Point cdu = new CDU_Point();
      cdu.m_point = point;
      cdu.m_color = Color.FromArgb(255, color);
      cdu.m_style = style;
      cdu.m_radius = radius;

      m_points.Add(cdu);
      m_clip.Union(point);
    }
        public static bool CheckIsValid(this Style style)
        {
            AreaStyle       areaStyle       = style as AreaStyle;
            LineStyle       lineStyle       = style as LineStyle;
            PointStyle      pointStyle      = style as PointStyle;
            TextStyle       textStyle       = style as TextStyle;
            DotDensityStyle dotDensityStyle = style as DotDensityStyle;
            ClassBreakStyle classBreakStyle = style as ClassBreakStyle;
            RegexStyle      regexStyle      = style as RegexStyle;
            FilterStyle     filterStyle     = style as FilterStyle;
            CompositeStyle  componentStyle  = style as CompositeStyle;

            bool isStyleValid = style.IsActive && !string.IsNullOrEmpty(style.Name);

            if (areaStyle != null)
            {
                isStyleValid &= (!areaStyle.FillSolidBrush.Color.IsTransparent ||
                                 !areaStyle.OutlinePen.Color.IsTransparent ||
                                 areaStyle.Advanced.FillCustomBrush != null);
            }
            else if (lineStyle != null)
            {
                isStyleValid &= (!lineStyle.CenterPen.Color.IsTransparent ||
                                 !lineStyle.OuterPen.Color.IsTransparent ||
                                 !lineStyle.InnerPen.Color.IsTransparent);
            }
            else if (pointStyle != null)
            {
                switch (pointStyle.PointType)
                {
                case PointType.Symbol:
                    isStyleValid &= (!pointStyle.SymbolPen.Color.IsTransparent ||
                                     pointStyle.Image != null ||
                                     !pointStyle.SymbolSolidBrush.Color.IsTransparent ||
                                     pointStyle.Advanced.CustomBrush != null);
                    break;

                case PointType.Bitmap:
                    isStyleValid &= pointStyle.Image != null;
                    break;

                case PointType.Character:
                    isStyleValid &= pointStyle.CharacterFont != null &&
                                    (!pointStyle.CharacterSolidBrush.Color.IsTransparent ||
                                     pointStyle.Advanced.CustomBrush != null);
                    break;

                default:
                    break;
                }
            }
            else if (textStyle != null)
            {
                isStyleValid &= !string.IsNullOrEmpty(textStyle.TextColumnName) &&
                                (!textStyle.HaloPen.Color.IsTransparent ||
                                 !textStyle.TextSolidBrush.Color.IsTransparent ||
                                 textStyle.Advanced.TextCustomBrush != null);
            }
            else if (dotDensityStyle != null)
            {
                isStyleValid &= !string.IsNullOrEmpty(dotDensityStyle.ColumnName) &&
                                (dotDensityStyle.CustomPointStyle != null &&
                                 CheckIsValid(dotDensityStyle.CustomPointStyle) &&
                                 dotDensityStyle.PointToValueRatio != 0);
            }
            else if (classBreakStyle != null)
            {
                isStyleValid &= !string.IsNullOrEmpty(classBreakStyle.ColumnName) &&
                                classBreakStyle.ClassBreaks.Count != 0;
            }
            else if (regexStyle != null)
            {
                isStyleValid &= !string.IsNullOrEmpty(regexStyle.ColumnName) &&
                                regexStyle.RegexItems.Count != 0;
            }
            else if (filterStyle != null)
            {
                isStyleValid &= filterStyle.Conditions.Count > 0;
            }
            else if (componentStyle != null)
            {
                isStyleValid = true;
            }
            return(isStyleValid);
        }
	  /// <summary>
	  /// Executes the chart demo.
	  /// </summary>
	  /// <param name="context"> the context </param>
	  /// <returns> the built intent </returns>
	  public override Intent execute(Context context)
	  {
		string[] titles = new string[] {"Sales growth January 1995 to December 2000"};
		IList<DateTime[]> dates = new List<DateTime[]>();
		IList<double[]> values = new List<double[]>();
		DateTime[] dateValues = new DateTime[]
		{
			new DateTime(95, 0, 1),
			new DateTime(95, 3, 1),
			new DateTime(95, 6, 1),
			new DateTime(95, 9, 1),
			new DateTime(96, 0, 1),
			new DateTime(96, 3, 1),
			new DateTime(96, 6, 1),
			new DateTime(96, 9, 1),
			new DateTime(97, 0, 1),
			new DateTime(97, 3, 1),
			new DateTime(97, 6, 1),
			new DateTime(97, 9, 1),
			new DateTime(98, 0, 1),
			new DateTime(98, 3, 1),
			new DateTime(98, 6, 1),
			new DateTime(98, 9, 1),
			new DateTime(99, 0, 1),
			new DateTime(99, 3, 1),
			new DateTime(99, 6, 1),
			new DateTime(99, 9, 1),
			new DateTime(100, 0, 1),
			new DateTime(100, 3, 1),
			new DateTime(100, 6, 1),
			new DateTime(100, 9, 1),
			new DateTime(100, 11, 1)
		};
		dates.Add(dateValues);

		values.Add(new double[] {4.9, 5.3, 3.2, 4.5, 6.5, 4.7, 5.8, 4.3, 4, 2.3, -0.5, -2.9, 3.2, 5.5, 4.6, 9.4, 4.3, 1.2, 0, 0.4, 4.5, 3.4, 4.5, 4.3, 4});
		int[] colors = new int[] {Color.BLUE};
		PointStyle[] styles = new PointStyle[] {PointStyle.POINT};
		XYMultipleSeriesRenderer renderer = buildRenderer(colors, styles);
		setChartSettings(renderer, "Sales growth", "Date", "%", dateValues[0].Ticks, dateValues[dateValues.Length - 1].Ticks, -4, 11, Color.GRAY, Color.LTGRAY);
		renderer.YLabels = 10;
		renderer.XRoundedLabels = false;
		XYSeriesRenderer xyRenderer = (XYSeriesRenderer) renderer.getSeriesRendererAt(0);
		XYSeriesRenderer.FillOutsideLine fill = new XYSeriesRenderer.FillOutsideLine(XYSeriesRenderer.FillOutsideLine.Type.BOUNDS_ABOVE);
		fill.Color = Color.GREEN;
		xyRenderer.addFillOutsideLine(fill);
		fill = new XYSeriesRenderer.FillOutsideLine(XYSeriesRenderer.FillOutsideLine.Type.BOUNDS_BELOW);
		fill.Color = Color.MAGENTA;
		xyRenderer.addFillOutsideLine(fill);
		fill = new XYSeriesRenderer.FillOutsideLine(XYSeriesRenderer.FillOutsideLine.Type.BOUNDS_ABOVE);
		fill.Color = Color.argb(255, 0, 200, 100);
		fill.FillRange = new int[] {10, 19};
		xyRenderer.addFillOutsideLine(fill);

		return ChartFactory.getTimeChartIntent(context, buildDateDataset(titles, dates, values), renderer, "MMM yyyy");
	  }
	  /// <summary>
	  /// Executes the chart demo.
	  /// </summary>
	  /// <param name="context"> the context </param>
	  /// <returns> the built intent </returns>
	  public override Intent execute(Context context)
	  {
		string[] titles = new string[] {"Crete Air Temperature", "Skiathos Air Temperature"};
		IList<double[]> x = new List<double[]>();
		for (int i = 0; i < titles.Length; i++)
		{
		  x.Add(new double[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12});
		}
		IList<double[]> values = new List<double[]>();
		values.Add(new double[] {12.3, 12.5, 13.8, 16.8, 20.4, 24.4, 26.4, 26.1, 23.6, 20.3, 17.2, 13.9});
		values.Add(new double[] {9, 10, 11, 15, 19, 23, 26, 25, 22, 18, 13, 10});
		int[] colors = new int[] {Color.GREEN, Color.rgb(200, 150, 0)};
		PointStyle[] styles = new PointStyle[] {PointStyle.CIRCLE, PointStyle.DIAMOND};
		XYMultipleSeriesRenderer renderer = buildRenderer(colors, styles);
		renderer.PointSize = 5.5f;
		int length = renderer.SeriesRendererCount;
		for (int i = 0; i < length; i++)
		{
		  XYSeriesRenderer r = (XYSeriesRenderer) renderer.getSeriesRendererAt(i);
		  r.LineWidth = 5;
		  r.FillPoints = true;
		}
		setChartSettings(renderer, "Weather data", "Month", "Temperature", 0.5, 12.5, 0, 40, Color.LTGRAY, Color.LTGRAY);

		renderer.XLabels = 12;
		renderer.YLabels = 10;
		renderer.ShowGrid = true;
		renderer.XLabelsAlign = Align.RIGHT;
		renderer.YLabelsAlign = Align.RIGHT;
		renderer.ZoomButtonsVisible = true;
		renderer.PanLimits = new double[] {-10, 20, -10, 40};
		renderer.ZoomLimits = new double[] {-10, 20, -10, 40};

		XYValueSeries sunSeries = new XYValueSeries("Sunshine hours");
		sunSeries.add(1f, 35, 4.3);
		sunSeries.add(2f, 35, 4.9);
		sunSeries.add(3f, 35, 5.9);
		sunSeries.add(4f, 35, 8.8);
		sunSeries.add(5f, 35, 10.8);
		sunSeries.add(6f, 35, 11.9);
		sunSeries.add(7f, 35, 13.6);
		sunSeries.add(8f, 35, 12.8);
		sunSeries.add(9f, 35, 11.4);
		sunSeries.add(10f, 35, 9.5);
		sunSeries.add(11f, 35, 7.5);
		sunSeries.add(12f, 35, 5.5);
		XYSeriesRenderer lightRenderer = new XYSeriesRenderer();
		lightRenderer.Color = Color.YELLOW;

		XYSeries waterSeries = new XYSeries("Water Temperature");
		waterSeries.add(1, 16);
		waterSeries.add(2, 15);
		waterSeries.add(3, 16);
		waterSeries.add(4, 17);
		waterSeries.add(5, 20);
		waterSeries.add(6, 23);
		waterSeries.add(7, 25);
		waterSeries.add(8, 25.5);
		waterSeries.add(9, 26.5);
		waterSeries.add(10, 24);
		waterSeries.add(11, 22);
		waterSeries.add(12, 18);
		renderer.BarSpacing = 0.5;
		XYSeriesRenderer waterRenderer = new XYSeriesRenderer();
		waterRenderer.Color = Color.argb(250, 0, 210, 250);

		XYMultipleSeriesDataset dataset = buildDataset(titles, x, values);
		dataset.addSeries(0, sunSeries);
		dataset.addSeries(0, waterSeries);
		renderer.addSeriesRenderer(0, lightRenderer);
		renderer.addSeriesRenderer(0, waterRenderer);
		waterRenderer.DisplayChartValues = true;
		waterRenderer.ChartValuesTextSize = 10;

		string[] types = new string[] {BarChart.TYPE, BubbleChart.TYPE, LineChart.TYPE, CubicLineChart.TYPE};
		Intent intent = ChartFactory.getCombinedXYChartIntent(context, dataset, renderer, types, "Weather parameters");
		return intent;
	  }
        private void InitializeOverlays()
        {
            string cacheFolder = Path.Combine(Path.GetTempPath(), "TileCache");

            WorldMapKitWmsWpfOverlay worldMapKitRoadOverlay = new WorldMapKitWmsWpfOverlay();
            worldMapKitRoadOverlay.Name = Resources.WorldMapKitOverlayRoadName;
            worldMapKitRoadOverlay.TileHeight = 512;
            worldMapKitRoadOverlay.TileWidth = 512;
            worldMapKitRoadOverlay.Projection = WorldMapKitProjection.SphericalMercator;
            worldMapKitRoadOverlay.MapType = WorldMapKitMapType.Road;
            worldMapKitRoadOverlay.IsVisible = true;
            worldMapKitRoadOverlay.TileCache = new FileBitmapTileCache(cacheFolder, Resources.WorldMapKitOverlayRoadName);
            mapControl.Overlays.Add(worldMapKitRoadOverlay);

            WorldMapKitWmsWpfOverlay worldMapKitAerialOverlay = new WorldMapKitWmsWpfOverlay();
            worldMapKitAerialOverlay.Name = Resources.WorldMapKitOverlayAerialName;
            worldMapKitAerialOverlay.TileHeight = 512;
            worldMapKitAerialOverlay.TileWidth = 512;
            worldMapKitAerialOverlay.Projection = WorldMapKitProjection.SphericalMercator;
            worldMapKitAerialOverlay.MapType = WorldMapKitMapType.Aerial;
            worldMapKitAerialOverlay.IsVisible = false;
            worldMapKitAerialOverlay.TileCache = new FileBitmapTileCache(cacheFolder, Resources.WorldMapKitOverlayAerialName);
            mapControl.Overlays.Add(worldMapKitAerialOverlay);

            WorldMapKitWmsWpfOverlay worldMapKitAerialWithLabelsOverlay = new WorldMapKitWmsWpfOverlay();
            worldMapKitAerialWithLabelsOverlay.Name = Resources.WorldMapKitOverlayAerialWithLabelsName;
            worldMapKitAerialWithLabelsOverlay.TileHeight = 512;
            worldMapKitAerialWithLabelsOverlay.TileWidth = 512;
            worldMapKitAerialWithLabelsOverlay.Projection = WorldMapKitProjection.SphericalMercator;
            worldMapKitAerialWithLabelsOverlay.MapType = WorldMapKitMapType.AerialWithLabels;
            worldMapKitAerialWithLabelsOverlay.IsVisible = false;
            worldMapKitAerialWithLabelsOverlay.TileCache = new FileBitmapTileCache(cacheFolder, Resources.WorldMapKitOverlayAerialWithLabelsName);
            mapControl.Overlays.Add(worldMapKitAerialWithLabelsOverlay);

            OpenStreetMapOverlay openStreetMapOverlay = new OpenStreetMapOverlay();
            openStreetMapOverlay.Name = Resources.OSMOverlayName;
            openStreetMapOverlay.TileHeight = 512;
            openStreetMapOverlay.TileWidth = 512;
            openStreetMapOverlay.IsVisible = false;
            openStreetMapOverlay.TileCache = new FileBitmapTileCache(cacheFolder, Resources.OSMOverlayName);
            mapControl.Overlays.Add(openStreetMapOverlay);

            BingMapsOverlay bingMapsAerialOverlay = new BingMapsOverlay();
            bingMapsAerialOverlay.Name = Resources.BingMapsAerialOverlayName;
            bingMapsAerialOverlay.TileHeight = 512;
            bingMapsAerialOverlay.TileWidth = 512;
            bingMapsAerialOverlay.MapType = BingMapsMapType.Aerial;
            bingMapsAerialOverlay.IsVisible = false;
            bingMapsAerialOverlay.TileCache = new FileBitmapTileCache(cacheFolder, Resources.BingMapsAerialOverlayName);
            mapControl.Overlays.Add(bingMapsAerialOverlay);

            BingMapsOverlay bingMapsRoadOverlay = new BingMapsOverlay();
            bingMapsRoadOverlay.Name = Resources.BingMapsRoadOverlayName;
            bingMapsRoadOverlay.TileHeight = 512;
            bingMapsRoadOverlay.TileWidth = 512;
            bingMapsRoadOverlay.MapType = BingMapsMapType.Road;
            bingMapsRoadOverlay.IsVisible = false;
            bingMapsRoadOverlay.TileCache = new FileBitmapTileCache(cacheFolder, Resources.BingMapsRoadOverlayName);
            mapControl.Overlays.Add(bingMapsRoadOverlay);

            LayerOverlay styleLayersOverLay = new LayerOverlay();
            styleLayersOverLay.TileType = TileType.SingleTile;
            mapControl.Overlays.Add(Resources.StyleLayerOverLayKey, styleLayersOverLay);

            ManagedProj4Projection wgs84ToMercatorProjection = new ManagedProj4Projection();
            wgs84ToMercatorProjection.InternalProjectionParametersString = ManagedProj4Projection.GetDecimalDegreesParametersString();
            wgs84ToMercatorProjection.ExternalProjectionParametersString = ManagedProj4Projection.GetSphericalMercatorParametersString();

            EarthquakeHeatFeatureLayer heatLayer = new EarthquakeHeatFeatureLayer(new ShapeFileFeatureSource(ConfigurationManager.AppSettings["DataShapefileFileName"]));
            heatLayer.HeatStyle = new HeatStyle(10, 100, Resources.MagnitudeColumnName, 0, 12, 100, DistanceUnit.Kilometer);
            heatLayer.FeatureSource.Projection = wgs84ToMercatorProjection;
            heatLayer.Name = Resources.HeatStyleLayerName;
            styleLayersOverLay.Layers.Add(heatLayer);

            ShapeFileFeatureLayer pointLayer = new ShapeFileFeatureLayer(ConfigurationManager.AppSettings["DataShapefileFileName"]);
            pointLayer.FeatureSource.Projection = wgs84ToMercatorProjection;
            pointLayer.Name = Resources.PointStyleLayerName;
            pointLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.CreateSimpleCircleStyle(GeoColor.StandardColors.Red, 6, GeoColor.StandardColors.White, 1);
            pointLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            styleLayersOverLay.Layers.Add(pointLayer);

            EarthquakeIsoLineFeatureLayer isoLineLayer = new EarthquakeIsoLineFeatureLayer(new ShapeFileFeatureSource(ConfigurationManager.AppSettings["DataShapefileFileName"]));
            isoLineLayer.FeatureSource.Projection = wgs84ToMercatorProjection;
            isoLineLayer.Name = Resources.IsolineStyleLayerName;
            styleLayersOverLay.Layers.Add(isoLineLayer);

            //Setup TarckOverlay.
            mapControl.TrackOverlay = new RadiusMearsureTrackInteractiveOverlay(DistanceUnit.Mile, mapControl.MapUnit);
            mapControl.TrackOverlay.TrackEnded += TrackOverlay_TrackEnded;

            LayerOverlay markerOverlay = new LayerOverlay();
            mapControl.Overlays.Add(Resources.MarkerOverlayKey, markerOverlay);

            PointStyle highLightStyle = new PointStyle();
            highLightStyle.CustomPointStyles.Add(PointStyles.CreateSimpleCircleStyle(GeoColor.FromArgb(50, GeoColor.SimpleColors.Blue), 20, GeoColor.SimpleColors.LightBlue, 1));
            highLightStyle.CustomPointStyles.Add(PointStyles.CreateSimpleCircleStyle(GeoColor.SimpleColors.LightBlue, 9, GeoColor.SimpleColors.Blue, 1));

            markerMemoryLayer = new InMemoryFeatureLayer();
            markerMemoryLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.CreateSimpleCircleStyle(GeoColor.SimpleColors.Orange, 8, GeoColor.SimpleColors.White, 1);
            markerMemoryLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            markerOverlay.Layers.Add(markerMemoryLayer);

            markerMemoryHighlightLayer = new InMemoryFeatureLayer();
            markerMemoryHighlightLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = highLightStyle;
            markerMemoryHighlightLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            markerOverlay.Layers.Add(markerMemoryHighlightLayer);

            ScaleBarAdornmentLayer scaleBarAdornmentLayer = new ScaleBarAdornmentLayer();
            scaleBarAdornmentLayer.UnitFamily = UnitSystem.Imperial;
            mapControl.AdornmentOverlay.Layers.Add(scaleBarAdornmentLayer);
        }
Exemple #39
0
        private static void DrawDotDensityStyle(PointStyle pointStyle, PlatformGeoCanvas canvas, DrawingRectangleF drawingRectangleF)
        {
            if (pointStyle == null)
            {
                return;
            }

            var    tmpSymbolSize     = pointStyle.SymbolSize;
            var    tmpSymbolPenWidth = pointStyle.SymbolPen.Width;
            var    tmpFontSize       = pointStyle.CharacterFont.Size;
            Bitmap originalBitmap    = null;
            Bitmap newBitmap         = null;

            try
            {
                var customerSymbolStyle = pointStyle as SymbolPointStyle;
                if (customerSymbolStyle != null)
                {
                    originalBitmap            = canvas.ToNativeImage(customerSymbolStyle.Image) as Bitmap;
                    newBitmap                 = new Bitmap(originalBitmap, 9, 9);
                    customerSymbolStyle.Image = canvas.ToGeoImage(newBitmap);
                }
                else
                {
                    pointStyle.SymbolSize      = 3;
                    pointStyle.SymbolPen.Width = 1;
                    pointStyle.CharacterFont   = new GeoFont(pointStyle.CharacterFont.FontName, 6, pointStyle.CharacterFont.Style);
                }

                var     halfWidth  = drawingRectangleF.Width * 0.5f;
                var     halfHeight = drawingRectangleF.Height * 0.5f;
                float[] centersX   = new float[7];
                float[] centersY   = new float[7];
                centersX[0] = halfWidth * 0.5f - 1;
                centersY[0] = halfHeight * 0.5f - 1;
                centersX[1] = centersX[0] + 2;
                centersY[1] = centersY[0] + 2;
                centersX[2] = halfWidth;
                centersY[2] = halfHeight;
                centersX[3] = halfWidth + halfWidth * 0.5f;
                centersY[3] = halfHeight;
                centersX[4] = halfWidth + halfWidth * 0.5f;
                centersY[4] = halfHeight + halfHeight * 0.5f;
                centersX[5] = centersX[4] - 1;
                centersY[5] = centersY[4] - 1;
                centersX[6] = centersX[4] + 1;
                centersY[6] = centersY[4] + 1;
                for (int i = 0; i < 7; i++)
                {
                    float centerX = centersX[i];
                    float centerY = centersY[i];
                    if (pointStyle != null)
                    {
                        pointStyle.DrawSample(canvas, new DrawingRectangleF(centerX, centerY, 11, 11));
                    }
                }

                if (originalBitmap != null)
                {
                    customerSymbolStyle.Image = canvas.ToGeoImage(originalBitmap);
                }
                else
                {
                    pointStyle.SymbolSize      = tmpSymbolSize;
                    pointStyle.SymbolPen.Width = tmpSymbolPenWidth;
                    pointStyle.CharacterFont   = new GeoFont(pointStyle.CharacterFont.FontName, tmpFontSize, pointStyle.CharacterFont.Style);
                }
            }
            finally
            {
                if (originalBitmap != null)
                {
                    originalBitmap.Dispose();
                }
                if (newBitmap != null)
                {
                    newBitmap.Dispose();
                }
            }
        }
 /// <summary>Draw a set of points with a given radius, style and color.</summary>
 /// <param name="points">Location of points in world coordinates.</param>
 /// <param name="style">Point display style.</param>
 /// <param name="radius">Point size in pixels.</param>
 /// <param name="color">
 /// Color of points. If style is ControlPoint, this will be the border color.
 /// </param>
 public void DrawPoints(System.Collections.Generic.IEnumerable<Point3d> points, PointStyle style, int radius, System.Drawing.Color color)
 {
   int count;
   Point3d[] ptArray = Collections.Point3dList.GetConstPointArray(points, out count);
   if (null == ptArray || count < 1)
     return;
   int argb = color.ToArgb();
   UnsafeNativeMethods.CRhinoDisplayPipeline_DrawPoints(m_ptr, count, ptArray, (int)style, radius, argb);
 }
        /// <summary>
        /// 获取要素信息
        /// </summary>
        /// <returns></returns>
        private CAppendFeature GetMapFeatureInfo(SFclsGeomType geoType)
        {
            CAppendFeature fInfo = new CAppendFeature();
            SFeature       sf    = new SFeature();

            sf.AttValue = new string[m_attStruct.FldNumber];
            for (int i = 0; i < m_attStruct.FldNumber; i++)
            {
                sf.AttValue[i] = m_textBoxArr[i].Text;
                switch (this.m_attStruct.FldType[i])
                {
                case "double":
                case "integer":
                case "long":
                case "short":
                    if (!CommFun.IsNumber(sf.AttValue[i]))
                    {
                        MessageBox.Show("字段【Fld_" + this.m_attStruct.FldName[i] + "】输入的数据格式不正确。请重新输入!", "提示", MessageBoxButton.OK);
                        return(null);
                    }
                    break;
                }
            }
            SFeatureGeometry sfGeo = null;
            SFclsGeomType    curFGeoType;

            if (m_targetGeo != null)
            {
                sfGeo = m_targetGeo as SFeatureGeometry;
                if (sfGeo == null) //add feature
                {
                    sfGeo = new SFeatureGeometry();
                    switch ((m_targetGeo as IWebGeometry).GetGeomType())
                    {
                    case WebGeomType.Point:
                        sf.ftype = SFclsGeomType.Pnt;
                        GPoint pnt = new GPoint();
                        pnt.Dot       = m_targetGeo as Dot_2D;
                        sfGeo.PntGeom = new GPoint[] { pnt };
                        break;

                    case WebGeomType.Line:
                        sf.ftype = SFclsGeomType.Lin;
                        GLine line = new GLine();
                        line.Line     = m_targetGeo as AnyLine;
                        sfGeo.LinGeom = new GLine[] { line };
                        break;

                    case WebGeomType.Polygon:
                        sf.ftype = SFclsGeomType.Reg;
                        GRegion polygon = new GRegion();
                        AnyLine circle  = new AnyLine();
                        circle.Arcs         = new Arc[1];
                        circle.Arcs[0]      = new Arc();
                        circle.Arcs[0].Dots = (m_targetGeo as ZDIMS.BaseLib.Polygon).Dots;
                        polygon.Rings       = new AnyLine[] { circle };
                        sfGeo.RegGeom       = new GRegion[] { polygon };
                        break;

                    default:
                        sfGeo = null;
                        break;
                    }
                }
            }
            curFGeoType = geoType;
            if (this.m_featureStyle == null)
            {
                this.m_featureStyle = new WebGraphicsInfo();
            }
            this.m_style.Update();
            switch (curFGeoType)
            {
            case SFclsGeomType.Pnt:
                this.m_featureStyle.InfoType = GInfoType.PntInfo;
                PointStyle newPntStyle = this.m_style as PointStyle;
                this.m_featureStyle.PntInfo = new CPointInfo();
                if (newPntStyle.patternAngle.Text == "")
                {
                    this.m_featureStyle.PntInfo.Angle = 0.0;
                }
                else
                {
                    this.m_featureStyle.PntInfo.Angle = Convert.ToDouble(newPntStyle.patternAngle.Text);
                }
                if (newPntStyle.patternColor._TextBoxInput.Text.Split(':')[0] == "")
                {
                    this.m_featureStyle.PntInfo.Color = 0;
                }
                else
                {
                    this.m_featureStyle.PntInfo.Color = Convert.ToInt32(newPntStyle.patternColor._TextBoxInput.Text.Split(':')[0]);
                }
                if (newPntStyle.patternHeight.Text == "")
                {
                    this.m_featureStyle.PntInfo.SymHeight = 0.0;
                }
                else
                {
                    this.m_featureStyle.PntInfo.SymHeight = Convert.ToDouble(newPntStyle.patternHeight.Text);
                }
                if (newPntStyle.patternID._TextBoxInput.Text.Split(':')[0] == "")
                {
                    this.m_featureStyle.PntInfo.SymID = 0;
                }
                else
                {
                    this.m_featureStyle.PntInfo.SymID = Convert.ToInt32(newPntStyle.patternID._TextBoxInput.Text.Split(':')[0]);
                }
                if (newPntStyle.patternWidth.Text == "")
                {
                    this.m_featureStyle.PntInfo.SymWidth = 0.0;
                }
                else
                {
                    this.m_featureStyle.PntInfo.SymWidth = Convert.ToDouble(newPntStyle.patternWidth.Text);
                }
                break;

            case SFclsGeomType.Lin:
                this.m_featureStyle.InfoType = GInfoType.LinInfo;
                LineStyle newLineStyle = this.m_style as LineStyle;
                this.m_featureStyle.LinInfo = new CLineInfo();
                if (newLineStyle.color._TextBoxInput.Text.Split(':')[0] == "")
                {
                    this.m_featureStyle.LinInfo.Color = 0;
                }
                else
                {
                    this.m_featureStyle.LinInfo.Color = Convert.ToInt32(newLineStyle.color._TextBoxInput.Text.Split(':')[0]);
                }
                if (newLineStyle.patternID._TextBoxInput.Text.Split(':')[0] == "")
                {
                    this.m_featureStyle.LinInfo.LinStyleID = 0;
                }
                else
                {
                    this.m_featureStyle.LinInfo.LinStyleID = Convert.ToInt32(newLineStyle.patternID._TextBoxInput.Text.Split(':')[0]);
                }
                if (newLineStyle.patternID2._TextBoxInput.Text.Split(':')[0] == "")
                {
                    this.m_featureStyle.LinInfo.LinStyleID2 = 0;
                }
                else
                {
                    this.m_featureStyle.LinInfo.LinStyleID2 = Convert.ToInt32(newLineStyle.patternID2._TextBoxInput.Text.Split(':')[0]);
                }
                if (newLineStyle.penWidth.Text == "")
                {
                    this.m_featureStyle.LinInfo.LinWidth = 0.0;
                }
                else
                {
                    this.m_featureStyle.LinInfo.LinWidth = Convert.ToDouble(newLineStyle.penWidth.Text);
                }
                if (newLineStyle.lineScaleX.Text == "")
                {
                    this.m_featureStyle.LinInfo.Xscale = 0.0;
                }
                else
                {
                    this.m_featureStyle.LinInfo.Xscale = Convert.ToDouble(newLineStyle.lineScaleX.Text);
                }
                if (newLineStyle.lineScaleY.Text == "")
                {
                    this.m_featureStyle.LinInfo.Yscale = 0.0;
                }
                else
                {
                    this.m_featureStyle.LinInfo.Yscale = Convert.ToDouble(newLineStyle.lineScaleY.Text);
                }
                break;

            case SFclsGeomType.Reg:
                this.m_featureStyle.InfoType = GInfoType.RegInfo;
                PolygonStyle newRegStyle = this.m_style as PolygonStyle;
                this.m_featureStyle.RegInfo = new CRegionInfo();
                if (newRegStyle.fillcolor._TextBoxInput.Text.Split(':')[0] == "")
                {
                    this.m_featureStyle.RegInfo.FillColor = 0;
                }
                else
                {
                    this.m_featureStyle.RegInfo.FillColor = Convert.ToInt32(newRegStyle.fillcolor._TextBoxInput.Text.Split(':')[0]);
                }
                if (newRegStyle.patternColor._TextBoxInput.Text.Split(':')[0] == "")
                {
                    this.m_featureStyle.RegInfo.PatColor = 0;
                }
                else
                {
                    this.m_featureStyle.RegInfo.PatColor = Convert.ToInt32(newRegStyle.patternColor._TextBoxInput.Text.Split(':')[0]);
                }
                if (newRegStyle.patternHeight.Text == "")
                {
                    this.m_featureStyle.RegInfo.PatHeight = 0.0;
                }
                else
                {
                    this.m_featureStyle.RegInfo.PatHeight = Convert.ToDouble(newRegStyle.patternHeight.Text);
                }
                if (newRegStyle.patternID._TextBoxInput.Text.Split(':')[0] == "")
                {
                    this.m_featureStyle.RegInfo.PatID = 0;
                }
                else
                {
                    this.m_featureStyle.RegInfo.PatID = Convert.ToInt32(newRegStyle.patternID._TextBoxInput.Text.Split(':')[0]);
                }
                if (newRegStyle.patternPenWidth.Text == "")
                {
                    this.m_featureStyle.RegInfo.OutPenWidth = 0.0;
                }
                else
                {
                    this.m_featureStyle.RegInfo.OutPenWidth = Convert.ToDouble(newRegStyle.patternPenWidth.Text);
                }
                if (newRegStyle.patternWidth.Text == "")
                {
                    this.m_featureStyle.RegInfo.PatWidth = 0.0;
                }
                else
                {
                    this.m_featureStyle.RegInfo.PatWidth = Convert.ToDouble(newRegStyle.patternWidth.Text);
                }
                break;
            }
            sf.fGeom         = sfGeo;
            sf.FID           = m_featureID;
            fInfo.GInfo      = this.m_featureStyle;
            fInfo.FSet       = sf;
            fInfo.GdbIndex   = ActiveLayerObj.ActiveGdbIndex;
            fInfo.LayerIndex = ActiveLayerObj.ActiveLayerIndex;
            return(fInfo);
        }
 public CustomStartEndLineStyle(PointStyle startPointStyle, PointStyle endPointStyle, LineStyle lineStyle)
 {
     _startPointStyle = startPointStyle;
     _endPointStyle = endPointStyle;
     _lineStyle = lineStyle;
 }
        internal static void EditAnnotationStyle <T>(AnnotaionStyleType annotationStyleType) where T : Style
        {
            AreaStyle areaStyle = (AreaStyle)(ViewModel.CurrentAnnotationOverlay.GetLatestStyle <AreaStyle>(AnnotaionStyleType.LayerStyle, false)).CloneDeep();

            areaStyle.Name = "Annotation Area Style";
            LineStyle lineStyle = (LineStyle)(ViewModel.CurrentAnnotationOverlay.GetLatestStyle <LineStyle>(AnnotaionStyleType.LayerStyle, false)).CloneDeep();

            lineStyle.Name = "Annotation Line Style";
            PointStyle pointStyle = (PointStyle)(ViewModel.CurrentAnnotationOverlay.GetLatestStyle <PointStyle>(AnnotaionStyleType.LayerStyle, false)).CloneDeep();

            pointStyle.Name = "Annotation Point Style";
            TextStyle textStyle = (TextStyle)(ViewModel.CurrentAnnotationOverlay.GetLatestStyle <TextStyle>(AnnotaionStyleType.LayerStyle, false)).CloneDeep();

            textStyle.Name = "Annotation Text Style";
            PointStyle fileLinkPointStyle = (PointStyle)(ViewModel.CurrentAnnotationOverlay.GetLatestStyle <PointStyle>(AnnotaionStyleType.FileLinkStyle, false)).CloneDeep();

            fileLinkPointStyle.Name = "File Link Point Style";
            TextStyle fileLinkTextStyle = (TextStyle)(ViewModel.CurrentAnnotationOverlay.GetLatestStyle <TextStyle>(AnnotaionStyleType.FileLinkStyle, false)).CloneDeep();

            fileLinkTextStyle.Name = "File Link Text Style";

            CompositeStyle compositeStyle = new CompositeStyle();

            compositeStyle.Styles.Add(areaStyle);
            compositeStyle.Styles.Add(lineStyle);
            compositeStyle.Styles.Add(pointStyle);
            compositeStyle.Styles.Add(textStyle);
            compositeStyle.Styles.Add(fileLinkPointStyle);
            compositeStyle.Styles.Add(fileLinkTextStyle);

            StyleBuilderArguments styleArguments = new StyleBuilderArguments();

            styleArguments.IsSubStyleReadonly       = true;
            styleArguments.AvailableUIElements      = StyleBuilderUIElements.StyleList;
            styleArguments.AvailableStyleCategories = StyleCategories.Area | StyleCategories.Line | StyleCategories.Point;
            styleArguments.StyleToEdit     = compositeStyle;
            styleArguments.FeatureLayer    = ViewModel.CurrentAnnotationOverlay.TrackShapeLayer;
            styleArguments.AppliedCallback = (result) =>
            {
                var AnnotationStyle = result.CompositeStyle;
                ViewModel.AnnotationPreview = AnnotationStyle.GetPreviewImage(32, 32);
            };

            var resultStyle = GisEditor.StyleManager.EditStyle(styleArguments);

            if (resultStyle != null && resultStyle.CompositeStyle != null)
            {
                var annotationStyle = resultStyle.CompositeStyle;
                foreach (var item in annotationStyle.Styles)
                {
                    if (item.Name == "Annotation Area Style" ||
                        item.Name == "Annotation Line Style" ||
                        item.Name == "Annotation Point Style" ||
                        item.Name == "Annotation Text Style")
                    {
                        ViewModel.CurrentAnnotationOverlay.ChangeAppliedStyle(item, AnnotaionStyleType.LayerStyle);
                    }
                    else if (item.Name == "File Link Point Style" || item.Name == "File Link Text Style")
                    {
                        ViewModel.CurrentAnnotationOverlay.ChangeAppliedStyle(item, AnnotaionStyleType.FileLinkStyle);
                    }
                }
                ViewModel.AnnotationPreview = annotationStyle.GetPreviewImage(32, 32);
            }
        }
Exemple #44
0
        public override Android.Content.Intent Execute(Android.Content.Context context)
        {
            String[]         titles = new String[] { "Crete Air Temperature", "Skiathos Air Temperature" };
            IList <double[]> x      = new List <double[]>();

            for (int i = 0; i < titles.Length; i++)
            {
                x.Add(new double[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 });
            }
            IList <double[]> values = new List <double[]>();

            values.Add(new double[] { 12.3, 12.5, 13.8, 16.8, 20.4, 24.4, 26.4, 26.1, 23.6, 20.3, 17.2, 13.9 });
            values.Add(new double[] { 9, 10, 11, 15, 19, 23, 26, 25, 22, 18, 13, 10 });
            int[]                    colors   = new int[] { Color.Green, Color.Rgb(200, 150, 0) };
            PointStyle[]             styles   = new PointStyle[] { PointStyle.Circle, PointStyle.Diamond };
            XYMultipleSeriesRenderer renderer = BuildRenderer(colors, styles);

            renderer.PointSize = 5.5f;
            int length = renderer.SeriesRendererCount;

            for (int i = 0; i < length; i++)
            {
                XYSeriesRenderer r = (XYSeriesRenderer)renderer.GetSeriesRendererAt(i);
                r.LineWidth  = 5;
                r.FillPoints = true;
            }
            SetChartSettings(renderer, "Weather data", "Month", "Temperature", 0.5, 12.5, 0, 40, Color.LightGray, Color.LightGray);
            renderer.XLabels = 12;
            renderer.YLabels = 10;
            renderer.SetShowGrid(true);
            renderer.XLabelsAlign = Android.Graphics.Paint.Align.Right;
            renderer.SetYLabelsAlign(Android.Graphics.Paint.Align.Right);
            renderer.ZoomButtonsVisible = true;
            renderer.SetPanLimits(new double[] { -10, 20, -10, 40 });
            renderer.SetZoomLimits(new double[] { -10, 20, -10, 40 });

            XYValueSeries sunSeries = new XYValueSeries("Sunshine hours");

            sunSeries.Add(1f, 35, 4.3);
            sunSeries.Add(2f, 35, 4.9);
            sunSeries.Add(3f, 35, 5.9);
            sunSeries.Add(4f, 35, 8.8);
            sunSeries.Add(5f, 35, 10.8);
            sunSeries.Add(6f, 35, 11.9);
            sunSeries.Add(7f, 35, 13.6);
            sunSeries.Add(8f, 35, 12.8);
            sunSeries.Add(9f, 35, 11.4);
            sunSeries.Add(10f, 35, 9.5);
            sunSeries.Add(11f, 35, 7.5);
            sunSeries.Add(12f, 35, 5.5);
            XYSeriesRenderer lightRenderer = new XYSeriesRenderer();

            lightRenderer.Color = Color.Yellow;

            XYSeries waterSeries = new XYSeries("Water Temperature");

            waterSeries.Add(1, 16);
            waterSeries.Add(2, 15);
            waterSeries.Add(3, 16);
            waterSeries.Add(4, 17);
            waterSeries.Add(5, 20);
            waterSeries.Add(6, 23);
            waterSeries.Add(7, 25);
            waterSeries.Add(8, 25.5);
            waterSeries.Add(9, 26.5);
            waterSeries.Add(10, 24);
            waterSeries.Add(11, 22);
            waterSeries.Add(12, 18);
            renderer.BarSpacing = 0.5;
            XYSeriesRenderer waterRenderer = new XYSeriesRenderer();

            waterRenderer.Color = Color.Argb(250, 0, 210, 250);

            XYMultipleSeriesDataset dataset = BuildDataset(titles, x, values);

            dataset.AddSeries(0, sunSeries);
            dataset.AddSeries(0, waterSeries);
            renderer.AddSeriesRenderer(0, lightRenderer);
            renderer.AddSeriesRenderer(0, waterRenderer);
            waterRenderer.DisplayChartValues  = true;
            waterRenderer.ChartValuesTextSize = 10;

            String[] types  = new String[] { "Bar", BubbleChart.Type, LineChart.Type, CubicLineChart.Type };
            Intent   intent = ChartFactory.GetCombinedXYChartIntent(context, dataset, renderer, types, "Weather parameters");

            return(intent);
        }
Exemple #45
0
        private void InitializeMap()
        {
            string targetDictionary = @"AppData/SampleData";

            Proj4Projection proj4    = Global.GetWgs84ToMercatorProjection();
            string          rootPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "/CacheImages";

            // WMK
            WorldMapKitOverlay wmkOverlay = new WorldMapKitOverlay();

            wmkOverlay.Projection = ThinkGeo.MapSuite.iOS.WorldMapKitProjection.SphericalMercator;

            // OSM
            OpenStreetMapOverlay osmOverlay = new OpenStreetMapOverlay();

            osmOverlay.TileCache = new FileBitmapTileCache(rootPath + "/OpenStreetMaps", "SphericalMercator");
            osmOverlay.TileCache.TileMatrix.BoundingBoxUnit = GeographyUnit.Meter;
            osmOverlay.TileCache.TileMatrix.BoundingBox     = osmOverlay.GetBoundingBox();
            osmOverlay.TileCache.ImageFormat = TileImageFormat.Jpeg;
            osmOverlay.IsVisible             = false;

            // Bing - Aerial
            BingMapsOverlay bingMapsAerialOverlay = new BingMapsOverlay();

            bingMapsAerialOverlay.MapStyle  = ThinkGeo.MapSuite.iOS.BingMapsMapType.AerialWithLabels;
            bingMapsAerialOverlay.TileCache = new FileBitmapTileCache(rootPath + "/BingMaps", "AerialWithLabels");
            bingMapsAerialOverlay.TileCache.TileMatrix.BoundingBoxUnit = GeographyUnit.Meter;
            bingMapsAerialOverlay.TileCache.TileMatrix.BoundingBox     = bingMapsAerialOverlay.GetBoundingBox();
            bingMapsAerialOverlay.TileCache.ImageFormat = TileImageFormat.Jpeg;
            bingMapsAerialOverlay.IsVisible             = false;

            // Bing - Road
            BingMapsOverlay bingMapsRoadOverlay = new BingMapsOverlay();

            bingMapsRoadOverlay.MapStyle  = ThinkGeo.MapSuite.iOS.BingMapsMapType.Road;
            bingMapsRoadOverlay.TileCache = new FileBitmapTileCache(rootPath + "/BingMaps", "Road");
            bingMapsRoadOverlay.TileCache.TileMatrix.BoundingBoxUnit = GeographyUnit.Meter;
            bingMapsRoadOverlay.TileCache.TileMatrix.BoundingBox     = bingMapsRoadOverlay.GetBoundingBox();
            bingMapsRoadOverlay.TileCache.ImageFormat = TileImageFormat.Jpeg;
            bingMapsRoadOverlay.IsVisible             = false;

            // Earthquake points
            ShapeFileFeatureLayer earthquakePointLayer = new ShapeFileFeatureLayer(Path.Combine(targetDictionary, "usEarthquake.shp"));

            earthquakePointLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(PointStyles.CreateSimpleCircleStyle(GeoColor.SimpleColors.Red, 5, GeoColor.SimpleColors.White, 1));
            earthquakePointLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            earthquakePointLayer.FeatureSource.Projection = proj4;

            ShapeFileFeatureSource earthquakeHeatFeatureSource = new ShapeFileFeatureSource(Path.Combine(targetDictionary, "usEarthquake_Simplified.shp"));

            earthquakeHeatFeatureSource.Projection = proj4;

            HeatLayer earthquakeHeatLayer = new HeatLayer(earthquakeHeatFeatureSource);

            earthquakeHeatLayer.HeatStyle       = new HeatStyle(10, 75, DistanceUnit.Kilometer);
            earthquakeHeatLayer.HeatStyle.Alpha = 180;
            earthquakeHeatLayer.IsVisible       = false;

            LayerOverlay highlightOverlay = new LayerOverlay();

            highlightOverlay.Layers.Add("EarthquakePointLayer", earthquakePointLayer);
            highlightOverlay.Layers.Add("EarthquakeHeatLayer", earthquakeHeatLayer);

            // Highlighted points
            InMemoryFeatureLayer selectedMarkerLayer = new InMemoryFeatureLayer();

            selectedMarkerLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle   = PointStyles.CreateSimpleCircleStyle(GeoColor.SimpleColors.Orange, 8, GeoColor.SimpleColors.White, 2);
            selectedMarkerLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            PointStyle highLightMarkerStyle = new PointStyle();

            highLightMarkerStyle.CustomPointStyles.Add(PointStyles.CreateSimpleCircleStyle(GeoColor.FromArgb(50, GeoColor.SimpleColors.Blue), 20, GeoColor.SimpleColors.LightBlue, 1));
            highLightMarkerStyle.CustomPointStyles.Add(PointStyles.CreateSimpleCircleStyle(GeoColor.FromArgb(255, 0, 122, 255), 10, GeoColor.SimpleColors.White, 2));

            InMemoryFeatureLayer highlightMarkerLayer = new InMemoryFeatureLayer();

            highlightMarkerLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle   = highLightMarkerStyle;
            highlightMarkerLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            highlightOverlay.Layers.Add("SelectMarkerLayer", selectedMarkerLayer);
            highlightOverlay.Layers.Add("HighlightMarkerLayer", highlightMarkerLayer);

            // Maps
            iOSMap                 = new MapView(View.Frame);
            iOSMap.MapUnit         = GeographyUnit.Meter;
            iOSMap.ZoomLevelSet    = new SphericalMercatorZoomLevelSet();
            iOSMap.CurrentExtent   = new RectangleShape(-19062735.6816748, 9273256.52450252, -5746827.16371793, 2673516.56066139);
            iOSMap.BackgroundColor = new UIColor(233, 229, 220, 200);

            iOSMap.Overlays.Add(Global.OpenStreetMapOverlayKey, osmOverlay);
            iOSMap.Overlays.Add(Global.WorldMapKitOverlayKey, wmkOverlay);
            iOSMap.Overlays.Add(Global.BingMapsAerialOverlayKey, bingMapsAerialOverlay);
            iOSMap.Overlays.Add(Global.BingMapsRoadOverlayKey, bingMapsRoadOverlay);
            iOSMap.Overlays.Add(Global.HighLightOverlayKey, highlightOverlay);

            iOSMap.TrackOverlay.TrackShapeLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Clear();
            iOSMap.TrackOverlay.TrackShapeLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.CreateSimpleCircleStyle(GeoColor.FromArgb(80, GeoColor.SimpleColors.LightGreen), 8);
            iOSMap.TrackOverlay.TrackShapeLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle  = LineStyles.CreateSimpleLineStyle(GeoColor.SimpleColors.White, 3, true);
            iOSMap.TrackOverlay.TrackShapeLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle  = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(80, GeoColor.SimpleColors.LightGreen), GeoColor.SimpleColors.White, 2);
            iOSMap.TrackOverlay.TrackEnded += TrackInteractiveOverlayOnTrackEnded;
            Global.MapView = iOSMap;

            View.Add(iOSMap);
            iOSMap.Refresh();
        }