public CurveInfo(Func<double, double> function, LineStyle style, string caption, bool invertFunc = false)
		{
			Function = function;
			Style = style;
			Caption = caption;
			InvertFunc = invertFunc;
		}
Exemple #2
0
		internal Style(Workbook wb, XfRecord xf) : base(wb)
		{	
			if(xf.FontIdx > 0 && xf.FontIdx < wb.Fonts.Count)
    	        _font = wb.Fonts[xf.FontIdx - 1];
		    _format = wb.Formats[xf.FormatIdx];
			_typeAndProtection = xf.TypeAndProtection;
			if(_typeAndProtection.IsCell)
				_parentStyle = wb.Styles[xf.ParentIdx];
			_horizontalAlignment = xf.HorizontalAlignment;
			_wrapped = xf.Wrapped;
			_verticalAlignment = xf.VerticalAlignment;
			_rotation = xf.Rotation;
			_indentLevel = xf.IndentLevel;
			_shrinkContent = xf.ShrinkContent;
			_parentStyleAttributes = xf.ParentStyle;
			_leftLineStyle = xf.LeftLineStyle;
			_rightLineStyle = xf.RightLineStyle;
			_topLineStyle = xf.TopLineStyle;
			_bottomLineStyle = xf.BottomLineStyle;
			_leftLineColor = wb.Palette.GetColor(xf.LeftLineColor);
			_rightLineColor = wb.Palette.GetColor(xf.RightLineColor);
			_diagonalRightTopToLeftBottom = xf.DiagonalRightTopToLeftBottom;
			_diagonalLeftBottomToTopRight = xf.DiagonalLeftBottomToTopRight;
			_topLineColor = wb.Palette.GetColor(xf.TopLineColor);
			_bottomLineColor = wb.Palette.GetColor(xf.BottomLineColor);
			_diagonalLineColor = wb.Palette.GetColor(xf.DiagonalLineColor);
			_diagonalLineStyle = xf.DiagonalLineStyle;
			_fillPattern = xf.FillPattern;
			_patternColor = wb.Palette.GetColor(xf.PatternColor);
			_patternBackground = wb.Palette.GetColor(xf.PatternBackground);
		}
 public BorderProperties(double? width = null, LineStyle style = null, string color = null)
 {
     Metric = MarkupMetric.Pixels;
     Width = width;
     Style = style;
     Color = color;
 }
 /// <summary>
 /// Gets the stroke dash array for a given <see cref="LineStyle"/>.
 /// </summary>
 /// <param name="style">
 /// The line style.
 /// </param>
 /// <returns>
 /// A dash array.
 /// </returns>
 public static double[] GetDashArray(LineStyle style)
 {
     switch (style)
     {
         case LineStyle.Solid:
             return null;
         case LineStyle.Dash:
             return new double[] { 4, 1 };
         case LineStyle.Dot:
             return new double[] { 1, 1 };
         case LineStyle.DashDot:
             return new double[] { 4, 1, 1, 1 };
         case LineStyle.DashDashDot:
             return new double[] { 4, 1, 4, 1, 1, 1 };
         case LineStyle.DashDotDot:
             return new double[] { 4, 1, 1, 1, 1, 1 };
         case LineStyle.DashDashDotDot:
             return new double[] { 4, 1, 4, 1, 1, 1, 1, 1 };
         case LineStyle.LongDash:
             return new double[] { 10, 1 };
         case LineStyle.LongDashDot:
             return new double[] { 10, 1, 1, 1 };
         case LineStyle.LongDashDotDot:
             return new double[] { 10, 1, 1, 1, 1, 1 };
         default:
             return null;
     }
 }
        /// <summary>
        /// Creates a new instance of the class.
        /// </summary>
        /// <param name="orientation">The orientation of the line.</param>
        /// <param name="lineStyle">The style of the line.</param>
        public SingleLine(Orientation orientation, LineStyle lineStyle)
        {
            this.Controls.Add(_ForeLine);
            this.BackColor = SystemColors.ButtonShadow;
            this.ForeColor = SystemColors.ButtonHighlight;
            this.TabStop = false;

            this.Disposed += new EventHandler(OnComponentDisposed);
            this.Resize += new EventHandler(OnComponentResize);
            this.ForeColorChanged += new EventHandler(OnComponentColorChanged);
            this.BackColorChanged += new EventHandler(OnComponentColorChanged);

            _Orientation = orientation;
            _LineStyle = lineStyle;
            _ForeLine.BorderStyle = BorderStyle.None;
            _ForeLine.Enabled = false;

            RefreshLine();
            OnComponentColorChanged(this, null);

            try
            {
                SystemEvents.UserPreferenceChanged += new UserPreferenceChangedEventHandler(OnVisualStyleChanged);
            }
            catch
            { }
        }
 public BorderProperties(double? width = null, LineStyle style = null, string color = null, MarkupMetric metric = null)
 {
     Width = width;
     Style = style;
     Color = color;
     Metric = metric;
 }
 protected OverlayShape(Color color, float width, LineStyle lineStyle)
 {
     Color = color;
     Width = width;
     LineStyle = lineStyle;
     _geos = new List<Geo>();
 }
Exemple #8
0
 public LineStyleArray()
 {
     Styles = new LineStyle[]
     {
         new LineStyle()
     };
 }
Exemple #9
0
 public Line(Point start, Point stop, LineType type, LineStyle style)
 {
     Start = start;
     Stop = stop;
     Type = type;
     Style = style;
 }
Exemple #10
0
 private Pen getContourPen(LineStyle style)
 {
      var result = new Pen(style.Color);
      result.Width = style.Width;
      result.DashStyle = style.DashStyle;
      return result;
 }
Exemple #11
0
 LineStyle CombineStyles(LineStyle one, LineStyle two)
 {
     if (one == LineStyle.Add || two == LineStyle.Add)
         return LineStyle.Add;
     if (one == LineStyle.Delete || two == LineStyle.Delete)
         return LineStyle.Delete;
     return LineStyle.Unchanged;
 }
        public OverlayLineSegment(Geo p1, Geo p2, Color color, float width, LineStyle lineStyle)
            : base(color, width, lineStyle)
        {
            Add(p1);
            Add(p2);

            Course = new Course(p1, p2);
            ComputeCoefficients();
        }
Exemple #13
0
        public LineStyleArray(SwfStream swf, bool hasAlpha, bool isExtended)
        {
            int count = swf.ReadByte();
            if (count == 0xFF) count = swf.ReadUShort();

            Styles = new LineStyle[count];
            for (int i = 0; i < count; i++)
                Styles[i] = new LineStyle(swf, hasAlpha, isExtended, i + 1);
        }
 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 override void OnStartEvent()
        {
            LineStyle lineStyle = new LineStyle();
            lineStyle.SetPatternStyle((int)EnumLinePattern.LP_DashedLine);
            lineStyle.SetColor(100, 0, 100);

            tempLineNode.SetLineStyle(lineStyle);

            this.ShowTempNode(tempLineNode);
            GetRenderer().RequestDraw(1);
        }
Exemple #16
0
 protected void ConfigureOGLLineProperties(LineStyle style, int width) { 
     int stipFact = 0; 
     short stipple = ILPanel.StippleFromLineStyle(style,ref stipFact); 
     GL.LineWidth(width); 
     if (style == LineStyle.Solid || style == LineStyle.None) {
         GL.Disable(EnableCap.LineStipple); 
     } else {
         GL.Enable(EnableCap.LineStipple); 
         GL.LineStipple (stipFact,stipple); 
     }
 }
        /// <summary>
        /// Determines if the given value represents a valid state of this property.
        /// </summary>
        /// <param name="value">The state that should be used.</param>
        /// <returns>True if the state is valid, otherwise false.</returns>
        protected override Boolean IsValid(CSSValue value)
        {
            var style = value.ToLineStyle();

            if (style.HasValue)
                _style = style.Value;
            else if (value != CSSValue.Inherit)
                return false;

            return true;
        }
 public OverlayLineSegments(ICollection<Geo> points, Color color, float size = 1f, LineStyle lineStyle = LineStyle.Solid)
     : base(color, size, lineStyle)
 {
     Segments = new List<OverlayLineSegment>();
     Add(points);
     if (points.Count < 2) return;
     CreateSegments();
     ComputeBoundingBox();
     CheckForClosure();
     CheckCrossingSegments();
 }
Exemple #19
0
		/// <summary>
		/// The constructor for the record.
		/// </summary>
		/// <param name="biff">The GenericBiff record that should contain the correct type and data for the XF record.</param>
		/// <exception cref="InvalidRecordIdException">
		/// An InvalidRecordIdException is thrown if biff contains an invalid type or invalid data.
		/// </exception>
		public XfRecord(GenericBiff biff) 
		{
			if(biff.Id == (ushort)RecordType.Xf)
			{
				BinaryReader reader = new BinaryReader(biff.GetDataStream());
				
				_fontIdx = reader.ReadUInt16();
				_formatIdx = reader.ReadUInt16();

				ushort data = reader.ReadUInt16();
				_typeAndProtection = new TypeAndProtection(data & 0x000F);
				_parentIdx = (ushort)((data & 0xFFF0) >> 8);

				byte data2 = reader.ReadByte();
				_horizontalAlignment = (HorizontalAlignment)(data2 & 0x07);
				_wrapped = (data & 0x088) != 0;
				_verticalAlignment = (VerticalAlignment)((data2 & 0x70) >> 4);
				
				data2 = reader.ReadByte();
				_rotation = new Rotation(data2);

				data2 = reader.ReadByte();
				_indentLevel = new Nibble((byte)(data2 & 0x0F));
				_shrinkContent = (data2 & 0x10) == 1;

				_parentStyle = (ParentStyleAttributes)(reader.ReadByte());
					
				uint data3 = reader.ReadUInt32();
				_leftLineStyle = (LineStyle)(data3 & 0x0000000F);
				_rightLineStyle = (LineStyle)((data3 & 0x000000F0) >> 1);
				_topLineStyle = (LineStyle)((data3 & 0x00000F00) >> 2);
				_bottomLineStyle = (LineStyle)((data3 & 0x0000F000) >> 3);
				_rightLineColor = (ushort)((data3 & 0x007F0000) >> 4);
				_leftLineColor = (ushort)((data3 & 0x3F800000) >> 5);
				_diagonalRightTopToLeftBottom = (data & 0x40000000) == 1;
				_diagonalLeftBottomToTopRight = (data & 0x80000000) == 1;

				data3 = reader.ReadUInt32();
				_topLineColor = (ushort)(data3 & 0x0000007F);
				_bottomLineColor = (ushort)((data3 & 0x00003F80) >> 1);
				_diagonalLineColor = (ushort)((data3 & 0x001FC000) >> 3);
				_diagonalLineStyle = (LineStyle)((data3 & 0x01E00000) >> 5);
				_fillPattern = (FillPattern)((data3 & 0xFC000000) >> 6);

				data = reader.ReadUInt16();
				_patternColor = (ushort)(data & 0x007F);
				_patternBackground = (ushort)((data & 0x3F80) >> 7);

				Debug.Assert(reader.BaseStream.Position == reader.BaseStream.Length);
			}
			else
				throw new InvalidRecordIdException(biff.Id, RecordType.Xf);
		}
 /// <summary>
 /// Initializes a new instance of the <see cref="OxyPen"/> class.
 /// </summary>
 /// <param name="color">
 /// The color.
 /// </param>
 /// <param name="thickness">
 /// The thickness.
 /// </param>
 /// <param name="lineStyle">
 /// The line style.
 /// </param>
 /// <param name="lineJoin">
 /// The line join.
 /// </param>
 public OxyPen(
     OxyColor color,
     double thickness = 1.0,
     LineStyle lineStyle = LineStyle.Solid,
     OxyPenLineJoin lineJoin = OxyPenLineJoin.Miter)
 {
     this.Color = color;
     this.Thickness = thickness;
     this.DashArray = LineStyleHelper.GetDashArray(lineStyle);
     this.LineStyle = lineStyle;
     this.LineJoin = lineJoin;
 }
Exemple #21
0
          public YLevel(string name, int order)
          {
            if (name.IsNullOrWhiteSpace()) name = Guid.NewGuid().ToString();

            m_Name = name;
            m_Order = order;
            Visible = true;
            AffectsScale = true;
            HLineStyle = new LineStyle{ Color = Color.FromArgb(240, 255, 100, 0), 
                                        Width = 1,
                                        DashStyle= System.Drawing.Drawing2D.DashStyle.Dot};
            ValueFormat = "n2";
          }
        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);
        }
Exemple #23
0
        /// <summary>
        /// Creates a new <see cref="ShapeStyle"/> instance.
        /// </summary>
        /// <param name="name">The shape style name.</param>
        /// <param name="sa">The stroke color alpha channel.</param>
        /// <param name="sr">The stroke color red channel.</param>
        /// <param name="sg">The stroke color green channel.</param>
        /// <param name="sb">The stroke color blue channel.</param>
        /// <param name="fa">The fill color alpha channel.</param>
        /// <param name="fr">The fill color red channel.</param>
        /// <param name="fg">The fill color green channel.</param>
        /// <param name="fb">The fill color blue channel.</param>
        /// <param name="thickness">The stroke thickness.</param>
        /// <param name="textStyle">The text style.</param>
        /// <param name="lineStyle">The line style.</param>
        /// <param name="startArrowStyle">The start arrow style.</param>
        /// <param name="endArrowStyle">The end arrow style.</param>
        /// <param name="lineCap">The line cap.</param>
        /// <param name="dashes">The line dashes.</param>
        /// <param name="dashOffset">The line dash offset.</param>
        /// <returns>The new instance of the <see cref="ShapeStyle"/> class.</returns>
        public static ShapeStyle Create(string name = "", byte sa = 0xFF, byte sr = 0x00, byte sg = 0x00, byte sb = 0x00, byte fa = 0xFF, byte fr = 0x00, byte fg = 0x00, byte fb = 0x00, double thickness = 2.0, TextStyle textStyle = null, LineStyle lineStyle = null, ArrowStyle startArrowStyle = null, ArrowStyle endArrowStyle = null, LineCap lineCap = LineCap.Round, string dashes = default(string), double dashOffset = 0.0)
        {
            var style = new ShapeStyle()
            {
                Name = name,
                Stroke = ArgbColor.Create(sa, sr, sg, sb),
                Fill = ArgbColor.Create(fa, fr, fg, fb),
                Thickness = thickness,
                LineCap = lineCap,
                Dashes = dashes,
                DashOffset = dashOffset,
                LineStyle = lineStyle ?? LineStyle.Create("Line"),
                TextStyle = textStyle ?? TextStyle.Create("Text")
            };

            style.StartArrowStyle = startArrowStyle ?? ArrowStyle.Create("Start", style);
            style.EndArrowStyle = endArrowStyle ?? ArrowStyle.Create("End", style);

            return style;
        }
