Пример #1
0
        /// <summary>
        /// 左键在flag=1时点选道路进行查询,右键将地图中心移至点击位置
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void axMapControl1_OnMouseDown(object sender, ESRI.ArcGIS.Controls.IMapControlEvents2_OnMouseDownEvent e)
        {
            if (e.button == 1)
            {
                if (flag == 1)
                {
                    if (pPopupWindow != null)
                    {
                        if (pPopupWindow.Visible == true)
                        {
                            pPopupWindow.Dispose();
                        }
                    }

                    IPoint pPoint = new ESRI.ArcGIS.Geometry.Point();
                    pPoint.PutCoords(e.mapX, e.mapY);
                    IFeatureLayer pFeatureLayer = this.axMapControl1.Map.Layer[0] as FeatureLayer;
                    IFeature      pFeature      = GetPointSelect(pPoint, pFeatureLayer, 16) as IFeature;
                    IPropertySet  pOptions      = new PropertySet();

                    IHTMLPopupInfo  pHTMLPopupInfo  = pFeatureLayer as IHTMLPopupInfo;
                    IHTMLPopupInfo2 pHTMLPopupInfo2 = pFeatureLayer as IHTMLPopupInfo2;
                    pHTMLPopupInfo2.HTMLDownloadAttachmentData = true;
                    pHTMLPopupInfo.HTMLPopupEnabled            = true;
                    pHTMLPopupInfo.HTMLPresentationStyle       = esriHTMLPopupStyle.esriHTMLPopupStyleXSLStylesheet;
                    pHTMLPopupInfo.HTMLXSLStylesheet           = Application.StartupPath + @"\popup_0.xsl";
                    this.axMapControl1.MousePointer            = ESRI.ArcGIS.Controls.esriControlsMousePointer.esriPointerIdentify;
                    if (pFeature != null)
                    {
                        axMapControl1.ActiveView.Refresh();
                        IGeometry pAnnoGeometry = pFeature.Shape;
                        pSLS = pSLineSymbol as object;
                        pSLineSymbol.Style = esriSimpleLineStyle.esriSLSSolid;
                        IRgbColor pColor = new RgbColor();
                        pColor.Red          = 255;
                        pColor.Transparency = 255;
                        pSLineSymbol.Color  = pColor;
                        axMapControl1.DrawShape(pAnnoGeometry, ref pSLS);
                        displayXMLdocumentContent(pHTMLPopupInfo2.HTMLOutput(pFeature, pOptions));
                    }
                }
            }
            if (e.button == 2)
            {
                IPoint pPoint = new ESRI.ArcGIS.Geometry.Point();
                pPoint.PutCoords(e.mapX, e.mapY);
                this.axMapControl1.MousePointer = esriControlsMousePointer.esriPointerHand;
                axMapControl1.CenterAt(pPoint);
            }
        }
Пример #2
0
        /// <summary>
        /// Handles the Click event of the buttonMakeLayer control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void buttonMakeLayer_Click(object sender, EventArgs e)
        {
            IFeatureClass featureClass = this.PhotoTable.ToFeatureClass();

            if (this.MxDocument != null && featureClass != null)
            {
                IFeatureLayer layer = new FeatureLayerClass();
                layer.Name         = "GPS Photos    -     " + DateTime.Now.ToString();
                layer.FeatureClass = featureClass;

                // set the hotlink to the FullPath field
                IHotlinkContainer hotlink = (IHotlinkContainer)layer;
                hotlink.HotlinkField = "FullPath";
                hotlink.HotlinkType  = esriHyperlinkType.esriHyperlinkTypeURL;

                IHTMLPopupInfo htmlPopupInfo = (IHTMLPopupInfo)layer;
                htmlPopupInfo.HTMLPopupEnabled = true;

                string xsl = this.ReadDefaultXSLT();

                if (!string.IsNullOrEmpty(xsl))
                {
                    htmlPopupInfo.HTMLPresentationStyle = esriHTMLPopupStyle.esriHTMLPopupStyleXSLStylesheet;
                    htmlPopupInfo.HTMLXSLStylesheet     = xsl;
                }
                else
                {
                    htmlPopupInfo.HTMLPresentationStyle = esriHTMLPopupStyle.esriHTMLPopupStyleTwoColumnTable;
                }

                IGeoFeatureLayer geoFeatureLayer = (IGeoFeatureLayer)layer;
                ISimpleRenderer  renderer        = new SimpleRendererClass();
                renderer.Label  = "Photo Locations";
                renderer.Symbol = this.GetGPSPhotoSymbol();

                IRotationRenderer rotationRenderer = (IRotationRenderer)renderer;
                rotationRenderer.RotationField = "MagneticNorth";
                rotationRenderer.RotationType  = esriSymbolRotationType.esriRotateSymbolGeographic;

                geoFeatureLayer.Renderer = (IFeatureRenderer)renderer;

                this.MxDocument.FocusMap.AddLayer((ILayer)layer);
                this.MxDocument.UpdateContents();

                this.Close();
            }
        }
Пример #3
0
 private void  照点击位置查询ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         IFeatureLayer  pFeatureLayer  = this.axMapControl1.Map.Layer[0] as FeatureLayer;
         IFeature       pFeature       = pFeatureLayer.FeatureClass as IFeature;
         IHTMLPopupInfo pHTMLPopupInfo = pFeatureLayer as IHTMLPopupInfo;
         pHTMLPopupInfo.HTMLPopupEnabled      = true;
         pHTMLPopupInfo.HTMLPresentationStyle = esriHTMLPopupStyle.esriHTMLPopupStyleXSLStylesheet;
         pHTMLPopupInfo.HTMLXSLStylesheet     = Application.StartupPath + @"\popup_0.xsl";
         this.axMapControl1.MousePointer      = ESRI.ArcGIS.Controls.esriControlsMousePointer.esriPointerIdentify;
         flag = 1;
     }
     catch
     {
         MessageBox.Show("数据尚未加载!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }