///<summary>Add a North Arrow to the Page Layout from the Map.</summary>
        ///
        ///<param name="pageLayout">An IPageLayout interface.</param>
        ///<param name="map">An IMap interface.</param>
        ///
        ///<remarks></remarks>
        public void AddNorthArrow(IPageLayout pageLayout, IMap map)
        {
            if (pageLayout == null || map == null)
            {
                return;
            }
            ESRI.ArcGIS.Geometry.IEnvelope envelope = new ESRI.ArcGIS.Geometry.EnvelopeClass();
            envelope.PutCoords(1, 24, 5, 24); //  Specify the location and size of the north arrow

            ESRI.ArcGIS.esriSystem.IUID uid = new ESRI.ArcGIS.esriSystem.UIDClass();
            uid.Value = "esriCarto.MarkerNorthArrow";

            // Create a Surround. Set the geometry of the MapSurroundFrame to give it a location
            // Activate it and add it to the PageLayout's graphics container
            ESRI.ArcGIS.Carto.IGraphicsContainer graphicsContainer = pageLayout as ESRI.ArcGIS.Carto.IGraphicsContainer;                    // Dynamic Cast
            ESRI.ArcGIS.Carto.IActiveView        activeView        = pageLayout as ESRI.ArcGIS.Carto.IActiveView;                           // Dynamic Cast
            ESRI.ArcGIS.Carto.IFrameElement      frameElement      = graphicsContainer.FindFrame(map);
            ESRI.ArcGIS.Carto.IMapFrame          mapFrame          = frameElement as ESRI.ArcGIS.Carto.IMapFrame;                           // Dynamic Cast
            ESRI.ArcGIS.Carto.IMapSurroundFrame  mapSurroundFrame  = mapFrame.CreateSurroundFrame(uid as ESRI.ArcGIS.esriSystem.UID, null); // Dynamic Cast
            ESRI.ArcGIS.Carto.IElement           element           = mapSurroundFrame as ESRI.ArcGIS.Carto.IElement;                        // Dynamic Cast
            element.Geometry = envelope;
            element.Activate(activeView.ScreenDisplay);
            graphicsContainer.AddElement(element, 0);
            ESRI.ArcGIS.Carto.IMapSurround mapSurround = mapSurroundFrame.MapSurround;

            // Change out the default north arrow
            ESRI.ArcGIS.Carto.IMarkerNorthArrow        markerNorthArrow      = mapSurround as ESRI.ArcGIS.Carto.IMarkerNorthArrow;         // Dynamic Cast
            ESRI.ArcGIS.Display.IMarkerSymbol          markerSymbol          = markerNorthArrow.MarkerSymbol;
            ESRI.ArcGIS.Display.ICharacterMarkerSymbol characterMarkerSymbol = markerSymbol as ESRI.ArcGIS.Display.ICharacterMarkerSymbol; // Dynamic Cast
            characterMarkerSymbol.CharacterIndex = 200;                                                                                    // change the symbol for the North Arrow
            markerNorthArrow.MarkerSymbol        = characterMarkerSymbol;
        }
示例#2
0
        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.
                }
            }
        }