Exemple #24
0
        public PlottableScatter PlotPoint(
            double x,
            double y,
            Color?color             = null,
            double markerSize       = 5,
            string label            = null,
            double?errorX           = null,
            double?errorY           = null,
            double errorLineWidth   = 1,
            double errorCapSize     = 3,
            MarkerShape markerShape = MarkerShape.filledCircle,
            LineStyle lineStyle     = LineStyle.Solid
            )
        {
            if (color == null)
            {
                color = settings.GetNextColor();
            }

            double[] errorXarray = (errorX != null) ? new double[] { (double)errorX } : null;
            double[] errorYarray = (errorY != null) ? new double[] { (double)errorY } : null;

            PlottableScatter scatterPlot = new PlottableScatter(
                xs: new double[] { x },
                ys: new double[] { y },
                color: (Color)color,
                lineWidth: 0,
                markerSize: markerSize,
                label: label,
                errorX: errorXarray,
                errorY: errorYarray,
                errorLineWidth: errorLineWidth,
                errorCapSize: errorCapSize,
                stepDisplay: false,
                markerShape: markerShape,
                lineStyle: lineStyle
                );

            settings.plottables.Add(scatterPlot);
            return(scatterPlot);
        }
Exemple #25
0
        /// <summary>
        /// Setup the map with the ThinkGeo Cloud Maps overlay. Also, add the friscoTrails and selectedLineLayer layers
        /// into a grouped LayerOverlay and display it on the map.
        /// </summary>
        protected override void OnAppearing()
        {
            base.OnAppearing();
            // Set the map's unit of measurement to meters(Spherical Mercator)
            mapView.MapUnit = GeographyUnit.Meter;

            // Add Cloud Maps as a background overlay
            var thinkGeoCloudVectorMapsOverlay = new ThinkGeoCloudVectorMapsOverlay("9ap16imkD_V7fsvDW9I8r8ULxgAB50BX_BnafMEBcKg~", "vtVao9zAcOj00UlGcK7U-efLANfeJKzlPuDB9nw7Bp4K4UxU_PdRDg~~", ThinkGeoCloudVectorMapsMapType.Light);

            thinkGeoCloudVectorMapsOverlay.VectorTileCache = new FileVectorTileCache(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "cache"), "CloudMapsVector");
            mapView.Overlays.Add(thinkGeoCloudVectorMapsOverlay);

            ShapeFileFeatureLayer friscoTrails      = new ShapeFileFeatureLayer(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Data/Shapefile/Hike_Bike.shp"));
            InMemoryFeatureLayer  selectedLineLayer = new InMemoryFeatureLayer();
            LayerOverlay          layerOverlay      = new LayerOverlay();

            // Project friscoTrails layer to Spherical Mercator to match the map projection
            friscoTrails.FeatureSource.ProjectionConverter = new ProjectionConverter(2276, 3857);

            // Style friscoTrails layer
            friscoTrails.ZoomLevelSet.ZoomLevel01.DefaultLineStyle    = LineStyle.CreateSimpleLineStyle(GeoColors.Orange, 2, false);
            friscoTrails.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            // Style selectedLineLayer
            selectedLineLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle    = LineStyle.CreateSimpleLineStyle(GeoColors.Green, 2, false);
            selectedLineLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            // Add friscoTrails layer to a LayerOverlay
            layerOverlay.Layers.Add("friscoTrails", friscoTrails);

            // Add selectedLineLayer to the layerOverlay
            layerOverlay.Layers.Add("selectedLineLayer", selectedLineLayer);

            // Set the map extent
            mapView.CurrentExtent = new RectangleShape(-10782307.6877106, 3918904.87378907, -10774377.3460701, 3912073.31442403);

            // Add LayerOverlay to Map
            mapView.Overlays.Add("layerOverlay", layerOverlay);

            mapView.Refresh();
        }
Exemple #26
0
        public void DrawPolygon(Polygon polygon, FillStyle fillStyle, LineStyle lineStyle,
                                PointStyle vertexStyle, bool fast)
        {
            Polygon viewPolygon = (Polygon)Viewport.GetViewGeometry(polygon);

            AM.PathGeometry          geometry        = new AM.PathGeometry();
            AM.StreamGeometryContext geometryContext = geometry.Open();
            DrawPolygonRing(viewPolygon.Shell, false, geometryContext);
            foreach (LinearRing hole in viewPolygon.Holes)
            {
                DrawPolygonRing(hole, true, geometryContext);
            }
            m_Context.DrawGeometry(new SolidColorBrush(fillStyle.Color.Argb),
                                   new Pen(new SolidColorBrush(lineStyle.Color.Argb)),
                                   geometry);
            DrawCoordinates(viewPolygon.Shell.Coordinates, vertexStyle, fast, true);
            foreach (LinearRing hole in viewPolygon.Holes)
            {
                DrawCoordinates(hole.Coordinates, vertexStyle, fast, true);
            }
        }
Exemple #27
0
        private static void InsertTractorFlasgs(Slide slide)
        {
            const float flagTopPostion           = 690;
            const float flagWidth                = 20;
            const float flagHeight               = 20;
            const float leftPostionChangingDelta = 25;
            const float flagsQuantity            = 5;

            var lineStyle = new LineStyle(Color.Red, thickness: 0);
            var fillStyle = new BaseStyle(Color.Red);

            float leftPosition = 375;

            for (int i = 0; i < flagsQuantity; i++)
            {
                var frame = new Rect(left: leftPosition, flagTopPostion, flagWidth, flagHeight);
                slide.InsertShape(new Triangle(frame, lineStyle, fillStyle), 0);

                leftPosition -= leftPostionChangingDelta;
            }
        }
 private static PlotModel CreateGridlinesModel(string title, LineStyle horizontal, LineStyle vertical)
 {
     var model = new PlotModel { Title = "Gridlines: " + title };
     model.Axes.Add(new LinearAxis
     {
         Position = AxisPosition.Bottom,
         MajorGridlineStyle = vertical,
         MinorGridlineStyle = vertical == LineStyle.Solid ? LineStyle.Dot : LineStyle.None,
         MaximumPadding = 0,
         MinimumPadding = 0
     });
     model.Axes.Add(new LinearAxis
     {
         Position = AxisPosition.Left,
         MajorGridlineStyle = horizontal,
         MinorGridlineStyle = horizontal == LineStyle.Solid ? LineStyle.Dot : LineStyle.None,
         MaximumPadding = 0,
         MinimumPadding = 0
     });
     return model;
 }
