|
POST
|
I've never worked with terrains but from the sound of it you really need a Surface to work with. Looking at the developer help for ITerrain I see there is a method called CreateDynamicSurface. IDynamicSurface has a method called GetTin. From ITin, you can QI to ISurface, which has methods to get elevation, slope and aspect. Have you tried any of this? If not, give it a shot.
... View more
12-13-2011
12:29 PM
|
0
|
0
|
661
|
|
POST
|
In the first example, you're setting the document's active view to the map you got from the document's maps collection. In other words, you're changing the map referenced by the document from one map (or page layout) to another. The second example doesn't work because it doesn't make any logical sense. You're getting the map in the same way but instead of using it to set the document's active view you're QI'ing from IMap to IActiveView and changing the focus map reference. The IActiveView reference you're working with is the map you got from the maps collection. Changing any of its properties is not going to affect the document because there is no relationship between the document and that map. You get the error because the action you're taking isn't implemented. In this scenario the IActiveView reference is a map. Changing the focus map of a map to another map doesn't make sense.
... View more
12-12-2011
05:30 AM
|
0
|
0
|
489
|
|
POST
|
I don't develop addins as they aren't a good solution for what our applications do so I'm not up to speed on all their ins and outs. However, I know there are certain limitations with them. Have you tried serializing to another location (like maybe the same directory where your addin is located)? There could be some limitation on what parts of the file system they can fully access. I don't know, just a guess since the problem doesn't appear to be the code itself.
... View more
12-07-2011
04:41 AM
|
0
|
0
|
2118
|
|
POST
|
Handling dates as double precision values for cross-language/platform use is pretty standard. My guess would be that they decided to keep it simple as opposed to wrapping the return value in even more COM overhead. It's also just as likely that whoever designed the IDocumentInfo2 interface wasn't even aware of the ITime interface or that they didn't really think about it too much at all. Only ESRI really knows why they implemented it this way.
... View more
12-07-2011
04:36 AM
|
0
|
0
|
1103
|
|
POST
|
I copied your code verbatim into a form class and ran it without any errors. Here's the code for the entire form - it includes the struct definition as well. using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public void Serialize(Test obj)
{
Stream file = File.Open(@"c:\tt.dat", FileMode.Create);
BinaryFormatter b = new BinaryFormatter();
b.Serialize(file, obj);
file.Close();
}
public Test DeSerialize(string Name)
{
Test Obj = new Test();
try
{
Stream file = File.Open(Name, FileMode.Open);
BinaryFormatter b = new BinaryFormatter();
Obj = (Test)b.Deserialize(file); //This is the line which propagate the exception
file.Close();
}
catch (Exception)
{
}
return Obj;
}
private void button1_Click(object sender, EventArgs e)
{
Test o = new Test();
o.a = 44;
o.b = 55;
Serialize(o);
}
private void button2_Click(object sender, EventArgs e)
{
Test o = DeSerialize(@"c:\tt.dat");
MessageBox.Show(o.a.ToString());
MessageBox.Show(o.b.ToString());
}
}
}
[Serializable()]
public struct Test
{
public double a;
public double b;
}
... View more
12-06-2011
01:43 PM
|
0
|
0
|
2118
|
|
POST
|
The property returns an Object because not all languages have a Date data type and the ones that do vary in its implementation. Dates can be converted to an equivalent double precision number, which is what the property does because all languages should have some implementation of a double precision data type. In .NET you can use this to get the value: Dim d As Date = Date.FromOADate(docInfo.DateSaved)
... View more
12-06-2011
01:35 PM
|
0
|
0
|
1103
|
|
POST
|
The error means the object being deserialized isn't of the same type as your struct. Are you sure the file path that you're passing into the Deserialize method is "c:\tt.dat"? That's about the only thing I can think of is that you're not opening the file you think you are.
... View more
12-06-2011
01:15 PM
|
0
|
0
|
2118
|
|
POST
|
Unless I'm mistaken, the classes you're using are the built-in classes for ArcEngine. I doubt they are designed to work inside ArcGIS Desktop. The way you would do this at 9.3.1 (and as far as I'm aware also at 10) is to use IDocument::CommandBars to get a reference to the ArcMap command/tool and execute it.
... View more
12-06-2011
09:16 AM
|
0
|
0
|
468
|
|
POST
|
I really don't see any reason why it wouldn't work properly. Having a shared instance of a workspace object shouldn't affect anything I would think. I personally wouldn't implement it that way since I wouldn't want an open connection to be hanging around any longer than I needed it but that's just a preference. One thing you might try is to use the Activator class to instantiate the workspace factory. Workspace factories are singleton objects and calling New can cause problems. pWorkspaceFactory = CType(Activator.CreateInstance(Type.GetTypeFromProgID("esriDataSourcesGDB.AccessWorkspaceFactory")), IWorkspaceFactory) Other than that, you may want to just get rid of the shared instance and call your function to open the workspace each time you need it.
... View more
12-06-2011
09:10 AM
|
0
|
0
|
893
|
|
POST
|
I believe you QI from IMapDocument to IDocumentVersion and set the DocumentVersion property before saving.
... View more
12-06-2011
08:09 AM
|
0
|
0
|
649
|
|
POST
|
Thanks Neil for your reply. Well the thing is, that i dont have a problem if i open ArcMap through code (see comment 2). The Symbols are only not shown, when i open ArcMap and then connect to my PersonalGeodatabase with my public shared connection variable. It's still unclear to me exactly what you're doing. In your second command it seems like you're saying that you're opening ArcMap through code, getting a reference to a command inside of ArcMap and executing it. That should work correctly because all of the code inside the command is running inside of ArcMap. In your other posts I'm getting the idea that you're opening ArcMap through code and trying to automate it. If this is the case then you cannot use the New keyword to instantiate any ArcObjects class that you intend to use in conjunction with ArcMap. You must use IObjectFactory to create instances of these objects.
... View more
12-06-2011
04:22 AM
|
0
|
0
|
4323
|
|
POST
|
I'm not going to say you can't do it without ArcObjects but it would be quite difficult I imagine. You can do this by naming the text elements in the layout then looping through the layout's graphics container and setting the text value of the element according to its name.
... View more
12-05-2011
04:46 AM
|
0
|
0
|
751
|
|
POST
|
I don't see a method on the interface named ToShortDateString. Where are you getting that from? I just created a quick sample command and the following code works for me. Dim t As ITime = New Time
t.SetFromCurrentLocalTime()
MsgBox(t.QueryTimeString(esriTimeStringFormat.esriTSFYearThruMinuteWithDash))
... View more
12-02-2011
11:24 AM
|
0
|
0
|
1117
|
|
POST
|
The code lists any layers that have a feature selection. It doesn't do anything to try and determine if the feature comes from one or more of them. You could narrow down the list by checking the feature class of each layer to see if it is the same feature class the selected feature comes from. You could narrow it down even further by checking the selection set of each layer you have left to see if it contains a feature with the same ObjectId as the selected feature. If you find two or more layers with the same ObjectId in their selection set then I don't think you can do anything else to determine which one that feature actually belongs to (well, short of unselecting that feature and looking to see which selection set changed).
... View more
12-02-2011
08:52 AM
|
0
|
0
|
1519
|
|
POST
|
I've never used it but it looks like you would just call one of the Set methods on the interface. For instance, call SetFromCurrentLocalTime sounds like it would set the time referenced by the object to the current time.
... View more
12-02-2011
08:45 AM
|
0
|
0
|
1117
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 06-20-2014 05:29 AM | |
| 1 | 02-01-2011 04:18 AM | |
| 1 | 02-04-2011 04:15 AM | |
| 1 | 01-17-2014 03:57 AM | |
| 1 | 10-07-2010 07:37 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:23 AM
|