示例#3
0
        bool ESRI.ArcGIS.esriSystem.IClone.IsEqual(ESRI.ArcGIS.esriSystem.IClone other)
        {
            bool tempIClone_IsEqual = false;
            GIS.IGasPressureSymbol srcLogoSym = null;
            GIS.IGasPressureSymbol pRecLogoSym = 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.IDisplayName srcDispName = null;
            ESRI.ArcGIS.Display.IDisplayName recDispName = null;
            ESRI.ArcGIS.Display.ISymbolRotation srcSymRot = null;
            ESRI.ArcGIS.Display.ISymbolRotation recSymRot = null;
            ESRI.ArcGIS.Display.IMapLevel srcMapLev = null;
            ESRI.ArcGIS.Display.IMapLevel recMapLev = null;
            if (other != null)
            {
                if (other is GIS.IGasPressureSymbol)
                {

                    // Check for equality on default interface.
                    srcLogoSym = other as IGasPressureSymbol;
                    pRecLogoSym = this;
                    tempIClone_IsEqual = tempIClone_IsEqual & (System.Drawing.ColorTranslator.FromOle(System.Convert.ToInt32(pRecLogoSym.ColorBorder.RGB)).Equals(System.Drawing.ColorTranslator.FromOle(System.Convert.ToInt32(srcLogoSym.ColorBorder.RGB))));
                    tempIClone_IsEqual = tempIClone_IsEqual & (System.Drawing.ColorTranslator.FromOle(System.Convert.ToInt32(pRecLogoSym.ColorLeft.RGB)).Equals(System.Drawing.ColorTranslator.FromOle(System.Convert.ToInt32(srcLogoSym.ColorLeft.RGB))));
                    tempIClone_IsEqual = tempIClone_IsEqual & (System.Drawing.ColorTranslator.FromOle(System.Convert.ToInt32(pRecLogoSym.ColorRight.RGB)).Equals(System.Drawing.ColorTranslator.FromOle(System.Convert.ToInt32(srcLogoSym.ColorRight.RGB))));
                    tempIClone_IsEqual = tempIClone_IsEqual & (System.Drawing.ColorTranslator.FromOle(System.Convert.ToInt32(pRecLogoSym.ColorTop.RGB)).Equals(System.Drawing.ColorTranslator.FromOle(System.Convert.ToInt32(srcLogoSym.ColorTop.RGB))));

                    //  Check for equality on IMarkerSymbol interface.
                    //  We know that a LogoMarkerSymbol implements IMarkerSymbol.
                    srcMarkerSym = other as IMarkerSymbol;
                    recMarkerSym = this;
                    tempIClone_IsEqual = tempIClone_IsEqual & (recMarkerSym.Angle == srcMarkerSym.Angle);
                    tempIClone_IsEqual = tempIClone_IsEqual & (System.Drawing.ColorTranslator.FromOle(System.Convert.ToInt32(recMarkerSym.Color.RGB)).Equals(System.Drawing.ColorTranslator.FromOle(System.Convert.ToInt32(srcMarkerSym.Color.RGB))));
                    tempIClone_IsEqual = tempIClone_IsEqual & (recMarkerSym.Size == srcMarkerSym.Size);
                    tempIClone_IsEqual = tempIClone_IsEqual & (recMarkerSym.XOffset == srcMarkerSym.XOffset);
                    tempIClone_IsEqual = tempIClone_IsEqual & (recMarkerSym.YOffset == srcMarkerSym.YOffset);

                    //  Check for equality on ISymbol interface.
                    //  We know that a Logo markerSymbol implements ISymbol.
                    srcSym = other as ISymbol;
                    recSym = this;
                    tempIClone_IsEqual = tempIClone_IsEqual & (recSym.ROP2 == srcSym.ROP2);

                    //  Check for equality on IDisplayName interface.
                    //  We know that a Logo markerSymbol implements IDisplayName.
                    srcDispName = other as IDisplayName;
                    recDispName = this;
                    tempIClone_IsEqual = tempIClone_IsEqual & (recDispName.NameString == srcDispName.NameString);

                    //  Check for equality on ISymbolRotation
                    //  We know that a Logo markerSymbol implements IDisplayName.
                    srcSymRot = other as ISymbolRotation;
                    recSymRot = this;
                    tempIClone_IsEqual = tempIClone_IsEqual & (recSymRot.RotateWithTransform == srcSymRot.RotateWithTransform);

                    //  Check for equality on IMapLevel
                    //  We know that a Logo markerSymbol implements IMapLevel.
                    srcMapLev = other as IMapLevel;
                    recMapLev = this;
                    tempIClone_IsEqual = tempIClone_IsEqual & (recMapLev.MapLevel == srcMapLev.MapLevel);

                    //  Also implements IMarkerMask, but IMarkerMask has no properties to check.
                }
            }
            return tempIClone_IsEqual;
        }