Exemple #29
0
        private LineStyle ReadLineStyle(SWFDataTypeReader shapeReader, Tag format)
        {
            LineStyle ls = new LineStyle();

            ls.Width = shapeReader.ReadUI16();

            if (format == Tag.DefineShape || format == Tag.DefineShape2)
            {
                ls.Colour = shapeReader.ReadRGB();
            }
            else if (format == Tag.DefineShape3 || format == Tag.DefineShape4)
            {
                ls.Colour = shapeReader.ReadRGBA();
            }
            else
            {
                throw new SWFModellerException(SWFModellerError.Internal, "Can't line style in shape format " + format.ToString());
            }

            return(ls);
        }
 public static System.Windows.Media.DoubleCollection GetStrokeDashArray(this LineStyle style)
 {
     if (style.HasFlag(LineStyle.Dotted))
     {
         return new System.Windows.Media.DoubleCollection {
                    1.0, 2.0, 1.0, 2.0
         }
     }
     ;
     else if (style.HasFlag(LineStyle.Dashed))
     {
         return new System.Windows.Media.DoubleCollection {
                    3.0, 3.0, 3.0, 3.0
         }
     }
     ;
     else
     {
         return(null);
     }
 }
Exemple #31
0
 public ScatterPlot PlotLine(
     double x1,
     double y1,
     double x2,
     double y2,
     Color?color         = null,
     double lineWidth    = 1,
     string label        = null,
     LineStyle lineStyle = LineStyle.Solid
     )
 {
     return(PlotScatter(
                xs: new double[] { x1, x2 },
                ys: new double[] { y1, y2 },
                color: color,
                lineWidth: lineWidth,
                label: label,
                lineStyle: lineStyle,
                markerSize: 0
                ));
 }
Exemple #32
0
        private void rbLineStyle_CheckedChanged(object sender, EventArgs e)
        {
            if (mapView.Overlays.Count > 0)
            {
                LayerOverlay          layerOverlay   = (LayerOverlay)mapView.Overlays["overlay"];
                ShapeFileFeatureLayer friscoRailroad = (ShapeFileFeatureLayer)layerOverlay.Layers["Railroad"];

                // Create a line style
                var lineStyle = new LineStyle(new GeoPen(GeoBrushes.DimGray, 10), new GeoPen(GeoBrushes.WhiteSmoke, 6));

                // Add the line style to the collection of custom styles for ZoomLevel 1.
                friscoRailroad.ZoomLevelSet.ZoomLevel01.CustomStyles.Clear();
                friscoRailroad.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(lineStyle);

                // Apply the styles for ZoomLevel 1 down to ZoomLevel 20. This effectively applies the line style on every zoom level on the map.
                friscoRailroad.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

                // Refresh the layerOverlay to show the new style
                layerOverlay.Refresh();
            }
        }
Exemple #33
0
        public LineFormat(IStreamReader reader, GraphRecordNumber id, ushort length)
            : base(reader, id, length)
        {
            // assert that the correct record type is instantiated
            Debug.Assert(this.Id == ID);

            // initialize class members from stream
            this.rgb = new RGBColor(reader.ReadInt32(), RGBColor.ByteOrder.RedFirst);
            this.lns = (LineStyle)reader.ReadInt16();
            this.we  = (LineWeight)reader.ReadInt16();
            ushort flags = reader.ReadUInt16();

            this.fAuto = Utils.BitmaskToBool(flags, 0x1);
            // 0x2 is reserved
            this.fAxisOn = Utils.BitmaskToBool(flags, 0x4);
            this.fAutoCo = Utils.BitmaskToBool(flags, 0x8);
            this.icv     = reader.ReadUInt16();

            // assert that the correct number of bytes has been read from the stream
            Debug.Assert(this.Offset + this.Length == this.Reader.BaseStream.Position);
        }
        private void mapView_Loaded(object sender, RoutedEventArgs e)
        {
            var tinyGeoFeatureLayer = new TinyGeoFeatureLayer(SampleHelper.Get("Frisco.tgeo"));

            tinyGeoFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle    = LineStyle.CreateSimpleLineStyle(GeoColors.Black, 1, true);
            tinyGeoFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            tinyGeoFeatureLayer.Open();
            var currentExtent = tinyGeoFeatureLayer.GetBoundingBox();

            tinyGeoFeatureLayer.Close();

            var layerOverlay = new LayerOverlay();

            layerOverlay.Layers.Add(tinyGeoFeatureLayer);

            mapView.Overlays.Add(layerOverlay);
            mapView.MapUnit       = GeographyUnit.DecimalDegree;
            mapView.CurrentExtent = currentExtent;
            mapView.Refresh();
        }
        public override void StrokePath(double strokeWidth, int color, LineStyle lineStyle)
        {
            if (color != _lastStrokingColor)
            {
                _lastStrokingColor = color;
                float r = ColorScale * ((color >> 16) & 0xff);
                float g = ColorScale * ((color >> 8) & 0xff);
                float b = ColorScale * ((color >> 8) & 0xff);
                _canvas.SetStrokeColorRgb(r, g, b);
            }
            if (lineStyle != _lastLineStyle ||
                (lineStyle != LineStyle.Solid && strokeWidth != _lastLineWidth))
            {
                _lastLineStyle = lineStyle;
                float[] pattern;
                switch (lineStyle)
                {
                case LineStyle.Dashed:
                    pattern = new float[] { 4 * (float)strokeWidth };
                    break;

                case LineStyle.Dotted:
                    pattern = new float[] { 0, 3 * (float)strokeWidth };
                    break;

                default:
                    pattern = new float[] { };
                    break;
                }
                _canvas.SetLineCapStyle(lineStyle == LineStyle.Dotted ? 1 : 0);
                _canvas.SetLineDash(pattern, 0);
            }
            if (strokeWidth != _lastLineWidth)
            {
                _lastLineWidth = strokeWidth;
                _canvas.SetLineWidth((float)strokeWidth);
            }

            _canvas.Stroke();
        }
Exemple #36
0
        public void LoadSettings()
        {
            string filename = System.Windows.Forms.Application.StartupPath + "/mview.ini";

            if (System.IO.File.Exists(filename))
            {
                using (TextReader text = new StreamReader(filename))
                {
                    AxisXStyle = (LineStyle)Enum.Parse(typeof(LineStyle), text.ReadLine(), true);
                    AxisXWidth = Int32.Parse(text.ReadLine());
                    AxisXColor = System.Drawing.Color.FromArgb(Int32.Parse(text.ReadLine()));

                    AxisYStyle = (LineStyle)Enum.Parse(typeof(LineStyle), text.ReadLine(), true);
                    AxisYWidth = Int32.Parse(text.ReadLine());
                    AxisYColor = System.Drawing.Color.FromArgb(Int32.Parse(text.ReadLine()));

                    LegendPosition = (OxyPlot.Legends.LegendPosition)Enum.Parse(typeof(OxyPlot.Legends.LegendPosition), text.ReadLine(), true);

                    int count = Int32.Parse(text.ReadLine());

                    for (int iw = 0; iw < count; ++iw)
                    {
                        var tmp_style = new SeriesStyle();
                        tmp_style.Name            = text.ReadLine();
                        tmp_style.LineColor       = System.Drawing.Color.FromArgb(Int32.Parse(text.ReadLine()));
                        tmp_style.MarkerColor     = System.Drawing.Color.FromArgb(Int32.Parse(text.ReadLine()));
                        tmp_style.MarkerFillColor = System.Drawing.Color.FromArgb(Int32.Parse(text.ReadLine()));
                        tmp_style.MarkerSize      = Int32.Parse(text.ReadLine());
                        tmp_style.LineWidth       = Int32.Parse(text.ReadLine());
                        tmp_style.LineSmooth      = Boolean.Parse(text.ReadLine());
                        tmp_style.MarkerType      = (MarkerType)Enum.Parse(typeof(MarkerType), text.ReadLine(), true);
                        tmp_style.LineStyle       = (LineStyle)Enum.Parse(typeof(LineStyle), text.ReadLine(), true);
                        tmp_style.GroupMode       = (GroupMode)Enum.Parse(typeof(GroupMode), text.ReadLine(), true);

                        listSeriesStyle.Add(tmp_style);
                    }
                    text.Close();
                }
            }
        }
        /// <summary>
        ///     Releases or completely removes a resource.
        /// </summary>
        /// <param name="style">The style.</param>
        /// <param name="release">if set to <see langword="true" /> the resource will be released instead of completely removed.</param>
        private bool ReleaseRemove(LineStyle style, bool release)
        {
            if (style == null)
            {
                throw new ArgumentNullException(nameof(style));
            }

            if (_pens == null)
            {
                throw new ObjectDisposedException(nameof(GDIResourceManager));
            }
            lock (_lock)
            {
                if (_pens == null)
                {
                    throw new ObjectDisposedException(nameof(GDIResourceManager));
                }

                Release(style.Style);

                Resource <Pen> pen;
                switch (_pens.Remove(style, out pen, release ? true : (bool?)null))
                {
                case Removed.NotFound:
                    return(false);

                case Removed.Removed:
                    return(true);

                case Removed.RemovedLast:
                    Debug.Assert(pen != null, "pen != null");
                    pen.Dispose();
                    return(true);

                default:
                    Debug.Fail("Unexpected value");
                    throw new ArgumentOutOfRangeException();
                }
            }
        }
        private void sampleFileListBox_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
        {
            GpxFeatureLayer shapeLayer = new GpxFeatureLayer(SampleHelper.Get(sampleFileListBox.SelectedItem.ToString()));

            shapeLayer.FeatureSource.ProjectionConverter = projectionConverter;

            ValueStyle pointStyle = new ValueStyle();

            pointStyle.ColumnName = "IsWayPoint";
            pointStyle.ValueItems.Add(new ValueItem("0", PointStyle.CreateSimplePointStyle(PointSymbolType.Circle, GeoColors.Red, 4)));
            pointStyle.ValueItems.Add(new ValueItem("1", PointStyle.CreateSimplePointStyle(PointSymbolType.Circle, GeoColors.Green, 8)));
            LineStyle roadstyle = LineStyle.CreateSimpleLineStyle(GeoColors.Black, 1, true);

            shapeLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(pointStyle);
            shapeLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(roadstyle);
            shapeLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            GpxFeatureLayer textLayer = new GpxFeatureLayer(SampleHelper.Get(sampleFileListBox.SelectedItem.ToString()));

            textLayer.FeatureSource.ProjectionConverter = projectionConverter;
            TextStyle labelStyle = TextStyle.CreateSimpleTextStyle("name", "Arial", 8, DrawingFontStyles.Bold, GeoColors.Black);

            labelStyle.TextPlacement   = TextPlacement.Upper;
            labelStyle.OverlappingRule = LabelOverlappingRule.NoOverlapping;
            labelStyle.YOffsetInPixel  = 8;

            textLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(labelStyle);
            textLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            shapeLayer.Open();
            mapView.CurrentExtent = (shapeLayer.GetBoundingBox());

            var gpsOverlay = (LayerOverlay)mapView.Overlays["GPSOverlay"];

            gpsOverlay.Layers.Clear();
            gpsOverlay.Layers.Add(shapeLayer);
            gpsOverlay.Layers.Add(textLayer);

            mapView.Refresh();
        }
Exemple #39
0
    public void SetLine(Vector3 start, Vector3 end, LineStyle style)
    {
        lire.material = style.material;

        if (!style.Dashed)
        {
            lire.startWidth = style.width;
            lire.endWidth   = style.width;

            lire.numPositions = 2;
            lire.SetPositions(new Vector3[] { start, end });
        }
        else
        {
            float lineLength = Vector3.Distance(start, end);
            int   divisions  = Mathf.RoundToInt(lineLength / style.dashLength);

            List <Vector3> pos = new List <Vector3>();
            AnimationCurve w   = new AnimationCurve();

            for (int i = 0; i < divisions; i++)
            {
                float t1 = i / (float)divisions;
                float t2 = (i + 1) / (float)divisions;

                float wi = (i % 6 < 3) ? 1f : 0;

                pos.Add(Vector3.Lerp(start, end, t1));
                pos.Add(Vector3.Lerp(start, end, t1 + 0.0001f));
                pos.Add(Vector3.Lerp(start, end, t2));
                w.AddKey(t1, wi);
                w.AddKey(t1 + 0.0001f, wi);
                w.AddKey(t2, wi);
            }
            lire.numPositions = pos.Count;
            lire.SetPositions(pos.ToArray());
            lire.widthMultiplier = style.width;
            lire.widthCurve      = w;
        }
    }
Exemple #40
0
        public PlottableScatter PlotPoint(
            double x,
            double y,
            Color?color             = null,
            double markerSize       = 5,
            string label            = null,
            double?errorX           = null,
            double?errorY           = null,
            double errorLineWidth   = 1,
            double errorCapSize     = 3,
            MarkerShape markerShape = MarkerShape.filledCircle,
            LineStyle lineStyle     = LineStyle.Solid
            )
        {
            if (color == null)
            {
                color = settings.GetNextColor();
            }

            var scatterPlot = new PlottableScatter(
                xs: new double[] { x },
                ys: new double[] { y },
                errorX: (errorX is null) ? null : new double[] { (double)errorX },
                errorY: (errorY is null) ? null : new double[] { (double)errorY }
                )
            {
                color          = (Color)color,
                lineWidth      = 0,
                markerSize     = (float)markerSize,
                label          = label,
                errorLineWidth = (float)errorLineWidth,
                errorCapSize   = (float)errorCapSize,
                stepDisplay    = false,
                markerShape    = markerShape,
                lineStyle      = lineStyle
            };

            Add(scatterPlot);
            return(scatterPlot);
        }
Exemple #41
0
        internal virtual void DrawItem(AdvancedDropdownItem item, string name, Texture2D icon, bool enabled, bool drawArrow, bool selected, bool hasSearch)
        {
            GUIContent content = new GUIContent(name, icon);
            Texture    imgTemp = content.image;

            //we need to pretend we have an icon to calculate proper width in case
            if (content.image == null)
            {
                content.image = Texture2D.whiteTexture;
            }
            Rect rect = GUILayoutUtility.GetRect(content, LineStyle, GUILayout.ExpandWidth(true));

            content.image = imgTemp;

            if (Event.current.type != EventType.Repaint)
            {
                return;
            }

            Texture imageTemp = content.image;

            if (content.image == null)
            {
                LineStyle.Draw(rect, GUIContent.none, false, false, selected, selected);
                rect.x     += IconSize.x + 1;
                rect.width -= IconSize.x + 1;
            }

            EditorGUI.BeginDisabledGroup(!enabled);
            LineStyle.Draw(rect, content, false, false, selected, selected);
            content.image = imageTemp;
            if (drawArrow)
            {
                float size      = LineStyle.lineHeight;
                Rect  arrowRect = new Rect(rect.x + rect.width - size, rect.y, size, size);
                LineStyle.Draw(arrowRect, Styles.arrowRightContent, false, false, false, false);
            }

            EditorGUI.EndDisabledGroup();
        }
