private void CheckLine() { if (_editor.SelectedItems != null && _editor.SelectedItems.Count == 1 && _editor.SelectedItems[0] is Helios.Controls.LineDecoration) { if (!_isline) { _children.Remove(_bottomLeft); _children.Remove(_bottomRight); _topRight.Cursor = Cursors.Cross; _topLeft.Cursor = Cursors.Cross; } Helios.Controls.LineDecoration line = _editor.SelectedItems[0] as Helios.Controls.LineDecoration; _tempLine = new Helios.Controls.LineDecoration(); _tempLine.Clone(line); _isline = true; } else { if (_isline) { _children.Add(_bottomLeft); _children.Add(_bottomRight); _topRight.Cursor = Cursors.SizeNESW; _topLeft.Cursor = Cursors.SizeNWSE; } _tempLine = null; _isline = false; } }
private void hiliteLineToolStripMenuItem_Click(object sender, EventArgs e) { codeBox.Decorations.Clear(); Dialogs.DiaLineNumbers dia = new Dialogs.DiaLineNumbers(); if (dia.ShowDialog() == DialogResult.OK) { if (dia.LineNumbers.Count > 0) { if (dia.LineNumbers.Count == 1) { LineDecoration ld = new LineDecoration() { DecorationType = WinFormsCodeBox.Decorations.EDecorationType.Hilight, Color = Color.Yellow, Line = dia.LineNumbers[0] }; codeBox.Decorations.Add(ld); } else { MultiLineDecoration ld = new MultiLineDecoration() { DecorationType = WinFormsCodeBox.Decorations.EDecorationType.Hilight, Color = Color.Yellow, Lines = dia.LineNumbers }; codeBox.Decorations.Add(ld); } } } codeBox.ApplyDecorations(); }
private void ccDecorations_AddClicked(object sender, EventArgs e) { ICartographicStroke currentStroke = ccStrokes.SelectedStroke as ICartographicStroke; if (currentStroke != null) { LineDecoration decoration = new LineDecoration(); currentStroke.Decorations.Add(decoration); ccDecorations.RefreshList(); ccDecorations.SelectedDecoration = decoration; } }
public static ILineSymbol CreateLineDirectionSymbol() { ILineSymbol symbol = new CartographicLineSymbol(); symbol.Color = ColorHelper.CreateColor(0, 0, 200); LineDecoration class2 = new LineDecoration(); SimpleLineDecorationElement lineDecorationElement = new SimpleLineDecorationElement(); lineDecorationElement.AddPosition(0.3); lineDecorationElement.AddPosition(0.7); lineDecorationElement.PositionAsRatio = true; IMarkerSymbol symbol2 = (lineDecorationElement.MarkerSymbol as IClone).Clone() as IMarkerSymbol; symbol2.Size = 9.0; symbol2.Color = ColorHelper.CreateColor(0, 200, 0); lineDecorationElement.MarkerSymbol = symbol2; class2.AddElement(lineDecorationElement); (symbol as ILineProperties).LineDecoration = class2; return(symbol); }
internal LineDecorationSerializable(ParsedEvtcLog log, LineDecoration decoration, CombatReplayMap map) : base(log, decoration, map) { Type = "Line"; ConnectedFrom = decoration.ConnectedFrom.GetConnectedTo(map, log); }
private ISymbol GetFeatureSymbol(IFeature Feature) { ICartographicLineSymbol hashsym = null; IRgbColor pcolor = null; ILineSymbol lsym = null; // ISimpleEdgeFeature seFeat = null; ILineProperties lineProperties = null; IArrowMarkerSymbol aMSymbol = null; ILineDecoration lineDecoration = null; ISimpleLineDecorationElement simpleLineDecorationElement = null; IMarkerSymbol smSym = null; bool isMultiLyrSym = false; int multiLyrSymIndex = -1; try { if (Feature.HasOID) { int status = 0; if (string.Compare(Feature.Class.AliasName.Substring(Feature.Class.AliasName.LastIndexOf('.') + 1), "PrimaryConductor", true) == 0) { if (ExtensionInfo.netUtil.primaryStatuses.ContainsKey(Feature.OID)) status = ExtensionInfo.netUtil.primaryStatuses[Feature.OID]; } else if (ExtensionInfo.netUtil.secondaryStatuses.ContainsKey(Feature.OID)) status = ExtensionInfo.netUtil.secondaryStatuses[Feature.OID]; //int fldIndexGUID = Feature.Fields.FindField("FuturaGUID"); //if (fldIndexGUID != -1) //{ // IFeatureClass featCls = Feature.Class as IFeatureClass; // IFeature feat = featCls.GetFeature(Feature.OID); // string guid = feat.get_Value(fldIndexGUID).ToString(); // if (guid != null) // status = (int)NetworkExtension.FuturaNetworkExt.netUtil._sectionList[guid].status; //} // int status = NetworkExtension.FuturaNetworkExt.netUtil._sectionList.Values.FirstOrDefault(obj => (obj.objectId == Feature.OID && string.Compare(Feature.Class.AliasName.Substring(Feature.Class.AliasName.LastIndexOf('.')+1), obj.className, true) == 0)).status; // string guid = Feature.get_Value(Feature.Fields.FindField("FuturaGUID")).ToString(); // int status = NetworkExtension.FuturaNetworkExt.netUtil._sectionList[guid].status; pcolor = new RgbColor(); //FeatureRenderer.PrepareFilter(Feature.Class as IFeatureClass, new QueryFilterClass()); //below line used to get default linesymbol of a featureclass lsym = FeatureRenderer.get_SymbolByFeature(Feature) as ILineSymbol; if (lsym is ICartographicLineSymbol) hashsym = lsym as ICartographicLineSymbol; else if (lsym is IMultiLayerLineSymbol) { IMultiLayerLineSymbol multiLyrLineSymbol = lsym as IMultiLayerLineSymbol; for (int i = 0; i < multiLyrLineSymbol.LayerCount; i++) { if (multiLyrLineSymbol.get_Layer(i) != null && multiLyrLineSymbol.get_Layer(i) is ICartographicLineSymbol) { hashsym = multiLyrLineSymbol.get_Layer(i) as ICartographicLineSymbol; isMultiLyrSym = true; multiLyrSymIndex = i; break; } } } if (hashsym == null) { hashsym = new CartographicLineSymbolClass(); hashsym.Color = lsym.Color; hashsym.Width = lsym.Width; } if (FeatureSelection.SelectionSet.Count > 0 && IsSelected(Feature.OID)) { //if (MobileSettings.settings.UserSettings.TraceSettings.LineColor.R == 0 && MobileSettings.settings.UserSettings.TraceSettings.LineColor.G == 255 && MobileSettings.settings.UserSettings.TraceSettings.LineColor.B == 255) //{ // pcolor.Red = 0; // pcolor.Green = 255; // pcolor.Blue = 0; //} //else //{ pcolor.Red = 0; pcolor.Green = 255; pcolor.Blue = 255; // } //lsym.Color = pcolor; //lsym.Width = lsym.Width + 1; hashsym.Color = pcolor; hashsym.Width = hashsym.Width + 1; } else { //pcolor.Red = MobileSettings.settings.UserSettings.TraceSettings.LineColor.R; //pcolor.Green = MobileSettings.settings.UserSettings.TraceSettings.LineColor.G; //pcolor.Blue = MobileSettings.settings.UserSettings.TraceSettings.LineColor.B; //lsym.Color = pcolor; } if (Feature.Shape.GeometryType == esriGeometryType.esriGeometryLine || Feature.Shape.GeometryType == esriGeometryType.esriGeometryPolyline) { // SectionObject sObj = null; // Orientation dir = Orientation.Uninitialized; // seFeat = Feature as ISimpleEdgeFeature; // int fldIndexGUID = Feature.Fields.FindField(((IClassEx)Feature.Class).GlobalIDFieldName); // if(fldIndexGUID != -1) // { //IFeatureClass featCls = Feature.Class as IFeatureClass; //IFeature feat = featCls.GetFeature(Feature.OID); //object guid = feat.get_Value(fldIndexGUID); // if (guid != null) // sObj = secElements.ContainsKey(guid.ToString()) ? secElements[guid.ToString()] : null; //if(sObj != null) //{ // IPolyline pl = Feature.ShapeCopy as IPolyline; // NodeObject fNode = nodeElements.ContainsKey(sObj.Parent) ? nodeElements[sObj.Parent] : null; // NodeObject tNode = nodeElements.ContainsKey(sObj.Child) ? nodeElements[sObj.Child] : null; // if(fNode != null && tNode != null) // { // if (Math.Abs(fNode.X - pl.FromPoint.X) < 0.001 && Math.Abs(fNode.Y - pl.FromPoint.Y) < 0.001) // dir = Orientation.WithFlow; // else // dir = Orientation.AgainstFlow; // } //} // } //bool isPrimary = string.Compare(Feature.Class.AliasName, "PrimaryConductor", true) == 0; //try //{ // if (isPrimary && PrimaryFlowDirections != null) // dir = PrimaryFlowDirections[Feature.OID]; // // dir = secElements.Values.FirstOrDefault(obj => (obj.OID == Feature.OID && string.Compare(Feature.Class.AliasName, obj.LayerName, true) == 0)); // else if (SecFlowDirections != null) // dir = SecFlowDirections[Feature.OID]; //} //catch //{ // dir = Orientation.Uninitialized; //} //if (sObj != null) // { // dir = sObj.FlowDirection; //IPolyline pl = Feature.ShapeCopy as IPolyline; //NodeObject fNode = nodeElements.ContainsKey(sObj.Parent) ? nodeElements[sObj.Parent] : null; //NodeObject tNode = nodeElements.ContainsKey(sObj.Child) ? nodeElements[sObj.Child] : null; //if (fNode != null && tNode != null) //{ // bool isUninitialized = false; // if (string.Compare(fNode.LayerName, FuturaNetJunctions.Futura_NetJunctions_TableName, true) == 0 && secElements.Values.FirstOrDefault(obj => (obj.Child == fNode.GUID)) == null) // dir = Orientation.Indeterminate; // else // { // if (Math.Abs(fNode.X - pl.FromPoint.X) < 0.001 && Math.Abs(fNode.Y - pl.FromPoint.Y) < 0.001) // dir = Orientation.WithFlow; // else // dir = Orientation.AgainstFlow; // } //} // } lineProperties = hashsym as ILineProperties; simpleLineDecorationElement = new SimpleLineDecorationElement(); if (FuturaNetwork.StatusExtensions.IsLoop(status)) simpleLineDecorationElement.MarkerSymbol = DefaultUninitializedSymbol(); else if (FuturaNetwork.StatusExtensions.IsEnergized(status)) { //if (smSym == null) // smSym = Global.DefaultFlowSymbol(); if (FuturaNetwork.StatusExtensions.BreakDown(status).Contains(FuturaNetwork.Constants.WithFlow)) simpleLineDecorationElement.MarkerSymbol = DefaultFlowSymbol(false); else simpleLineDecorationElement.MarkerSymbol = DefaultFlowSymbol(true); } else simpleLineDecorationElement.MarkerSymbol = DefaultUninitializedSymbol(); simpleLineDecorationElement.AddPosition(0.5); simpleLineDecorationElement.PositionAsRatio = true; lineDecoration = new LineDecoration(); lineDecoration.AddElement(simpleLineDecorationElement); lineProperties.LineDecoration = lineDecoration; } ISymbol featSymbol = null; if (isMultiLyrSym && multiLyrSymIndex != -1) { IMultiLayerLineSymbol multiLyrLineSymbol = lsym as IMultiLayerLineSymbol; if (multiLyrLineSymbol.get_Layer(multiLyrSymIndex) != null && multiLyrLineSymbol.get_Layer(multiLyrSymIndex) is ICartographicLineSymbol) { ILineSymbol lineSymbol = multiLyrLineSymbol.get_Layer(multiLyrSymIndex); multiLyrLineSymbol.DeleteLayer(lineSymbol); multiLyrLineSymbol.AddLayer(hashsym as ILineSymbol); } featSymbol = multiLyrLineSymbol as ISymbol; } else featSymbol = hashsym as ISymbol; return featSymbol; } else { return null; } } catch (Exception ex) { //EngineLogger.Logger.LogException(ex); return null; } finally { hashsym = null; pcolor = null; lsym = null; //seFeat = null; lineProperties = null; aMSymbol = null; lineDecoration = null; simpleLineDecorationElement = null; smSym = null; } }
private void ccDecorations_AddClicked(object sender, EventArgs e) { ICartographicStroke currentStroke = ccStrokes.SelectedStroke as ICartographicStroke; if (currentStroke != null) { LineDecoration decoration = new LineDecoration(); currentStroke.Decorations.Add(decoration); ccDecorations.RefreshList(); ccDecorations.SelectedDecoration = decoration; } }
/// <summary> /// 带箭头的线段 /// </summary> /// <param name="start"></param> /// <param name="end"></param> /// <param name="fillColor"></param> public static void TrackLine(IPoint start, IPoint end, Color fillColor) { //将线段打断生成两条线段 以实现线段中间箭头显示 IPoint middle = new PointClass(); middle.PutCoords((end.X + start.X) / 2, (end.Y + start.Y) / 2); IActiveView pActiveView = Program.myMap.ActiveView; IGraphicsContainer pGraphicsContainer = pActiveView.GraphicsContainer; IPolyline pLine = new PolylineClass(); IPolyline pLine1 = new PolylineClass(); pLine.FromPoint = start; pLine.ToPoint = middle; pLine1.FromPoint = middle; pLine1.ToPoint = end; pLine.Project(pActiveView.FocusMap.SpatialReference); pLine1.Project(pActiveView.FocusMap.SpatialReference); ICartographicLineSymbol pCartoLineSymbol = new CartographicLineSymbol(); pCartoLineSymbol.Cap = esriLineCapStyle.esriLCSRound; ILineProperties pLineProp = pCartoLineSymbol as ILineProperties; pLineProp.DecorationOnTop = true; ILineDecoration pLineDecoration = new LineDecoration(); ISimpleLineDecorationElement pSimpleLineDecoElem = new SimpleLineDecorationElement(); pSimpleLineDecoElem.AddPosition(1); IArrowMarkerSymbol pArrowMarkerSym = new ArrowMarkerSymbol(); pArrowMarkerSym.Size = 12; pArrowMarkerSym.Color = GetColor(fillColor.R, fillColor.G, fillColor.B); pSimpleLineDecoElem.MarkerSymbol = pArrowMarkerSym as IMarkerSymbol; pLineDecoration.AddElement(pSimpleLineDecoElem as ILineDecorationElement); pLineProp.LineDecoration = pLineDecoration; ILineSymbol pLineSymbol = pCartoLineSymbol as ILineSymbol; pLineSymbol.Color = GetColor(fillColor.R, fillColor.G, fillColor.B);; pLineSymbol.Width = 2; ILineElement pLineElem = new LineElementClass(); ILineElement pLineElem1 = new LineElementClass(); pLineElem.Symbol = pLineSymbol; pLineElem1.Symbol = pLineSymbol; IElement pElem = pLineElem as IElement; IElement pElem1 = pLineElem1 as IElement; pElem.Geometry = pLine; pElem1.Geometry = pLine1; pGraphicsContainer.AddElement(pElem, 0); pGraphicsContainer.AddElement(pElem1, 0); pActiveView.Refresh(); }
private void btnRender_Click(object sender, EventArgs e) { IGeoFeatureLayer geoLayer = GetLayerByName(cboLayer.Text); MessageBox.Show(geoLayer.FeatureClass.ShapeType.ToString()); switch (m_strOption) { // case "Simple": IRgbColor rgbColor = new RgbColor(); rgbColor.Red = Convert.ToInt32(cboRed.Text); rgbColor.Green = Convert.ToInt32(cboGreen.Text); rgbColor.Blue = Convert.ToInt32(cboGreen.Text); //only used to Polygon Layer ISymbol sym = null; //Acording the shape type, use different sympol if (geoLayer.FeatureClass.ShapeType == esriGeometryType.esriGeometryPolygon) { //Polygon Feature //Orginate Code // ISimpleFillSymbol fillSym = new SimpleFillSymbol() ; //sym.style // fillSym.Style = esriSimpleFillStyle.esriSFSSolid; //sym.color // fillSym.Color = rgbColor; //new Code for IGradientFillSymbol by jin IGradientFillSymbol fillSym = new GradientFillSymbol(); fillSym.Style = esriGradientFillStyle.esriGFSBuffered; IRgbColor fromColor = new RgbColor(); fromColor.Red = 255; fromColor.Green = 0; fromColor.Blue = 0; IRgbColor toColor = new RgbColor(); toColor.Red = 0; toColor.Green = 0; toColor.Blue = 255; IAlgorithmicColorRamp ramp = new AlgorithmicColorRamp(); ramp.Size = 16; ramp.FromColor = fromColor; ramp.ToColor = toColor; fillSym.ColorRamp = ramp; sym = fillSym as ISymbol; } else if (geoLayer.FeatureClass.ShapeType == esriGeometryType.esriGeometryPolyline) { //Line Feature // ISimpleLineSymbol lineSym = new SimpleLineSymbol(); // lineSym.Style = esriSimpleLineStyle.esriSLSSolid; // lineSym.Color = rgbColor; // sym = lineSym as ISymbol; // ICartographicLineSymbol cartLineSym = new CartographicLineSymbol(); cartLineSym.Color = rgbColor; cartLineSym.Cap = esriLineCapStyle.esriLCSSquare; cartLineSym.Join = esriLineJoinStyle.esriLJSMitre; ISimpleLineDecorationElement pSimpleLineDecoEle = new SimpleLineDecorationElement(); pSimpleLineDecoEle.FlipAll = true; pSimpleLineDecoEle.FlipFirst = true; ILineDecoration pLineDeco = new LineDecoration(); pLineDeco.AddElement(pSimpleLineDecoEle); // //QI ILineProperties pLinePro = cartLineSym as ILineProperties; pLinePro.LineDecoration = pLineDeco; sym = cartLineSym as ISymbol; } else if (geoLayer.FeatureClass.ShapeType == esriGeometryType.esriGeometryPoint) { //Point Feature ISimpleMarkerSymbol marketSym = new SimpleMarkerSymbol(); marketSym.Style = esriSimpleMarkerStyle.esriSMSCircle; //;esriSMSX;cross marketSym.Color = rgbColor; sym = marketSym as ISymbol; } ApplySimple(geoLayer, sym); break; case "Unique": ApplyUniqueValue(geoLayer, cboUniqueVals.Text); break; case "Chart": ApplyBarChartValue(geoLayer, cbxProp1.Text); break; case "Breaks": ApplyClsssBreaks(geoLayer, cboNumericVals.Text, long.Parse(cboBreaks.Text)); break; default: break; } }
private void CheckLine() { if (_editor.SelectedItems != null && _editor.SelectedItems.Count == 1 && _editor.SelectedItems[0] is Helios.Controls.LineDecoration) { if (!_isline) { _children.Remove(_bottomLeft); _children.Remove(_bottomRight); _topRight.Cursor = Cursors.Cross; _topLeft.Cursor = Cursors.Cross; } Helios.Controls.LineDecoration line = _editor.SelectedItems[0] as Helios.Controls.LineDecoration; _tempLine = new Helios.Controls.LineDecoration(); _tempLine.Clone(line); _isline = true; } else { if (_isline) { _children.Add(_bottomLeft); _children.Add(_bottomRight); _topRight.Cursor = Cursors.SizeNESW; _topLeft.Cursor = Cursors.SizeNWSE; } _tempLine = null; _isline = false; } }
/// <summary> /// Handles the randomization of the cartographic properties of this stroke. /// </summary> /// <param name="generator">The random class that generates the random numbers</param> protected override void OnRandomize(Random generator) { base.OnRandomize(generator); DashStyle = DashStyle.Custom; _dashCap = generator.NextEnum<DashCap>(); _startCap = generator.NextEnum<LineCap>(); _endCap = generator.NextEnum<LineCap>(); _dashButtons = generator.NextBoolArray(1, 20); _compoundButtons = generator.NextBoolArray(1, 5); _offset = generator.NextFloat(10); _joinType = generator.NextEnum<LineJoinTypes>(); int len = generator.Next(0, 1); if (len > 0) { _decorations.Clear(); LineDecoration ld = new LineDecoration(); ld.Randomize(generator); _decorations.Add(ld); } }