|
POST
|
Hi I am running one simple Desktop program using C#.Net While running the program, I am getting the below error. The type or namespace name 'ArcMap' does not exist in the namespace 'ESRI.ArcGIS' (are you missing an assembly reference?) Tried Solution: I tried to solve this solution by adding ArcGIS Reference. But I could not able to findout the ESRI.ArcGIS.ArcMap reference in the list. Using Softwares: ArcGIS Desktop 9.2, VS2005. Please give the solution. Can you post complete code...?
... View more
02-03-2011
12:56 AM
|
0
|
0
|
2812
|
|
POST
|
All, I'm automating a process for some workmates involving 3 geoprocessing commands. I'm using ArcObjects C#. I'm having some difficulties getting the Intersect object to like what I'm passing it for in_features. Documentation is scarce and I can't find any examples. The input is of type object, which is horribly unhelpful, since if you pass it the apparently wrong type of object the thing just fails without any explanation. If someone has a .NET example of using ESRI.ArcGIS.AnalysisTools.Intersect please post your code. This repeated poke and hope approach is draining my time and patience. Many thanks. use ITopologicalOperator
... View more
02-03-2011
12:50 AM
|
0
|
0
|
1897
|
|
POST
|
AS IGXdialog interface belongs to destop ,so i cant use in arcengine http://hi.baidu.com/007day/blog/item/c6475eaf0dcd41fefaed5068.html
... View more
02-03-2011
12:48 AM
|
0
|
1
|
1955
|
|
POST
|
If i have an object IBasemapsublayer which is an OSM or BingMap baselayer, which layer type (layer class) is then IBasemapSublayer.layer? Thank you Armin http://help.arcgis.com/en/sdk/10.0/vba_desktop/componenthelp/index.html#/IBasemapSubLayer_Interface/000t00000242000000/
... View more
01-25-2011
02:53 AM
|
0
|
0
|
635
|
|
POST
|
I don't have a solution for export from .NET aplication to PDF. VBA runs but the same code from my VB .NET application fails and returns a blank PDF. I think that error have a difficult solution .... Maybe its the moment of on arcpy thinking, and see if runs. Send me your vb.net code...
... View more
01-24-2011
07:00 PM
|
0
|
0
|
2967
|
|
POST
|
Hi Venkat, I cut and pasted your C# code into a test app. The only thing I changed was replacing the MXD path with a valid one for my system. The result was a message box with: -1.-1.-1.-1 Which is the same result as my code. I have tried this with several different MXDs. So either there is no ESRI version info in any of these MXDs, or something isn't working right with IMapDocument.GetVersionInfo or the way our code is using it. Like I wrote previously -- I haven't spent much time on this. When I get a chance I will look into it further, unless someone else can point out the problem. -Jeff Tell me like what exactly your looking for ...map document current version ...right ?
... View more
01-24-2011
06:58 PM
|
0
|
0
|
1877
|
|
POST
|
Hi, I'm trying to implement the EditTool in my own class. Using VB.NET I was able to get this working. Now I've converted to C# and can get it working. The code does not crash, but somehow the edittool is not hooked. Any ideas? public sealed class Modify : BaseCommand, ITool, IEditTool
{
#region COM Registration Function(s)
private IApplication m_Application;
private IXEIZExtension m_EditorExt;
private XEIZ.WebService.EditService m_EditService;
private IEditor m_Editor;
private string m_TableName;
private string m_FeatureID;
private IList<ARCLayerInfo> m_FeatureLayerList = new List<ARCLayerInfo>();
private ICommand m_EditCommand;
private ITool m_EditTool;
private IEditTool m_TheEditTool;
public event XEIZPlugin.Edit.ModifyVertexHandler VertexModified;
public Modify()
{
try
{
string bitmapResourceName = GetType().Name + ".bmp";
base.m_bitmap = new Bitmap(GetType(), bitmapResourceName);
}
catch (Exception ex)
{
System.Diagnostics.Trace.WriteLine(ex.Message, "Invalid Bitmap");
}
}
#region Overriden Class Methods
/// <summary>
/// Occurs when this tool is created
/// </summary>
/// <param name="hook">Instance of the application</param>
public override void OnCreate(object hook)
{
m_Application = hook as IApplication;
//Disable if it is not ArcMap
if (hook is IMxApplication)
base.m_enabled = true;
else
base.m_enabled = false;
m_EditCommand = new ControlsEditingEditToolClass();
m_EditCommand.OnCreate(hook);
m_EditTool = m_EditCommand as ITool;
m_TheEditTool = m_EditCommand as IEditTool;
}
public override bool Enabled
{
get
{
return true }
}
/// <summary>
/// Occurs when this tool is clicked
/// </summary>
public override void OnClick()
{
//Get the editor.
UID editorUID = new UIDClass();
editorUID.Value = "esricore.editor";
m_Editor = Program.App.FindExtensionByCLSID(editorUID) as IEditor;
//get a reference to editable layer
IFeatureLayer featureLayer = m_FeatureLayerList[0].pLayer as IFeatureLayer;
IFeatureClass featureClass = featureLayer.FeatureClass;
IDataset dataset = featureClass as IDataset;
IEditLayers editLayers;
//start an edit session on the selected layer
m_Editor.StartEditing(dataset.Workspace);
editLayers = m_Editor as IEditLayers;
editLayers.SetCurrentLayer(featureLayer, 0);
//set the editor task to modify features
for (int i = 0; i < m_Editor.TaskCount; i++)
{
if (m_Editor.get_Task(i).Name.ToUpper() == "MODIFY FEATURE")
{
m_Editor.CurrentTask = m_Editor.get_Task(i);
}
}
m_Application.CurrentTool = m_EditTool as ICommandItem;
m_EditCommand.OnClick();
}
#endregion
#region ITool Members
int ITool.Cursor
{
get { return m_EditTool.Cursor; }
}
bool ITool.Deactivate()
{
//unwire the event
if (m_Editor != null)
{
((IEditEvents_Event)m_Editor).OnSketchFinished -= new IEditEvents_OnSketchFinishedEventHandler(OnSketchFinished);
}
return true;
}
bool ITool.OnContextMenu(int x, int y)
{
m_EditTool.OnContextMenu(x, y);
return true;
}
void ITool.OnDblClick()
{
m_EditTool.OnDblClick();
}
void ITool.OnKeyDown(int keyCode, int shift)
{
m_EditTool.OnKeyDown(keyCode, shift);
}
void ITool.OnKeyUp(int keyCode, int shift)
{
m_EditTool.OnKeyUp(keyCode, shift);
}
void ITool.OnMouseDown(int button, int shift, int x, int y)
{
if (m_Editor.EditState == esriEditState.esriStateEditing)
{
m_EditTool.OnMouseDown(button, shift, x, y);
}
}
void ITool.OnMouseMove(int button, int shift, int x, int y)
{
m_EditTool.OnMouseMove(button, shift, x, y);
}
void ITool.OnMouseUp(int button, int shift, int x, int y)
{
m_EditTool.OnMouseUp(button, shift, x, y);
}
void ITool.Refresh(int hdc)
{
m_EditTool.Refresh(hdc);
}
#endregion
#region IEditTool Members
object IEditTool.EventSource
{
get { return m_TheEditTool.EventSource ; }
}
#endregion
}
} You suppose to fullfill the below requirement.. I think.. public Modify() { base.m_category = "Test"; //localizable text base.m_caption = "Test"; //localizable text base.m_message = "This should work in ArcMap/MapControl/PageLayoutControl"; //localizable text base.m_toolTip = "Test"; //localizable text base.m_name = "test"; //unique id, non-localizable (e.g. "MyCategory_MyCommand") try { string bitmapResourceName = GetType().Name + ".bmp"; base.m_bitmap = new Bitmap(GetType(), bitmapResourceName); } catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex.Message, "Invalid Bitmap"); } }
... View more
01-24-2011
06:53 PM
|
0
|
0
|
704
|
|
POST
|
So, ArcGIS 10 SDK doesn't support .NET 4.0 yet. Does someome know, if support could come sometime ? http://forums.arcgis.com/threads/16137-.NET-4-DLL-in-3.5-Add-in-(Or-.NET-4-Add-in-not-Debugging)
... View more
01-24-2011
06:42 PM
|
0
|
0
|
2136
|
|
POST
|
All, What I'm trying to achive is to create a addin tool with both onclick and mousedown events. When users click on the tool, a input box will popup, users enter a value then they click on the map to place that text on the position they want. I could get the mousedown events fires ok but I can't seem to find the onclick event for a add-in tool. I tried Protected Overrides Sub OnDoubleClick() nothing fires. Thank you for your help. Use BaseTool..
... View more
01-23-2011
07:48 PM
|
0
|
0
|
2025
|
|
POST
|
Is there another way to detect the ActiveView for the map without using IHookHelper? IHookHelper is available for ArcEngine so you can use it with Arc Desktop development if you have ArcEngine SDK installed and the ESRI.ArcGIS.Controls dll is available. This was my case with 9.3 but now that I've migrated to ArcGIS 10 I only have Arc Desktop SDK available. Thanks Use IApplication for hooking Desktop..
... View more
01-23-2011
07:46 PM
|
0
|
0
|
1263
|
|
POST
|
Here's the C# code I used, called from OnClick of a button:
private void Tests_GetVerInfo()
{
bool isMissingVerInfo = true;
int majorVer = 0;
int minorVer = 0;
int releaseVer = 0;
int buildVer = 0;
// **The following method results in an exception at runtime:**
//IMapDocument mapDocument = ArcMap.Document as IMapDocument;
//mapDocument.GetVersionInfo(ref isMissingVerInfo, ref majorVer,
// ref minorVer, ref releaseVer, ref buildVer);
// **This method succeeds but does not get version, reports missing version info**
string docPath = GetActiveDocumentPath(ArcMap.Application);
//string docPath = "C:/Temp/Test.mxd";
IMapDocument mapDocument = new MapDocumentClass();
mapDocument.Open(docPath, "");
mapDocument.GetVersionInfo(ref isMissingVerInfo, ref majorVer,
ref minorVer, ref releaseVer, ref buildVer);
mapDocument.Close();
MessageBox.Show(
docPath + "\n" +
isMissingVerInfo.ToString() + "\n" +
majorVer.ToString() + "\n" +
minorVer.ToString() + "\n" +
releaseVer.ToString() + "\n" +
buildVer.ToString()
);
}
Using VS2008 Express and ArcGIS 10. -Jeff public override void OnClick() { try { IMapDocument pMapDocument; pMapDocument = new MapDocumentClass(); pMapDocument.Open(@"C:\Program Files\ArcGIS\DeveloperKit\SamplesNET\Server\data\New Folder.mxd", ""); bool bMissing = true; int lMajor = 0; int lMinor = 0; int lRevision = 0; int lBuild = 0; pMapDocument.GetVersionInfo(ref bMissing, ref lMajor, ref lMinor, ref lRevision, ref lBuild); if (bMissing == true) { MessageBox.Show(lMajor + "." + lMinor + "." + lRevision + "." + lBuild); } } catch (Exception exp) { } }
... View more
01-23-2011
07:33 PM
|
0
|
0
|
1877
|
|
POST
|
Hello all, It must be simple, but i don't see it. I'm looking for a way to access all properties of a characterMarkerSymbol: Formatted text, fill pattern, background and mask. Can somebody help with this.
If TypeOf pSymbol Is ICharacterMarkerSymbol Then
Dim pCharacterMarkerSymbol As ICharacterMarkerSymbol
Set pCharacterMarkerSymbol = pSymbol
debug.print pCharacterMarkerSymbol.Angle
...
'background ...
'fill pattern ...
'schadow ...
endif
Thanks, Henk http://forums.arcgis.com/threads/5945-drawing-an-icharactermarkersymbol
... View more
01-20-2011
08:39 PM
|
0
|
0
|
827
|
|
POST
|
Hi all, I have some map layers stored in SDE / Oracle database, accessed via DirectConnect. The user saves the layers in an MXD file. To update the DataSource (e.g. when the SDE_USER password has changed), I use some code as described the forum thread "Change a layers data source in a mxd" (http://forums.esri.com/Thread.asp?c=93&f=993&t=189210#943440), which worked for me. Now a user has problems with an MXD file, where the code hangs in the while-loop after the if (pFeatureLayer.DataSourceType == "SDE Feature Class") line. I have been waiting for about 10 minutes: - no exception, - nothing unusual in the sdedc_Oracle.log file - the mxd file size is just 26 kB, - the MXDDoctor (from c:\Programme\ArcGIS\DeveloperKit\Tools\MXDDoctor.exe) reports as diagnosis "No corrupt objects found." - the MXDEditor (http://resources.esri.com/help/9.3/ArcGISEngine/java/doc/5a6ae887-c141-4616-bab3-167ccc5c0ed3.htm) did not help yet, because I could not start it, despite new Java and ArcGIS java installation. We use ArcGIS Engine 9.3 and Windows XP. Do you have any ideas how to analyse (or even repair) the mxd file? Holger Please check somewhere mdx might stored the old password ?
... View more
01-20-2011
01:40 AM
|
0
|
0
|
495
|
|
POST
|
Hi (sorry for my english) From an application in VB.NET and try to open an ArcMap print your layout. (Automation) We have included the sample code (ExportActiveView) and get a blank PDF. In contrast, using the same example with ArcMap works perfectly. JMJ98 Somehow you have to play with focus pagelayout... not basically activeview...
... View more
01-20-2011
01:16 AM
|
0
|
0
|
2967
|
|
POST
|
Hi This sample runs me ok, inside ArcGis 10. But if runs in a windows form application (with automated arcgis opened), the result its blank PDF. Please, Anyone can you help me ?? JMJ98 Sample for SDK Argis 10: Public Sub ExportActiveViewParameterized(ByVal ExportFormat As String, ByVal iOutputResolution As Long, ByVal lResampleRatio As Long, ByVal bClipToGraphicsExtent As Boolean) 'Export the active view using the specified parameters Dim docActiveView As IActiveView Dim docExport As IExport Dim docPrintAndExport As IPrintAndExport Dim RasterSettings As IOutputRasterSettings Dim sNameRoot As String Dim sOutputDir As String Dim bReenable As Boolean If (GetFontSmoothing()) Then bReenable = True DisableFontSmoothing() If (GetFontSmoothing()) Then MsgBox("Cannot Disable Font Smoothing. Exiting.") Return End If End If docActiveView = My.ArcMap.Document.ActiveView ' Create an Export* object and cast the docExport interface pointer onto it. ' To export to any format, we simply create the desired Class here ExportFormat = "PDF" Select Case ExportFormat Case "PDF" docExport = New ExportPDF Case "EMF" docExport = New ExportEMF Case "BMP" docExport = New ExportBMP Case "EPS" docExport = New ExportPS Case "SVG" docExport = New ExportSVG Case "GIF" docExport = New ExportGIF Case "TIF" docExport = New ExportTIFF Case "JPEG" docExport = New ExportJPEG Case "PNG" docExport = New ExportPNG Case "AI" docExport = New ExportAI Case Else MessageBox.Show("Unrecognized output format, defaulting to EMF") ExportFormat = "EMF" docExport = New ExportEMF End Select docPrintAndExport = New PrintAndExport ' Output Image Quality of the export. The value here will only be used if the export ' object is a format that allows setting of Output Image Quality, i.e. a vector exporter. ' The value assigned to ResampleRatio should be in the range 1 to 5. ' 1 corresponds to "Best", 5 corresponds to "Fast" If TypeOf docExport Is IOutputRasterSettings Then ' for vector formats, assign a ResampleRatio to control drawing of raster layers at export time RasterSettings = docExport RasterSettings.ResampleRatio = lResampleRatio ' NOTE: for raster formats output quality of the DISPLAY is set to 1 for image export ' formats by default which is what should be used End If 'assign the output path and filename. We can use the Filter property of the export object to ' automatically assign the proper extension to the file. sOutputDir = System.Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "\" sNameRoot = "VBExportActiveViewSampleOutput" docExport.ExportFileName = sOutputDir & sNameRoot & "." & Right(Split(docExport.Filter, "|")(1), _ Len(Split(docExport.Filter, "|")(1)) - 2) docPrintAndExport.Export(docActiveView, docExport, iOutputResolution, bClipToGraphicsExtent, Nothing) MessageBox.Show("Finished Exporting " & sOutputDir & sNameRoot & "." & Right(Split(docExport.Filter, "|")(1), _ Len(Split(docExport.Filter, "|")(1)) - 2) & ".", "Export Active View Sample") 'cleanup for the exporter docExport.Cleanup() If (bReenable) Then EnableFontSmoothing() bReenable = False End If End Sub What do you mean by "if runs in a windows form application (with automated arcgis opened)"..Please can be clear on the same...or any screen ?
... View more
01-19-2011
11:37 PM
|
0
|
0
|
2967
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 10-09-2017 07:44 AM | |
| 2 | 01-12-2015 10:36 PM | |
| 1 | 01-15-2015 09:02 AM | |
| 2 | 09-29-2014 02:29 PM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:23 AM
|