Exemple #42
0
        public PlottableSignal(double[] ys, double sampleRate, double xOffset, double yOffset, Color color, double lineWidth, double markerSize, string label, Color[] colorByDensity, int maxRenderIndex, LineStyle lineStyle, bool useParallel)
        {
            if (ys == null)
            {
                throw new Exception("Y data cannot be null");
            }

            this.ys           = ys;
            this.sampleRate   = sampleRate;
            this.samplePeriod = 1.0 / sampleRate;
            this.markerSize   = (float)markerSize;
            this.xOffset      = xOffset;
            this.label        = label;
            this.color        = color;
            this.lineWidth    = lineWidth;
            this.yOffset      = yOffset;
            if ((maxRenderIndex > ys.Length - 1) || maxRenderIndex < 0)
            {
                throw new ArgumentException("maxRenderIndex must be a valid index for ys[]");
            }
            this.maxRenderIndex = maxRenderIndex;
            this.lineStyle      = lineStyle;
            this.useParallel    = useParallel;
            brush = new SolidBrush(color);
            penLD = GDI.Pen(color, (float)lineWidth, lineStyle, true);
            penHD = GDI.Pen(color, (float)lineWidth, LineStyle.Solid, true);

            if (colorByDensity != null)
            {
                // turn the ramp into a pen triangle
                densityLevelCount = colorByDensity.Length * 2 - 1;
                penByDensity      = new Pen[densityLevelCount];
                for (int i = 0; i < colorByDensity.Length; i++)
                {
                    penByDensity[i] = new Pen(colorByDensity[i]);
                    penByDensity[densityLevelCount - 1 - i] = new Pen(colorByDensity[i]);
                }
            }
        }
Exemple #43
0
        public void SetStrokeStyle(SvgGraphicsElement graphicsElement)
        {
            var style = graphicsElement?.Style;

            _strokeColor = graphicsElement != null && _pageViewport != null
                ? SvgPaintServerToDynamicPdfColorConverter.ConvertToColor(graphicsElement.CreateStrokePaintServer(), _pageViewport, _pageHeight, graphicsElement, _spotColorOverride)
                : null;

            _strokeWidth = _strokeColor != null ? graphicsElement?.StrokeWidth ?? 0 : 0;
            _lineJoin    = style?.StrokeLineJoin.ConvertToDynamicPdf() ?? LineJoin.Miter;
            _miterLimit  = style?.StrokeMiterLimit ?? 1f;
            _lineCap     = style?.StrokeLineCap.ConvertToDynamicPdf() ?? LineCap.Butt;
            _strokeStyle = LineStyle.Solid;

            var dashArray = style?.StrokeDashArray.Value;

            if (dashArray?.Length > 0)
            {
                var dashValues = dashArray.Select(i => i.Value).ToArray();
                _strokeStyle = new LineStyle(dashValues, style.StrokeDashOffset.Value.Value);
            }
        }
        public SimpleLineStylePlugin()
            : base()
        {
            IsDefault       = true;
            Name            = GisEditor.LanguageManager.GetStringResource("SimpleLineStyleName");
            Description     = GisEditor.LanguageManager.GetStringResource("SimpleLineStylePluginDescription");
            SmallIcon       = new BitmapImage(new Uri("/GisEditorPluginCore;component/Images/styles_simpleline.png", UriKind.RelativeOrAbsolute));
            LargeIcon       = new BitmapImage(new Uri("/GisEditorPluginCore;component/Images/styles_simpleline.png", UriKind.RelativeOrAbsolute));
            Index           = StylePluginOrder.SimpleStyle;
            StyleCategories = StyleCategories.Line;

            LineStyle lineStyle = new LineStyle
            {
                Name      = GisEditor.LanguageManager.GetStringResource("AnnotationStylesRibbonGroupLineStyleLabel"),
                OuterPen  = new GeoPen(GeoColor.SimpleColors.Black, 1),
                InnerPen  = new GeoPen(GeoColor.StandardColors.Transparent, 1),
                CenterPen = new GeoPen(GeoColor.StandardColors.Transparent, 1),
            };

            StyleCandidates.Add(lineStyle);
            lineStyleOption = new StyleSetting(this);
        }
Exemple #45
0
        private void Form_Load(object sender, EventArgs e)
        {
            // Set the map's unit of measurement to meters(Spherical Mercator)
            mapView.MapUnit = GeographyUnit.Meter;

            // Add Cloud Maps as a background overlay
            var thinkGeoCloudVectorMapsOverlay = new ThinkGeoCloudVectorMapsOverlay("itZGOI8oafZwmtxP-XGiMvfWJPPc-dX35DmESmLlQIU~", "bcaCzPpmOG6le2pUz5EAaEKYI-KSMny_WxEAe7gMNQgGeN9sqL12OA~~", ThinkGeoCloudVectorMapsMapType.Light);

            mapView.Overlays.Add(thinkGeoCloudVectorMapsOverlay);

            InMemoryFeatureLayer railway      = new InMemoryFeatureLayer();
            InMemoryFeatureLayer subLineLayer = new InMemoryFeatureLayer();
            LayerOverlay         layerOverlay = new LayerOverlay();

            // Add the rail line feature to the railway layer
            railway.InternalFeatures.Add(new Feature("LineString (-10776730.91861553490161896 3925750.69222266925498843, -10778989.31895966082811356 3915278.00731692276895046, -10781766.12723691388964653 3909228.15506267035380006, -10782065.98029803484678268 3907458.59967381786555052, -10781867.48601813986897469 3905465.21030976390466094)"));

            // Style railway layer
            railway.ZoomLevelSet.ZoomLevel01.DefaultLineStyle    = LineStyle.CreateSimpleLineStyle(GeoColors.Red, 2, false);
            railway.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            // Style the subLineLayer
            subLineLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle    = LineStyle.CreateSimpleLineStyle(GeoColors.Green, 2, false);
            subLineLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            // Add railway to the layerOverlay
            layerOverlay.Layers.Add("railway", railway);

            // Add subLineLayer to the layerOverlay
            layerOverlay.Layers.Add("subLineLayer", subLineLayer);

            // Set the map extent to the railway layer bounding box
            railway.Open();
            mapView.CurrentExtent = railway.GetBoundingBox();
            railway.Close();

            // Add LayerOverlay to Map
            mapView.Overlays.Add("layerOverlay", layerOverlay);
        }
        /// <summary>
        /// Draws the polygon within the specified clipping rectangle.
        /// </summary>
        /// <param name="rc">The render context.</param>
        /// <param name="clippingRectangle">The clipping rectangle.</param>
        /// <param name="points">The points.</param>
        /// <param name="minDistSquared">The squared minimum distance between points.</param>
        /// <param name="fill">The fill color.</param>
        /// <param name="stroke">The stroke color.</param>
        /// <param name="strokeThickness">The stroke thickness.</param>
        /// <param name="lineStyle">The line style.</param>
        /// <param name="lineJoin">The line join.</param>
        /// <param name="aliased">The aliased.</param>
        public static void DrawClippedPolygon(
            this IRenderContext rc,
            OxyRect clippingRectangle,
            IList <ScreenPoint> points,
            double minDistSquared,
            OxyColor fill,
            OxyColor stroke,
            double strokeThickness = 1.0,
            LineStyle lineStyle    = LineStyle.Solid,
            LineJoin lineJoin      = LineJoin.Miter,
            bool aliased           = false)
        {
            var n = points.Count;

            if (n == 0)
            {
                return;
            }

            if (lineStyle == LineStyle.None)
            {
                return;
            }

            var outputBuffer = new List <ScreenPoint>();

            ReducePoints(points, minDistSquared, outputBuffer);

            if (rc.SetClip(clippingRectangle))
            {
                rc.DrawPolygon(outputBuffer, fill, stroke, strokeThickness, lineStyle.GetDashArray(), lineJoin, aliased);
                rc.ResetClip();
                return;
            }

            var clippedPoints = SutherlandHodgmanClipping.ClipPolygon(clippingRectangle, outputBuffer);

            rc.DrawPolygon(clippedPoints, fill, stroke, strokeThickness, lineStyle.GetDashArray(), lineJoin, aliased);
        }
