/// <summary> /// Set map positions to graphics in clustering layer by spiral /// </summary> /// <param name="count"></param> private void _SetSpiraledPositionsToExpandedClusterGraphics() { int count = _clusteringLayer.MapLayer.Graphics.Count; double radius = MINIMAL_EXPANDED_CLUSTER_RADIUS; double dRadius = START_DELTA_RADIUS; double angle = START_ANGLE; double dAngle = START_DELTA_ANGLE; for (int index = 0; index < count; index++) { double dx = radius * Math.Cos(angle); double dy = radius * Math.Sin(angle); DataGraphicObject graphic = (DataGraphicObject)_clusteringLayer.MapLayer.Graphics[index]; MarkerSymbol symbol = (MarkerSymbol)graphic.Symbol; System.Windows.Point symbolPoint = _mapctrl.map.MapToScreen((MapPoint)graphic.Geometry); symbol.OffsetX = -(dx + _clusterCenter.Value.X - symbolPoint.X); symbol.OffsetY = -(dy + _clusterCenter.Value.Y - symbolPoint.Y); graphic.SetZIndex(ObjectLayer.FRONTZINDEX); radius += dRadius; dRadius *= DELTA_RADIUS_MULTIPLIER; angle += dAngle; dAngle *= DELTA_ANGLE_MULTIPLIER; } _expandedAreaRadius = radius + ADDITIONAL_EXPANDED_AREA; }
/// <summary> /// Set map positions to graphics in clustering layer by circle /// </summary> private void _SetCircledPositionsToExpandedClusterGraphics() { int count = _clusteringLayer.MapLayer.Graphics.Count; // do visual expand double sinus = Math.Sin(Math.PI / count); double radius = DIST_BETWEEN_EXPANDED_SYMBOLS / (2 * sinus); if (radius < MINIMAL_EXPANDED_CLUSTER_RADIUS) { radius = MINIMAL_EXPANDED_CLUSTER_RADIUS; } _expandedAreaRadius = radius + ADDITIONAL_EXPANDED_AREA; for (int index = 0; index < count; index++) { double angle = (2 * Math.PI / count) * index; double dx = radius * Math.Cos(angle); double dy = radius * Math.Sin(angle); DataGraphicObject graphic = (DataGraphicObject)_clusteringLayer.MapLayer.Graphics[index]; MarkerSymbol symbol = (MarkerSymbol)graphic.Symbol; System.Windows.Point symbolPoint = _mapctrl.map.MapToScreen((MapPoint)graphic.Geometry); symbol.OffsetX = dx - _clusterCenter.Value.X + symbolPoint.X; symbol.OffsetY = dy - _clusterCenter.Value.Y + symbolPoint.Y; graphic.SetZIndex(ObjectLayer.FRONTZINDEX); } }
/// <summary> /// Tries to get the innermost symbol containing the specified scalar. If no symbol contains the scalar the trial fails. /// </summary> /// <returns><c>true</c>, if the interval was found, <c>false</c> when such interval does not exist.</returns> /// <param name="scalar">Scalar.</param> /// <param name="interval">Found interval.</param> public bool TryGet(TAddress scalar, out Symbol interval) { interval = default(Symbol); var marker = new MarkerSymbol(scalar); var index = Array.BinarySearch <Symbol>(symbols, marker, comparer); if (index < 0) { index = ~index; //we are behind last element or before 1st if (index == 0) { return(false); } //move back one element because search will always point to the 1st larger element than the marker index--; } /*** * We might be between two towers, that lie on the commond ground (we will be between the top of the left tower and * before the base of the next one). `index` points to the left top symbol, we check if any enclosing symbol also contains the * scalar. If not, there is no such symbol (the common ground) and scalar just lies between two towers. If it exists scalar * Is between two symbol lying on the same base. ****/ index = FindEnclosingInterval(index, scalar); if (index != NoEnclosingInterval) { interval = symbols[index]; return(true); } return(false); }
public void WriteSymbol(Symbol symbol) { if (IsSerializable(symbol)) { FillSymbol fillSymbol = symbol as FillSymbol; if (fillSymbol != null) { WriteFillSymbol(fillSymbol); } else { LineSymbol lineSymbol = symbol as LineSymbol; if (lineSymbol != null) { WriteLineSymbol(lineSymbol); } else { MarkerSymbol markerSymbol = symbol as MarkerSymbol; if (markerSymbol != null) { WriteMarkerSymbol(markerSymbol); } else throw new NotSupportedException(symbol.GetType().FullName); } } } }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { int hashCode = 41; if (Item != null) { hashCode = hashCode * 59 + Item.GetHashCode(); } if (Axis != null) { hashCode = hashCode * 59 + Axis.GetHashCode(); } if (Label != null) { hashCode = hashCode * 59 + Label.GetHashCode(); } if (Chart != null) { hashCode = hashCode * 59 + Chart.GetHashCode(); } if (Legend != null) { hashCode = hashCode * 59 + Legend.GetHashCode(); } if (Fill != null) { hashCode = hashCode * 59 + Fill.GetHashCode(); } if (LineColor != null) { hashCode = hashCode * 59 + LineColor.GetHashCode(); } if (LineWidth != null) { hashCode = hashCode * 59 + LineWidth.GetHashCode(); } if (LineStyle != null) { hashCode = hashCode * 59 + LineStyle.GetHashCode(); } if (MarkerColor != null) { hashCode = hashCode * 59 + MarkerColor.GetHashCode(); } if (MarkerSymbol != null) { hashCode = hashCode * 59 + MarkerSymbol.GetHashCode(); } if (RepeatTime != null) { hashCode = hashCode * 59 + RepeatTime.GetHashCode(); } return(hashCode); } }
/// <summary> /// Applies a number of data points to a series /// </summary> private void ApplyDataPoints(ChartSeries series, int dataPointsCount, MarkerSymbol markerSymbol, int dataPointSize) { for (int i = 0; i < dataPointsCount; i++) { ChartDataPoint point = series.DataPoints.Add(i); point.Marker.Symbol = markerSymbol; point.Marker.Size = dataPointSize; Assert.AreEqual(i, point.Index); } }
/// <summary> /// Initializes a new instance of the <see cref="Editor"/> class. /// </summary> /// <param name="map">The map you're editing on.</param> /// <param name="layer">The layer you want to edit.</param> public Editor(Map map, GraphicsLayer layer) { MyMap = map; editLayer = layer; VertexSymbol = new SimpleMarkerSymbol() { Size = 7, Style = SimpleMarkerSymbol.SimpleMarkerStyle.Square, Color = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.White) }; }
/// <summary> /// Add leader lines to expanded cluster elements /// </summary> private void _CreateLeaderLines() { List <Graphic> _leaderLines = new List <Graphic>(); foreach (DataGraphicObject dataGraphic in _clusteringLayer.MapLayer.Graphics) { // TODO: remove hardcode LineSymbol simpleLineSymbol = new LineSymbol() { Color = (SolidColorBrush)App.Current.FindResource("ClusteringLineBrush"), Width = 2 }; ESRI.ArcGIS.Client.Geometry.PointCollection points = new ESRI.ArcGIS.Client.Geometry.PointCollection(); MapPoint graphicPosition = dataGraphic.Geometry as MapPoint; MapPoint startPoint = (MapPoint)_expandedClusterGraphic.Geometry; System.Windows.Point point = _mapctrl.map.MapToScreen(startPoint); MarkerSymbol symbol = dataGraphic.Symbol as MarkerSymbol; point.X -= symbol.OffsetX; point.Y -= symbol.OffsetY; MapPoint endPoint = _mapctrl.map.ScreenToMap(point); endPoint.X -= startPoint.X - graphicPosition.X; endPoint.Y -= startPoint.Y - graphicPosition.Y; points.Add(startPoint); points.Add(endPoint); Polyline lineGeometry = new Polyline(); lineGeometry.Paths.Add(points); Graphic lineGraphic = new Graphic() { Symbol = simpleLineSymbol, Geometry = lineGeometry }; _leaderLines.Add(lineGraphic); } foreach (Graphic graphic in _leaderLines) { _leaderLinesLayer.Graphics.Add(graphic); } }
private static Symbol _InitGraphicByRecord(SymbologyRecord record, DataGraphicObject graphicObject) { Symbol symbol = new MarkerSymbol(); symbol.ControlTemplate = GetTemplateByFileName(record.SymbolFilename); graphicObject.Attributes[SymbologyContext.SIZE_ATTRIBUTE_NAME] = record.Size; graphicObject.Attributes[SymbologyContext.OFFSETX_ATTRIBUTE_NAME] = -record.Size / 2 - SymbologyManager.DEFAULT_INDENT / 2; graphicObject.Attributes[SymbologyContext.OFFSETY_ATTRIBUTE_NAME] = -record.Size / 2 - SymbologyManager.DEFAULT_INDENT / 2; graphicObject.Attributes[SymbologyContext.FULLSIZE_ATTRIBUTE_NAME] = record.Size + SymbologyManager.DEFAULT_INDENT; if (!record.UseRouteColor) { System.Drawing.Color color = (System.Drawing.Color)record.Color; System.Windows.Media.Color mediaColor = System.Windows.Media.Color.FromArgb(color.A, color.R, color.G, color.B); graphicObject.Attributes[SymbologyContext.FILL_ATTRIBUTE_NAME] = new SolidColorBrush(mediaColor); } else { System.Windows.Media.Color mediaColor; Stop stop = graphicObject.Data as Stop; if (stop == null) { mediaColor = System.Windows.Media.Color.FromRgb(0, 0, 0); } else { System.Drawing.Color color = stop.Route.Color; mediaColor = System.Windows.Media.Color.FromArgb(color.A, color.R, color.G, color.B); } graphicObject.Attributes[SymbologyContext.FILL_ATTRIBUTE_NAME] = new SolidColorBrush(mediaColor); } return(symbol); }
internal void SetSymbolInternal(MarkerSymbol value) { Scintilla.PropertyBag[this + ".Symbol"] = value; NativeScintilla.MarkerDefine(this._number, (int)value); }
private void ResetSymbol() { Symbol = MarkerSymbol.Circle; }
private static MarkerSymbol cloneMarkerSymbol(MarkerSymbol symbol) { if (symbol == null) { return(null); } ESRI.ArcGIS.Mapping.Core.Symbols.ImageFillSymbol imageFillSymbol = symbol as ESRI.ArcGIS.Mapping.Core.Symbols.ImageFillSymbol; if (imageFillSymbol != null) { ESRI.ArcGIS.Mapping.Core.Symbols.ImageFillSymbol ifs = new ESRI.ArcGIS.Mapping.Core.Symbols.ImageFillSymbol() { Color = CloneBrush(imageFillSymbol.Color), ControlTemplate = imageFillSymbol.ControlTemplate, OffsetX = imageFillSymbol.OffsetX, OffsetY = imageFillSymbol.OffsetY, OriginX = imageFillSymbol.OriginX, OriginY = imageFillSymbol.OriginY, Opacity = imageFillSymbol.Opacity, Size = imageFillSymbol.Size, ImageData = imageFillSymbol.ImageData, Source = imageFillSymbol.Source, Fill = CloneBrush(imageFillSymbol.Fill), CursorName = imageFillSymbol.CursorName, }; return(ifs); } ESRI.ArcGIS.Mapping.Core.Symbols.MarkerSymbol ms = symbol as ESRI.ArcGIS.Mapping.Core.Symbols.MarkerSymbol; if (ms != null) { ESRI.ArcGIS.Mapping.Core.Symbols.MarkerSymbol marSymb = new ESRI.ArcGIS.Mapping.Core.Symbols.MarkerSymbol() { DisplayName = ms.DisplayName, Offset = new Point(ms.Offset.X, ms.Offset.Y), Color = CloneBrush(ms.Color), ControlTemplate = ms.ControlTemplate, OffsetX = ms.OffsetX, OffsetY = ms.OffsetY, OriginX = ms.OriginX, OriginY = ms.OriginY, Opacity = ms.Opacity, Size = ms.Size, }; return(marSymb); } ESRI.ArcGIS.Client.Symbols.SimpleMarkerSymbol simpleMarkerSymbol = symbol as ESRI.ArcGIS.Client.Symbols.SimpleMarkerSymbol; if (simpleMarkerSymbol != null) { ESRI.ArcGIS.Client.Symbols.SimpleMarkerSymbol sms = new ESRI.ArcGIS.Client.Symbols.SimpleMarkerSymbol() { Color = CloneBrush(simpleMarkerSymbol.Color), ControlTemplate = simpleMarkerSymbol.ControlTemplate, Size = simpleMarkerSymbol.Size, // Simple marker symbol doesn't allow setting OffsetX, OffsetY }; return(sms); } TextSymbol textSymbol = symbol as TextSymbol; if (textSymbol != null) { TextSymbol ts = new TextSymbol() { ControlTemplate = textSymbol.ControlTemplate, FontFamily = textSymbol.FontFamily, FontSize = textSymbol.FontSize, Foreground = CloneBrush(textSymbol.Foreground), OffsetX = textSymbol.OffsetX, OffsetY = textSymbol.OffsetY, Text = textSymbol.Text, }; return(ts); } PictureMarkerSymbol pictureMarkerSymbol = symbol as PictureMarkerSymbol; if (pictureMarkerSymbol != null) { PictureMarkerSymbol pictMs = new PictureMarkerSymbol() { ControlTemplate = pictureMarkerSymbol.ControlTemplate, Height = pictureMarkerSymbol.Height, OffsetX = pictureMarkerSymbol.OffsetX, OffsetY = pictureMarkerSymbol.OffsetY, Opacity = pictureMarkerSymbol.Opacity, Source = pictureMarkerSymbol.Source, Width = pictureMarkerSymbol.Width, }; return(pictMs); } MarkerSymbol markerS = new MarkerSymbol() { ControlTemplate = symbol.ControlTemplate, OffsetX = symbol.OffsetX, OffsetY = symbol.OffsetY, }; return(markerS); }
internal void SetSymbolInternal(MarkerSymbol value) { Scintilla.PropertyBag[ToString() + ".Symbol"] = value; NativeScintilla.MarkerDefine(_number, (int)value); }
private void WriteMarkerSymbol(MarkerSymbol markerSymbol) { ICustomSymbol symbol = markerSymbol as ICustomSymbol; if (symbol != null) { symbol.Serialize(writer, Namespaces); return; } string prefix = Constants.esriPrefix; if (markerSymbol is ESRI.ArcGIS.Mapping.Core.Symbols.MarkerSymbol) prefix = Constants.esriMappingPrefix; else if (markerSymbol is ESRI.ArcGIS.Client.FeatureService.Symbols.SimpleMarkerSymbol || markerSymbol is ESRI.ArcGIS.Client.FeatureService.Symbols.PictureMarkerSymbol) prefix = Constants.esriFSSymbolsPrefix; StartType(markerSymbol, prefix); if (markerSymbol is SimpleMarkerSymbol) { #region Size,Style,Color SimpleMarkerSymbol sms = markerSymbol as SimpleMarkerSymbol; WriteAttribute("Size", sms.Size); if (sms.Style != SimpleMarkerSymbol.SimpleMarkerStyle.Circle) { WriteAttribute("Style", sms.Style.ToString()); } if (sms.Color is SolidColorBrush && sms.Color.Opacity == 1) { WriteAttribute("Color", (sms.Color as SolidColorBrush).Color); } else { writer.WriteStartElement("SimpleMarkerSymbol.Color", Namespaces[Constants.esriPrefix]); new BrushXamlWriter(writer, Namespaces).WriteBrush(sms.Color); writer.WriteEndElement(); } #endregion } else if (markerSymbol is ESRI.ArcGIS.Client.FeatureService.Symbols.PictureMarkerSymbol || markerSymbol is ESRI.ArcGIS.Client.FeatureService.Symbols.SimpleMarkerSymbol) { WriteJsonAttribute(markerSymbol as IJsonSerializable); } else { if (markerSymbol is ESRI.ArcGIS.Mapping.Core.Symbols.MarkerSymbol) { #region Size,OriginX, OriginY, Opacity ESRI.ArcGIS.Mapping.Core.Symbols.MarkerSymbol marker = markerSymbol as ESRI.ArcGIS.Mapping.Core.Symbols.MarkerSymbol; if (marker != null) { WriteAttribute("Size", marker.Size); WriteAttribute("OriginX", marker.OriginX); WriteAttribute("OriginY", marker.OriginY); if (marker.Opacity < 1) WriteAttribute("Opacity", marker.Opacity); } #endregion } else if (!(markerSymbol is ESRI.ArcGIS.Client.FeatureService.Symbols.PictureMarkerSymbol || markerSymbol is ESRI.ArcGIS.Client.FeatureService.Symbols.SimpleMarkerSymbol)) { #region OffsetX, OffsetY if (markerSymbol.OffsetX != 0) WriteAttribute("OffsetX", markerSymbol.OffsetX); if (markerSymbol.OffsetY != 0) WriteAttribute("OffsetY", markerSymbol.OffsetY); #endregion } PictureMarkerSymbol pms = markerSymbol as PictureMarkerSymbol; if (pms != null) { #region PMS WriteAttribute("Width", pms.Width); WriteAttribute("Height", pms.Height); if (pms.Opacity < 1) WriteAttribute("Opacity", pms.Opacity); string imageSource = SymbolExtensions.GetOriginalSource(pms); if (!string.IsNullOrEmpty(imageSource)) writer.WriteElementString(Constants.esriMappingPrefix, "SymbolExtensions.OriginalSource", Constants.esriMappingNamespace, imageSource); else { BitmapImage bmp = pms.Source as BitmapImage; if (bmp != null && bmp.UriSource != null) { WriteAttribute("Source", bmp.UriSource.OriginalString); } } #endregion } else if (markerSymbol is TextSymbol) { #region TS TextSymbol ts = markerSymbol as TextSymbol; WriteAttribute("FontSize", ts.FontSize); WriteAttribute("FontFamily", ts.FontFamily.Source); WriteAttribute("Text", ts.Text); if (ts.Foreground != null) { writer.WriteStartElement("TextSymbol.Foreground", Namespaces[Constants.esriPrefix]); new BrushXamlWriter(writer, Namespaces).WriteBrush(ts.Foreground); writer.WriteEndElement(); } #endregion } else if (markerSymbol is ESRI.ArcGIS.Mapping.Core.Symbols.ImageFillSymbol) { #region IFS: Source ESRI.ArcGIS.Mapping.Core.Symbols.ImageFillSymbol fillSymbol = markerSymbol as ESRI.ArcGIS.Mapping.Core.Symbols.ImageFillSymbol; if (!string.IsNullOrEmpty(fillSymbol.ImageData)) writer.WriteAttributeString("ImageData", fillSymbol.ImageData); else if (!string.IsNullOrEmpty(fillSymbol.Source)) writer.WriteAttributeString("Source", fillSymbol.Source); #endregion } else if (markerSymbol is ESRI.ArcGIS.Mapping.Core.Symbols.MarkerSymbol) { #region Color ESRI.ArcGIS.Mapping.Core.Symbols.MarkerSymbol marker = markerSymbol as ESRI.ArcGIS.Mapping.Core.Symbols.MarkerSymbol; if (marker != null) { if (marker.Color != null) { writer.WriteStartElement("MarkerSymbol.Color", Namespaces[Constants.esriMappingPrefix]); new BrushXamlWriter(writer, Namespaces).WriteBrush(marker.Color); writer.WriteEndElement(); } } #endregion } #region Feature Service Symbols - Not used //else if (markerSymbol is ESRI.ArcGIS.Client.FeatureService.Symbols.PictureMarkerSymbol) //{ // #region pms // ESRI.ArcGIS.Client.FeatureService.Symbols.PictureMarkerSymbol pmsfs = markerSymbol as ESRI.ArcGIS.Client.FeatureService.Symbols.PictureMarkerSymbol; // WriteAttribute("Width", pmsfs.Width); // WriteAttribute("Height", pmsfs.Height); // WriteAttribute("Opacity", pmsfs.Opacity); // WriteFeatureServiceMarkerSymbolProperties("PictureMarkerSymbol", pmsfs.Angle, pmsfs.XOffsetFromCenter, // pmsfs.YOffsetFromCenter, pmsfs.Color, pmsfs.SelectionColor, pmsfs.RenderTransformPoint); // #region Set ContentType,Url and ImageData to set Source // SetImageSourceRelatedProperties(pmsfs, pmsfs.ToJson()); // #endregion // #endregion //} //else if (markerSymbol is ESRI.ArcGIS.Client.FeatureService.Symbols.SimpleMarkerSymbol) //{ // #region smsfs // ESRI.ArcGIS.Client.FeatureService.Symbols.SimpleMarkerSymbol smsfs = markerSymbol as ESRI.ArcGIS.Client.FeatureService.Symbols.SimpleMarkerSymbol; // WriteAttribute("OutlineThickness", smsfs.OutlineThickness); // WriteAttribute("Size", smsfs.Size); // WriteAttribute("Style", smsfs.Style.ToString()); // WriteAttribute("OutlineStyle", smsfs.OutlineStyle.ToString()); // WriteFeatureServiceMarkerSymbolProperties("SimpleMarkerSymbol", smsfs.Angle, smsfs.XOffsetFromCenter, // smsfs.YOffsetFromCenter, smsfs.Color, smsfs.SelectionColor, smsfs.RenderTransformPoint); // if (smsfs.OutlineColor != null) // { // writer.WriteStartElement("SimpleMarkerSymbol.OutlineColor", Namespaces[Constants.esriFSSymbolsPrefix]); // new BrushXamlWriter(writer, Namespaces).WriteBrush(smsfs.OutlineColor); // writer.WriteEndElement(); // } // #endregion //} #endregion else throw new NotSupportedException(markerSymbol.GetType().FullName); } writer.WriteEndElement(); }
public void SetLocationMarker(MarkerSymbol locationMarker) { this.locationMarker = locationMarker; }
private static Symbol _InitGraphicByRecord(SymbologyRecord record, DataGraphicObject graphicObject) { Symbol symbol = new MarkerSymbol(); symbol.ControlTemplate = GetTemplateByFileName(record.SymbolFilename); graphicObject.Attributes[SymbologyContext.SIZE_ATTRIBUTE_NAME] = record.Size; graphicObject.Attributes[SymbologyContext.OFFSETX_ATTRIBUTE_NAME] = -record.Size / 2 - SymbologyManager.DEFAULT_INDENT / 2; graphicObject.Attributes[SymbologyContext.OFFSETY_ATTRIBUTE_NAME] = -record.Size / 2 - SymbologyManager.DEFAULT_INDENT / 2; graphicObject.Attributes[SymbologyContext.FULLSIZE_ATTRIBUTE_NAME] = record.Size + SymbologyManager.DEFAULT_INDENT; if (!record.UseRouteColor) { System.Drawing.Color color = (System.Drawing.Color)record.Color; System.Windows.Media.Color mediaColor = System.Windows.Media.Color.FromArgb(color.A, color.R, color.G, color.B); graphicObject.Attributes[SymbologyContext.FILL_ATTRIBUTE_NAME] = new SolidColorBrush(mediaColor); } else { System.Windows.Media.Color mediaColor; Stop stop = graphicObject.Data as Stop; if (stop == null) mediaColor = System.Windows.Media.Color.FromRgb(0, 0, 0); else { System.Drawing.Color color = stop.Route.Color; mediaColor = System.Windows.Media.Color.FromArgb(color.A, color.R, color.G, color.B); } graphicObject.Attributes[SymbologyContext.FILL_ATTRIBUTE_NAME] = new SolidColorBrush(mediaColor); } return symbol; }
public void SetImage(Bitmap image) { this.Symbol = MarkerSymbol.RGBAImage; NativeScintilla.RGBAImageSetWidth(image.Width); NativeScintilla.RGBAImageSetHeight(image.Height); Random r = new Random(); byte[] data = new byte[image.Width * image.Height * 4]; for (int y = 0; y < image.Height; y++) for (int x = 0; x < image.Width; x++) { Color c = image.GetPixel(x, y); data[(y * image.Width + x) * 4 + 0] = c.R; data[(y * image.Width + x) * 4 + 1] = c.G; data[(y * image.Width + x) * 4 + 2] = c.B; data[(y * image.Width + x) * 4 + 3] = c.A; } NativeScintilla.MarkerDefineRGBAImage(_number, data); }
private static MarkerSymbol cloneMarkerSymbol(MarkerSymbol symbol) { if (symbol == null) return null; ESRI.ArcGIS.Mapping.Core.Symbols.ImageFillSymbol imageFillSymbol = symbol as ESRI.ArcGIS.Mapping.Core.Symbols.ImageFillSymbol; if (imageFillSymbol != null) { ESRI.ArcGIS.Mapping.Core.Symbols.ImageFillSymbol ifs = new ESRI.ArcGIS.Mapping.Core.Symbols.ImageFillSymbol() { Color = CloneBrush(imageFillSymbol.Color), ControlTemplate = imageFillSymbol.ControlTemplate, OffsetX = imageFillSymbol.OffsetX, OffsetY = imageFillSymbol.OffsetY, OriginX = imageFillSymbol.OriginX, OriginY = imageFillSymbol.OriginY, Opacity = imageFillSymbol.Opacity, Size = imageFillSymbol.Size, ImageData = imageFillSymbol.ImageData, Source = imageFillSymbol.Source, Fill = CloneBrush(imageFillSymbol.Fill), CursorName = imageFillSymbol.CursorName, }; return ifs; } ESRI.ArcGIS.Mapping.Core.Symbols.MarkerSymbol ms = symbol as ESRI.ArcGIS.Mapping.Core.Symbols.MarkerSymbol; if (ms != null) { ESRI.ArcGIS.Mapping.Core.Symbols.MarkerSymbol marSymb = new ESRI.ArcGIS.Mapping.Core.Symbols.MarkerSymbol() { DisplayName = ms.DisplayName, Offset = new Point(ms.Offset.X, ms.Offset.Y), Color = CloneBrush(ms.Color), ControlTemplate = ms.ControlTemplate, OffsetX = ms.OffsetX, OffsetY = ms.OffsetY, OriginX = ms.OriginX, OriginY = ms.OriginY, Opacity = ms.Opacity, Size = ms.Size, }; return marSymb; } ESRI.ArcGIS.Client.Symbols.SimpleMarkerSymbol simpleMarkerSymbol = symbol as ESRI.ArcGIS.Client.Symbols.SimpleMarkerSymbol; if (simpleMarkerSymbol != null) { ESRI.ArcGIS.Client.Symbols.SimpleMarkerSymbol sms = new ESRI.ArcGIS.Client.Symbols.SimpleMarkerSymbol() { Color = CloneBrush(simpleMarkerSymbol.Color), ControlTemplate = simpleMarkerSymbol.ControlTemplate, Size = simpleMarkerSymbol.Size, // Simple marker symbol doesn't allow setting OffsetX, OffsetY }; return sms; } TextSymbol textSymbol = symbol as TextSymbol; if (textSymbol != null) { TextSymbol ts = new TextSymbol() { ControlTemplate = textSymbol.ControlTemplate, FontFamily = textSymbol.FontFamily, FontSize = textSymbol.FontSize, Foreground = CloneBrush(textSymbol.Foreground), OffsetX = textSymbol.OffsetX, OffsetY = textSymbol.OffsetY, Text = textSymbol.Text, }; return ts; } PictureMarkerSymbol pictureMarkerSymbol = symbol as PictureMarkerSymbol; if (pictureMarkerSymbol != null) { PictureMarkerSymbol pictMs = new PictureMarkerSymbol() { ControlTemplate = pictureMarkerSymbol.ControlTemplate, Height = pictureMarkerSymbol.Height, OffsetX = pictureMarkerSymbol.OffsetX, OffsetY = pictureMarkerSymbol.OffsetY, Opacity = pictureMarkerSymbol.Opacity, Source = pictureMarkerSymbol.Source, Width = pictureMarkerSymbol.Width, }; return pictMs; } MarkerSymbol markerS = new MarkerSymbol() { ControlTemplate = symbol.ControlTemplate, OffsetX = symbol.OffsetX, OffsetY = symbol.OffsetY, }; return markerS; }
/// <summary> /// /// </summary> /// <param name="symbol"></param> public void SetSelectionMarkerSymbol(MarkerSymbol symbol) { markerSymbol = symbol; }
public MarkerElement(MarkerSymbol symbol, IPoint point) : this(symbol, Point.FromCommon(point)) { }
public MarkerElement(MarkerSymbol symbol, Point point) { Symbol = symbol; Point = point; }
/// <summary> /// Required method for ArcGIS Component Category unregistration - /// Do not modify the contents of this method with the code editor. /// </summary> private static void ArcGISCategoryUnregistration(Type registerType) { string str = string.Format("HKEY_CLASSES_ROOT\\CLSID\\{{{0}}}", registerType.GUID); MarkerSymbol.Unregister(str); }
private Traces MakeData() { var function = new TraceReal { Pen = new System.Drawing.Pen(System.Drawing.Color.SkyBlue), Name = "Ft, C2, Transistor, T240", IsGistogram = true, IsVisibleInMarker = true, Visible = true, GraphIndex = 0, CoordinateSystemType = CoordinateSystemType.Rectangle, ArgumentQuantityType = PhysicalQuantityType.Frequencies }; var symbol = new MarkerSymbol { Type = MarkerSymbolType.Circle, Visible = false }; function.Symbol = symbol; function.SymbolInterval = 1; function.SymbolsAutoInterval = false; var values = new[] { 38603499999.999992, 32817999999.999996, 36808000000.0, 40000000000.0, 31820499999.999996, 40000000000.0, 32817999999.999996, 40000000000.0, 40000000000.0, 40000000000.0, 37606000000.0, 40000000000.0, 40000000000.0, 40000000000.0, 40000000000.0, 40000000000.0, 32418999999.999996, 40000000000.0, 40000000000.0, 27431500000.0 }; var gistogram = Calculations.Gistogram(values); if (gistogram.Keys.Count == 1) { var dataSector = new GraphDataSectorReal { new PointValueReal(gistogram.Keys.ElementAt(0), gistogram[gistogram.Keys.ElementAt(0)]) }; function.Add(dataSector); } else { for (int i = 0; i < gistogram.Keys.Count - 1; i++) { var dataSector = new GraphDataSectorReal(); dataSector.Add(new PointValueReal(gistogram.Keys.ElementAt(i), gistogram[gistogram.Keys.ElementAt(i + 1)])); dataSector.Add(new PointValueReal(gistogram.Keys.ElementAt(i + 1), gistogram[gistogram.Keys.ElementAt(i + 1)])); function.Add(dataSector); } } var result = new Traces(); result.RealFunctions.Add(function); var meanFunction = new TraceReal { Pen = new System.Drawing.Pen(System.Drawing.Color.Green), Name = "Mean Ft, C2, Transistor, T240", IsGistogram = true, IsVisibleInMarker = true, Visible = true, GraphIndex = 0, CoordinateSystemType = CoordinateSystemType.Rectangle, ArgumentQuantityType = PhysicalQuantityType.Frequencies }; var meanSymbol = new MarkerSymbol { Type = MarkerSymbolType.Circle, Visible = true }; meanFunction.Symbol = meanSymbol; meanFunction.SymbolInterval = 1; meanFunction.SymbolsAutoInterval = false; var meanValue = Calculations.MeanValue(values); var maxDiapason = Calculations.MaxDiapasonValue(values); var meanDataSector = new GraphDataSectorReal { new PointValueReal(meanValue, maxDiapason) }; meanFunction.Add(meanDataSector); result.RealFunctions.Add(meanFunction); var sigmaFunction = new TraceReal { Pen = new System.Drawing.Pen(System.Drawing.Color.Blue), Name = "3 sigma Ft, C2, Transistor, T240", IsGistogram = true, IsVisibleInMarker = true, Visible = true, GraphIndex = 0, CoordinateSystemType = CoordinateSystemType.Rectangle, ArgumentQuantityType = PhysicalQuantityType.Frequencies }; sigmaFunction.Symbol = meanSymbol; sigmaFunction.SymbolInterval = 1; sigmaFunction.SymbolsAutoInterval = false; var sigma = Calculations.Sigma(values); var sigmaDataSector = new GraphDataSectorReal { new PointValueReal(meanValue - 3 * sigma, maxDiapason) }; sigmaFunction.Add(sigmaDataSector); sigmaDataSector = new GraphDataSectorReal { new PointValueReal(meanValue + 3 * sigma, maxDiapason) }; sigmaFunction.Add(sigmaDataSector); result.RealFunctions.Add(sigmaFunction); var gausFunction = new TraceReal { Pen = new System.Drawing.Pen(System.Drawing.Color.Red), Name = "Gaus Ft, C2, Transistor, T240", IsGistogram = false, IsVisibleInMarker = true, Visible = true, GraphIndex = 0, CoordinateSystemType = CoordinateSystemType.Rectangle, ArgumentQuantityType = PhysicalQuantityType.Frequencies }; gausFunction.Symbol = symbol; gausFunction.SymbolInterval = 1; gausFunction.SymbolsAutoInterval = false; var gausDataSector = new GraphDataSectorReal(); var gaus = Calculations.Gaussian(values); foreach (var valueReal in gaus) { gausDataSector.Add(valueReal); } gausFunction.Add(gausDataSector); result.RealFunctions.Add(gausFunction); return result; }
/// <summary> /// Returns true if ChartItemConfigBean instances are equal /// </summary> /// <param name="input">Instance of ChartItemConfigBean to be compared</param> /// <returns>Boolean</returns> public bool Equals(ChartItemConfigBean input) { if (input == null) { return(false); } return (( Item == input.Item || (Item != null && Item.Equals(input.Item)) ) && ( Axis == input.Axis || (Axis != null && Axis.Equals(input.Axis)) ) && ( Label == input.Label || (Label != null && Label.Equals(input.Label)) ) && ( Chart == input.Chart || (Chart != null && Chart.Equals(input.Chart)) ) && ( Legend == input.Legend || (Legend != null && Legend.Equals(input.Legend)) ) && ( Fill == input.Fill || (Fill != null && Fill.Equals(input.Fill)) ) && ( LineColor == input.LineColor || (LineColor != null && LineColor.Equals(input.LineColor)) ) && ( LineWidth == input.LineWidth || (LineWidth != null && LineWidth.Equals(input.LineWidth)) ) && ( LineStyle == input.LineStyle || (LineStyle != null && LineStyle.Equals(input.LineStyle)) ) && ( MarkerColor == input.MarkerColor || (MarkerColor != null && MarkerColor.Equals(input.MarkerColor)) ) && ( MarkerSymbol == input.MarkerSymbol || (MarkerSymbol != null && MarkerSymbol.Equals(input.MarkerSymbol)) ) && ( RepeatTime == input.RepeatTime || (RepeatTime != null && RepeatTime.Equals(input.RepeatTime)) )); }
private static geStyle ConvertToPointStyle(MarkerSymbol pointSym) { geIconStyle iconStyle; geStyle style; string hashId; string href; hashId = pointSym.GetHashCode().ToString(); href = string.Format("files/{0}.png", hashId); style = new geStyle(hashId); iconStyle = new geIconStyle(); iconStyle.Icon = new geIcon(href); iconStyle.Scale = 0.8F; iconStyle.HotSpot = new geVec2(); iconStyle.HotSpot.xunits = geUnitsEnum.insetPixels; iconStyle.HotSpot.yunits = geUnitsEnum.insetPixels; iconStyle.HotSpot.x = pointSym.OffsetX; iconStyle.HotSpot.y = pointSym.OffsetY; style.IconStyle = iconStyle; return style; }
private Traces MakeData(ShewharMeasurement measurement) { var symbol = new MarkerSymbol { Type = MarkerSymbolType.Circle, Visible = true }; var function = new TraceReal { Pen = new System.Drawing.Pen(System.Drawing.Color.Green) { Width = 1 }, Name = "Shewhart", IsGistogram = false, IsVisibleInMarker = true, Visible = true, GraphIndex = 0, Approximator = null, ArgumentQuantityType = PhysicalQuantityType.Scalar, SymbolInterval = 1, SymbolsAutoInterval = false, Symbol = symbol }; var noneSymbol = new MarkerSymbol { Type = MarkerSymbolType.None, Visible = false }; var meanFunction = new TraceReal { Pen = new System.Drawing.Pen(System.Drawing.Color.Blue), Name = "Mean", IsGistogram = false, IsVisibleInMarker = true, Visible = true, GraphIndex = 0, Approximator = null, ArgumentQuantityType = PhysicalQuantityType.Scalar, Symbol = noneSymbol }; var uclSymbol = new MarkerSymbol { Type = MarkerSymbolType.TriangleUp, Visible = true }; var uclFunction = new TraceReal { Pen = new System.Drawing.Pen(System.Drawing.Color.Red), Name = "UCL", IsGistogram = false, IsVisibleInMarker = true, Visible = true, GraphIndex = 0, Approximator = null, ArgumentQuantityType = PhysicalQuantityType.Scalar, Symbol = noneSymbol }; var cUpFunction = new TraceReal { Pen = new System.Drawing.Pen(System.Drawing.Color.FromArgb(255, 192, 192)) { DashPattern = new[] { 4.0F, 8.0F } }, Name = "C above mean", Visible = true, GraphIndex = 0, Approximator = null, ArgumentQuantityType = PhysicalQuantityType.Scalar, Symbol = noneSymbol }; var bUpFunction = new TraceReal { Pen = new System.Drawing.Pen(System.Drawing.Color.FromArgb(255, 128, 128)) { DashPattern = new[] { 4.0F, 8.0F } }, Name = "B above mean", Visible = true, GraphIndex = 0, Approximator = null, ArgumentQuantityType = PhysicalQuantityType.Scalar, Symbol = noneSymbol }; var lclSymbol = new MarkerSymbol { Type = MarkerSymbolType.TriangleDown, Visible = true }; var lclFunction = new TraceReal { Pen = new System.Drawing.Pen(System.Drawing.Color.Red), Name = "LCL", IsGistogram = false, IsVisibleInMarker = true, Visible = true, GraphIndex = 0, Approximator = null, ArgumentQuantityType = PhysicalQuantityType.Scalar, Symbol = noneSymbol }; var cDownFunction = new TraceReal { Pen = new System.Drawing.Pen(System.Drawing.Color.FromArgb(255, 192, 192)) { DashPattern = new[] { 4.0F, 8.0F } }, Name = "C below mean", Visible = true, GraphIndex = 0, Approximator = null, ArgumentQuantityType = PhysicalQuantityType.Scalar, Symbol = noneSymbol }; var bDownFunction = new TraceReal { Pen = new System.Drawing.Pen(System.Drawing.Color.FromArgb(255, 128, 128)) { DashPattern = new[] { 4.0F, 8.0F } }, Name = "B below mean", Visible = true, GraphIndex = 0, Approximator = null, ArgumentQuantityType = PhysicalQuantityType.Scalar, Symbol = noneSymbol }; var minSpecFunction = new TraceReal { Pen = new System.Drawing.Pen(System.Drawing.Color.FromArgb(64, 64, 64)), Name = "Min spec", Visible = true, GraphIndex = 0, Approximator = null, ArgumentQuantityType = PhysicalQuantityType.Scalar, Symbol = noneSymbol }; var maxSpecFunction = new TraceReal { Pen = new System.Drawing.Pen(System.Drawing.Color.FromArgb(64, 64, 64)), Name = "Max spec", Visible = true, GraphIndex = 0, Approximator = null, ArgumentQuantityType = PhysicalQuantityType.Scalar, Symbol = noneSymbol }; var nominalSpecFunction = new TraceReal { Pen = new System.Drawing.Pen(System.Drawing.Color.Black), Name = "Nominal spec", Visible = true, GraphIndex = 0, Approximator = null, ArgumentQuantityType = PhysicalQuantityType.Scalar, Symbol = noneSymbol }; var functionDataSector = new GraphDataSectorReal(); var meanDataSector = new GraphDataSectorReal(); var uclDataSector = new GraphDataSectorReal(); var cUpDataSector = new GraphDataSectorReal(); var bUpDataSector = new GraphDataSectorReal(); var lclDataSector = new GraphDataSectorReal(); var cDownDataSector = new GraphDataSectorReal(); var bDownDataSector = new GraphDataSectorReal(); var minSpecDataSector = new GraphDataSectorReal(); var maxSpecDataSector = new GraphDataSectorReal(); var nominalSpecDataSector = new GraphDataSectorReal(); var values = new List<double> {378, 376, 375, 370, 371, 388, 389, 390, 388, 400, 391, 392, 386, 382, 378, 374, 370, 380, 381, 387}; var meanvalue = 382.3; var sigma = 8.25; var uclValue = meanvalue + 3*sigma; var bUpValue = meanvalue + 2*sigma; var cUpValue = meanvalue + sigma; var lclValue = meanvalue - 3*sigma; var bDownValue = meanvalue - 2*sigma; var cDownValue = meanvalue - sigma; double? usersMinSpec = 340; double? usersMaxSpec = 420; double? usersNominalSpec = 380; for (int i = 0; i < values.Count; i++) { functionDataSector.Add(new PointValueReal(i, values[i])); meanDataSector.Add(new PointValueReal(i, meanvalue)); uclDataSector.Add(new PointValueReal(i, uclValue)); bUpDataSector.Add(new PointValueReal(i, bUpValue)); cUpDataSector.Add(new PointValueReal(i, cUpValue)); lclDataSector.Add(new PointValueReal(i, lclValue)); bDownDataSector.Add(new PointValueReal(i, bDownValue)); cDownDataSector.Add(new PointValueReal(i, cDownValue)); if (usersMinSpec.HasValue) minSpecDataSector.Add(new PointValueReal(i, usersMinSpec.Value)); if (usersMaxSpec.HasValue) maxSpecDataSector.Add(new PointValueReal(i, usersMaxSpec.Value)); if (usersNominalSpec.HasValue) nominalSpecDataSector.Add(new PointValueReal(i, usersNominalSpec.Value)); } function.Add(functionDataSector); meanFunction.Add(meanDataSector); uclFunction.Add(uclDataSector); bUpFunction.Add(bUpDataSector); cUpFunction.Add(cUpDataSector); lclFunction.Add(lclDataSector); bDownFunction.Add(bDownDataSector); cDownFunction.Add(cDownDataSector); minSpecFunction.Add(minSpecDataSector); maxSpecFunction.Add(maxSpecDataSector); nominalSpecFunction.Add(nominalSpecDataSector); var result = new Traces(); result.RealFunctions.Add(uclFunction); result.RealFunctions.Add(bUpFunction); result.RealFunctions.Add(cUpFunction); result.RealFunctions.Add(meanFunction); result.RealFunctions.Add(cDownFunction); result.RealFunctions.Add(bDownFunction); result.RealFunctions.Add(lclFunction); result.RealFunctions.Add(maxSpecFunction); result.RealFunctions.Add(nominalSpecFunction); result.RealFunctions.Add(minSpecFunction); result.RealFunctions.Add(function); var points = new List<PointValueReal>(); foreach (var sector in function) { foreach (var pointValueBase in sector) { points.Add((PointValueReal) pointValueBase); } } measurement.TrendManager.SetData(points.ToArray(), sigma, meanvalue); var Cp = (usersMaxSpec.Value - usersMinSpec.Value)/(6*sigma); var Cpk = Math.Min((usersMaxSpec.Value - meanvalue)/(3*sigma), (meanvalue - usersMinSpec.Value)/(3*sigma)); _graphPlotControl.GraphTitle += "\nCp = " + Cp; _graphPlotControl.GraphTitle += "\nCpk = " + Cpk; return result; }