void ESRI.ArcGIS.esriSystem.IPersistVariant.Load(ESRI.ArcGIS.esriSystem.IVariantStream Stream) { // Read the persisted version number first. int lSavedVers = 0; lSavedVers = Convert.ToInt32(Stream.Read()); if ((lSavedVers > m_lCurrPersistVers) | (lSavedVers <= 0)) { throw new Exception("Failed to read from stream"); } // Set members to default values. InitializeMembers(); // Load the first persistance pattern. if (lSavedVers == 1) { m_lROP2 = (esriRasterOpCode)Stream.Read(); m_dSize = Convert.ToDouble(Stream.Read()); m_dXOffset = Convert.ToDouble(Stream.Read()); m_dYOffset = Convert.ToDouble(Stream.Read()); m_dAngle = Convert.ToDouble(Stream.Read()); m_bRotWithTrans = Convert.ToBoolean(Stream.Read()); m_lMapLevel = Convert.ToInt32(Stream.Read()); m_colorTop = Stream.Read() as IColor; m_colorLeft = Stream.Read() as IColor; m_colorRight = Stream.Read() as IColor; m_colorBorder = Stream.Read() as IColor; } }
public IGeometry DrawPolyline(ESRI.ArcGIS.Carto.IActiveView activeView) { if (activeView == null) { return(null); } ESRI.ArcGIS.Display.IScreenDisplay screenDisplay = activeView.ScreenDisplay; // Constant screenDisplay.StartDrawing(screenDisplay.hDC, (System.Int16)ESRI.ArcGIS.Display.esriScreenCache.esriNoScreenCache); // Explicit Cast ESRI.ArcGIS.Display.IRgbColor rgbColor = new ESRI.ArcGIS.Display.RgbColor(); rgbColor.Red = 255; ESRI.ArcGIS.Display.IColor color = rgbColor; // Implicit Cast ESRI.ArcGIS.Display.ISimpleLineSymbol simpleLineSymbol = new SimpleLineSymbol(); simpleLineSymbol.Color = color; simpleLineSymbol.Style = esriSimpleLineStyle.esriSLSDashDot; ESRI.ArcGIS.Display.ISymbol symbol = (ESRI.ArcGIS.Display.ISymbol)simpleLineSymbol; // Explicit Cast ESRI.ArcGIS.Display.IRubberBand rubberBand = new RubberLine(); ESRI.ArcGIS.Geometry.IGeometry geometry = rubberBand.TrackNew(screenDisplay, symbol); screenDisplay.SetSymbol(symbol); screenDisplay.DrawPolyline(geometry); screenDisplay.FinishDrawing(); return(geometry); }
void ESRI.ArcGIS.esriSystem.IClone.Assign(ESRI.ArcGIS.esriSystem.IClone src) { GIS.IGasPressureSymbol srcLogoSym = null; ESRI.ArcGIS.Display.IMarkerSymbol srcMarkerSym = null; ESRI.ArcGIS.Display.IMarkerSymbol recMarkerSym = null; ESRI.ArcGIS.Display.ISymbol srcSym = null; ESRI.ArcGIS.Display.ISymbol recSym = null; ESRI.ArcGIS.Display.ISymbolRotation srcRotSym = null; ESRI.ArcGIS.Display.ISymbolRotation recRotSym = null; ESRI.ArcGIS.Display.IMapLevel srcMapLev = null; ESRI.ArcGIS.Display.IMapLevel recMapLev = null; if (src != null) { if (src is GIS.IGasPressureSymbol) { // Assign custom interface properties of Source to Reciever. // Color objects are returned from these properties by value. srcLogoSym = src as IGasPressureSymbol; m_colorBorder = srcLogoSym.ColorBorder; m_colorLeft = srcLogoSym.ColorLeft; m_colorRight = srcLogoSym.ColorRight; m_colorTop = srcLogoSym.ColorTop; // Assign IMarkerSymbol interface properties of Source to Reciever, but // dont need to set Color because this is set in ColorTop. // We know that a Logo markerSymbol implements IMarkerSymbol. srcMarkerSym = src as IMarkerSymbol; recMarkerSym = this; recMarkerSym.Angle = srcMarkerSym.Angle; recMarkerSym.Size = srcMarkerSym.Size; recMarkerSym.XOffset = srcMarkerSym.XOffset; recMarkerSym.YOffset = srcMarkerSym.YOffset; // Assign ISymbol interface properties of Source to Reciever. // We know that a Logo markerSymbol implements ISymbol. srcSym = src as ISymbol; recSym = this; recSym.ROP2 = srcSym.ROP2; // Assign ISymbolRotation interface properties of Source to Reciever. // We know that a Logo markerSymbol implements ISymbolRotation. srcRotSym = src as ISymbolRotation; recRotSym = this; recRotSym.RotateWithTransform = srcRotSym.RotateWithTransform; // Assign IMapLevel interface properties of Source to Reciever. // We know that a Logo markerSymbol implements IMapLevel. srcMapLev = src as IMapLevel; recMapLev = this; recMapLev.MapLevel = srcMapLev.MapLevel; // Also implements IMarkerMask, but this interface has no properties, only // a method, and therefore we dont have to assign anything for IMarkerMask. // Also implements IDiplayName, but this interface only has one property, // which is read-only, so we dont set anything for IDisplayName either. } } }
private void Terminate() { // Which variables do we really need to dereference here, just the transformation, // or any other globals as well?? m_trans = null; m_colorTop = null; m_colorLeft = null; m_colorRight = null; m_colorBorder = null; }
private void FormOptions_Load(object sender, EventArgs e) { //在窗体加载时获取当前选择环境设置的默认颜色和默认容限值 //首先获取当前选择环境对象的默认颜色 ESRI.ArcGIS.Display.IColor esriColor = currentSelectionEnvironment.DefaultColor; //对IColor接口的对象进行接口转换,以便使用RGB颜色值 ESRI.ArcGIS.Display.IRgbColor rgbColor = esriColor as ESRI.ArcGIS.Display.IRgbColor; //根据获取的RGB值,创建Windows颜色对象 System.Drawing.Color color = System.Drawing.Color.FromArgb(rgbColor.Red, rgbColor.Green, rgbColor.Green); //将创建的Windows颜色对象应用于pictureBoxColor控件的背景颜色中 pictureBoxColor.BackColor = color; //获取并显示当前选择环境的默认容限值 textBoxTolerance.Text = currentSelectionEnvironment.SearchTolerance.ToString(); }
public void DrawRectangle(ESRI.ArcGIS.Carto.IActiveView activeView) { if (activeView == null) { return; } ESRI.ArcGIS.Display.IScreenDisplay screenDisplay = activeView.ScreenDisplay; screenDisplay.StartDrawing(screenDisplay.hDC, (System.Int16)ESRI.ArcGIS.Display.esriScreenCache.esriNoScreenCache); // Explicit Cast ESRI.ArcGIS.Display.IRgbColor rgbColor = new ESRI.ArcGIS.Display.RgbColorClass(); rgbColor.Red = 255; ESRI.ArcGIS.Display.IColor color = rgbColor; // Implicit Cast ESRI.ArcGIS.Display.ISimpleFillSymbol simpleFillSymbol = new ESRI.ArcGIS.Display.SimpleFillSymbolClass(); simpleFillSymbol.Color = color; ESRI.ArcGIS.Display.ISymbol symbol = simpleFillSymbol as ESRI.ArcGIS.Display.ISymbol; // Dynamic Cast ESRI.ArcGIS.Display.IRubberBand rubberBand = new ESRI.ArcGIS.Display.RubberEnvelopeClass(); ESRI.ArcGIS.Geometry.IGeometry geometry = rubberBand.TrackNew(screenDisplay, symbol); screenDisplay.SetSymbol(symbol); screenDisplay.DrawRectangle(geometry as ESRI.ArcGIS.Geometry.IEnvelope); // Dynamic Cast screenDisplay.FinishDrawing(); }
private void InitializeMembers() { // Set up default values as far as possible. m_lhDC = 0; m_lOldPen = 0; m_lPen = 0; m_lOldBrush = 0; m_lBrushTop = 0; m_lBrushLeft = 0; m_lBrushRight = 0; m_dDeviceRadius = 0; m_trans = null; // LogoMarkerSymbol custom property defaults. IColor color = null; color = (IColor)ESRI.ArcGIS.ADF.Converter.ToRGBColor(Color.Red); m_colorTop = ((IClone)color).Clone() as IColor; color = (IColor)ESRI.ArcGIS.ADF.Converter.ToRGBColor(Color.OrangeRed); m_colorLeft = ((IClone)color).Clone() as IColor; color = (IColor)ESRI.ArcGIS.ADF.Converter.ToRGBColor(Color.Pink); m_colorRight = ((IClone)color).Clone() as IColor; color = (IColor)ESRI.ArcGIS.ADF.Converter.ToRGBColor(Color.Black); m_colorBorder = ((IClone)color).Clone() as IColor; // ISymbol property defaults. m_lROP2 = esriRasterOpCode.esriROPCopyPen; // IMarkerSymbol property defaults. m_dSize = 10; m_dAngle = 0; m_dXOffset = 0; m_dYOffset = 0; // ISymbolRotation property defaults. m_bRotWithTrans = true; }