Exemple #47
0
        public ControlLinesRenderer(DependencyObject target)
        {
            this._target = target;
            if (this._target != null)
            {
                Brush  brush         = this._target.GetValue(ControlLinesRenderer.LineBrushProperty) as Brush;
                object thincknessobj = this._target.GetValue(ControlLinesRenderer.LineThicknessProperty);
                object linestyleobj  = this._target.GetValue(ControlLinesRenderer.LineStyleProperty);

                if (brush != null &&
                    thincknessobj != null &&
                    linestyleobj != null)
                {
                    double    thinckness = (double)thincknessobj;
                    LineStyle linestyle  = (LineStyle)linestyleobj;

                    _pen = new Pen(brush, thinckness);

                    switch (linestyle)
                    {
                    case LineStyle.Solid:
                        break;

                    case LineStyle.Dotted:
                        _pen.DashStyle = new DashStyle
                        {
                            Dashes = new DoubleCollection {
                                4, 4
                            }
                        };
                        break;
                    }

                    _pen.Freeze();
                }

                //_pen = new Pen(linebrush, thickness);
            }
        }
        static Style CreateHighlightSyle()
        {
            Style newStyle = new Style();

            newStyle.Id = "highlightStyle";

            LineStyle lineStyle = new LineStyle();

            lineStyle.Color = Color32.Parse("ff00ff00");
            lineStyle.Width = 8;

            var iconStyle = new IconStyle();

            iconStyle.Color = Color32.Parse("ff00ff00");
            iconStyle.Scale = 1.2;
            iconStyle.Icon  = new IconStyle.IconLink(new Uri("http://earth.google.com/images/kml-icons/track-directional/track-0.png"));

            newStyle.Line = lineStyle;
            newStyle.Icon = iconStyle;

            return(newStyle);
        }
Exemple #49
0
        /// <summary>
        /// Setup the map with the ThinkGeo Cloud Maps overlay to show a basic map
        /// </summary>
        protected override void OnAppearing()
        {
            base.OnAppearing();
            // Set the map's unit of measurement to meters(Spherical Mercator)
            mapView.MapUnit = GeographyUnit.Meter;

            // Add Cloud Maps as a background overlay
            var thinkGeoCloudVectorMapsOverlay = new ThinkGeoCloudVectorMapsOverlay("9ap16imkD_V7fsvDW9I8r8ULxgAB50BX_BnafMEBcKg~", "vtVao9zAcOj00UlGcK7U-efLANfeJKzlPuDB9nw7Bp4K4UxU_PdRDg~~", ThinkGeoCloudVectorMapsMapType.Light);

            thinkGeoCloudVectorMapsOverlay.VectorTileCache = new FileVectorTileCache(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "cache"), "CloudMapsVector");
            mapView.Overlays.Add(thinkGeoCloudVectorMapsOverlay);

            // Set the map extent
            mapView.CurrentExtent = new RectangleShape(-10786436, 3918518, -10769429, 3906002);

            LayerOverlay         layerOverlay;
            InMemoryFeatureLayer featureLayer;

            // Create the layer that will store the drawn shapes
            featureLayer = new InMemoryFeatureLayer();

            // Add styles for the layer
            featureLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle   = PointStyle.CreateSimpleCircleStyle(GeoColors.Blue, 8, GeoColors.Black);
            featureLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle    = LineStyle.CreateSimpleLineStyle(GeoColors.Blue, 4, true);
            featureLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle    = AreaStyle.CreateSimpleAreaStyle(GeoColors.Blue, GeoColors.Black);
            featureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            // Add the layer to a LayerOverlay
            layerOverlay = new LayerOverlay();
            layerOverlay.Layers.Add("featureLayer", featureLayer);

            // Add the LayerOverlay to the map
            mapView.Overlays.Add("layerOverlay", layerOverlay);

            // Update instructions
            instructions.Text = "Navigation Mode - The default map state. Allows you to pan and zoom the map with mouse controls.";

            mapView.Refresh();
        }
Exemple #50
0
        /// <summary>
        /// Set up the map with the ThinkGeo Cloud Maps overlay and a feature layer for the reprojected features
        /// </summary>
        protected override void OnAppearing()
        {
            base.OnAppearing();
            // Create the background world maps using vector tiles requested from the ThinkGeo Cloud Service.
            ThinkGeoCloudVectorMapsOverlay thinkGeoCloudVectorMapsOverlay = new ThinkGeoCloudVectorMapsOverlay("9ap16imkD_V7fsvDW9I8r8ULxgAB50BX_BnafMEBcKg~", "vtVao9zAcOj00UlGcK7U-efLANfeJKzlPuDB9nw7Bp4K4UxU_PdRDg~~", ThinkGeoCloudVectorMapsMapType.Light);

            thinkGeoCloudVectorMapsOverlay.VectorTileCache = new FileVectorTileCache(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "cache"), "CloudMapsVector");
            mapView.Overlays.Add(thinkGeoCloudVectorMapsOverlay);

            // Set the map's unit of measurement to meters (Spherical Mercator)
            mapView.MapUnit = GeographyUnit.Meter;

            // Create a new feature layer to display the shapes we will be reprojecting
            InMemoryFeatureLayer reprojectedFeaturesLayer = new InMemoryFeatureLayer();

            // Add a point, line, and polygon style to the layer. These styles control how the shapes will be drawn
            reprojectedFeaturesLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = new PointStyle(PointSymbolType.Star, 24, GeoBrushes.MediumPurple, GeoPens.Purple);
            reprojectedFeaturesLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle  = LineStyle.CreateSimpleLineStyle(GeoColors.MediumPurple, 6, false);
            reprojectedFeaturesLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle  = AreaStyle.CreateSimpleAreaStyle(GeoColor.FromArgb(80, GeoColors.MediumPurple), GeoColors.MediumPurple, 2);

            // Apply these styles on all zoom levels. This ensures our shapes will be visible on all zoom levels
            reprojectedFeaturesLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            // Add the layer to an overlay
            LayerOverlay reprojectedFeaturesOverlay = new LayerOverlay();

            reprojectedFeaturesOverlay.Layers.Add("Reprojected Features Layer", reprojectedFeaturesLayer);

            // Add the overlay to the map
            mapView.Overlays.Add("Reprojected Features Overlay", reprojectedFeaturesOverlay);

            // Set the map extent
            mapView.CurrentExtent = new RectangleShape(-10798419.605087, 3934270.12359632, -10759021.6785336, 3896039.57306867);

            // Initialize the ProjectionCloudClient with our ThinkGeo Cloud credentials
            projectionCloudClient = new ProjectionCloudClient("FSDgWMuqGhZCmZnbnxh-Yl1HOaDQcQ6mMaZZ1VkQNYw~", "IoOZkBJie0K9pz10jTRmrUclX6UYssZBeed401oAfbxb9ufF1WVUvg~~");

            mapView.Refresh();
        }
Exemple #51
0
        public PlottableScatter PlotScatter(
            double[] xs,
            double[] ys,
            Color?color             = null,
            double lineWidth        = 1,
            double markerSize       = 5,
            string label            = null,
            double[] errorX         = null,
            double[] errorY         = null,
            double errorLineWidth   = 1,
            double errorCapSize     = 3,
            MarkerShape markerShape = MarkerShape.filledCircle,
            LineStyle lineStyle     = LineStyle.Solid
            )
        {
            if (color == null)
            {
                color = settings.GetNextColor();
            }

            PlottableScatter scatterPlot = new PlottableScatter(
                xs: xs,
                ys: ys,
                color: (Color)color,
                lineWidth: lineWidth,
                markerSize: markerSize,
                label: label,
                errorX: errorX,
                errorY: errorY,
                errorLineWidth: errorLineWidth,
                errorCapSize: errorCapSize,
                stepDisplay: false,
                markerShape: markerShape,
                lineStyle: lineStyle
                );

            settings.plottables.Add(scatterPlot);
            return(scatterPlot);
        }
        void drawLine(Line line, LineStyle lstyle, Brush brush)
        {
            switch (lstyle)
            {
            case LineStyle.SingleLine:
                line.Visibility = System.Windows.Visibility.Visible;
                line.Stroke     = brush;
                break;

            case LineStyle.DoubleLine:
                line.Visibility = System.Windows.Visibility.Visible;
                line.Stroke     = brush;
                break;

            case LineStyle.DotLine:
                line.Visibility      = System.Windows.Visibility.Visible;
                line.Stroke          = brush;
                line.StrokeDashArray = new DoubleCollection()
                {
                    1, 1,
                };
                line.StrokeDashOffset = 0;
                break;

            case LineStyle.DashLine:
                line.Visibility      = System.Windows.Visibility.Visible;
                line.Stroke          = brush;
                line.StrokeDashArray = new DoubleCollection()
                {
                    3, 1,
                };
                line.StrokeDashOffset = 0;
                break;

            default:
                line.Visibility = System.Windows.Visibility.Hidden;
                break;
            }
        }
Exemple #53
0
 public override void StrokePath(double strokeWidth, int color, LineStyle lineStyle)
 {
     _stream.Write("\" stroke=\"#");
     _stream.Write(FormatColor(color));
     if (strokeWidth != 1)
     {
         _stream.Write("\" stroke-width=\"");
         _stream.Write(FormatNumber(strokeWidth));
     }
     if (lineStyle == LineStyle.Dashed)
     {
         _stream.Write("\" stroke-dasharray=\"");
         _stream.Write(FormatNumber(strokeWidth * 4));
     }
     else if (lineStyle == LineStyle.Dotted)
     {
         _stream.Write("\" stroke-linecap=\"round\" stroke-dasharray=\"0 ");
         _stream.Write(FormatNumber(strokeWidth * 3));
     }
     _stream.Write("\" fill=\"none\"/>\n");
     _isFirstMoveInPath = true;
 }
Exemple #54
0
        /// <inheritdoc />
        public override void StrokePath(double strokeWidth, int color, LineStyle lineStyle = LineStyle.Solid, bool smoothing = true)
        {
            if (color != _lastStrokingColor)
            {
                _lastStrokingColor = color;
                var r = ColorScale * ((color >> 16) & 0xff);
                var g = ColorScale * ((color >> 8) & 0xff);
                var b = ColorScale * ((color >> 0) & 0xff);
                _contentStream.SetStrokingColor(r, g, b);
            }
            if (lineStyle != _lastLineStyle ||
                (lineStyle != LineStyle.Solid && strokeWidth != _lastLineWidth))
            {
                _lastLineStyle = lineStyle;
                float[] pattern;
                switch (lineStyle)
                {
                case LineStyle.Dashed:
                    pattern = new[] { 4 * (float)strokeWidth };
                    break;

                case LineStyle.Dotted:
                    pattern = new[] { 0, 3 * (float)strokeWidth };
                    break;

                default:
                    pattern = new float[] { };
                    break;
                }
                _contentStream.SetLineCapStyle(lineStyle == LineStyle.Dotted ? 1 : 0);
                _contentStream.SetLineDashPattern(pattern, 0);
            }
            if (strokeWidth != _lastLineWidth)
            {
                _lastLineWidth = strokeWidth;
                _contentStream.SetLineWidth((float)strokeWidth);
            }
            _contentStream.Stroke();
        }
Exemple #55
0
        private static IList SplitStringIntoStyledLines(string input, LineStyle aStyle)
        {
            string sp;
            ArrayList answer = new ArrayList();

            sp = input.TrimEnd(new char[] { '\n' });
            sp = sp.Replace("\r", "");
            sp = sp.TrimEnd(new char[] { '\n' });
            foreach (string s in sp.Split(new char[] { '\n' }))
                answer.Add(new StyledLine(s, aStyle));
            return MergeStyledBehaviorLines(answer);
        }
 public void BorderAround(LineStyle? linestyle = null, BorderWeight? borderweight = null, ColorIndex? colourindex = null)
 {
     InternalObject.GetType().InvokeMember("BorderAround", System.Reflection.BindingFlags.InvokeMethod, null, InternalObject, new object[] {linestyle, borderweight, colourindex });
 }
Exemple #57
0
        /// <summary>
        /// Sets default values from the plot model.
        /// </summary>
        /// <param name="model">The plot model.</param>
        protected internal override void SetDefaultValues(PlotModel model)
        {
            if (this.LineStyle == LineStyle.Automatic)
            {
                this.defaultLineStyle = model.GetDefaultLineStyle();
            }

            if (this.Color.IsAutomatic())
            {
                this.defaultColor = model.GetDefaultColor();

                if (this.MarkerFill.IsAutomatic())
                {
                    this.defaultMarkerFill = this.defaultColor;
                }
            }
        }
Exemple #58
0
 public void SetSecondLine(SymColor secondLineColor, float secondThickness, LineStyle secondLineStyle)
 {
     CheckModifiable();
     this.secondLineColor = secondLineColor;
     this.secondThickness = secondThickness;
     this.secondLineStyle = secondLineStyle;
 }
Exemple #59
0
 public LineSymDef(string name, int ocadID, SymColor color, float thick, LineStyle lineStyle)
     : base(name, ocadID)
 {
     lineColor = color;
     thickness = thick;
     this.lineStyle = lineStyle;
 }
        /// <summary>
        /// Creates the specified pen.
        /// </summary>
        /// <param name="color">The color.</param>
        /// <param name="thickness">The thickness.</param>
        /// <param name="lineStyle">The line style.</param>
        /// <param name="lineJoin">The line join.</param>
        /// <returns>A pen.</returns>
        public static OxyPen Create(
            OxyColor color,
            double thickness,
            LineStyle lineStyle = LineStyle.Solid,
            OxyPenLineJoin lineJoin = OxyPenLineJoin.Miter)
        {
            if (color == null || lineStyle == LineStyle.None || Math.Abs(thickness) < double.Epsilon)
            {
                return null;
            }

            return new OxyPen(color, thickness, lineStyle, lineJoin);
        }