POST
|
Timothy, You were using the wrong workspace. I don't know if this will help you or not.
import java.io.IOException;
import java.net.UnknownHostException;
import com.esri.arcgis.datasourcesGDB.FileGDBWorkspaceFactory;
import com.esri.arcgis.geodatabase.IFeatureWorkspace;
import com.esri.arcgis.geodatabase.IFeatureWorkspaceProxy;
import com.esri.arcgis.geodatabase.IWorkspace;
import com.esri.arcgis.geodatabase.IWorkspaceFactory;
import com.esri.arcgis.geodatabase.IWorkspaceName;
import com.esri.arcgis.geodatabase.IWorkspaceProxy;
import com.esri.arcgis.geometry.ISpatialReference;
import com.esri.arcgis.geometry.SpatialReferenceEnvironment;
import com.esri.arcgis.interop.AutomationException;
import com.esri.arcgis.system.EngineInitializer;
import com.esri.arcgis.system.IName;
public class FGDBDemo {
private static IWorkspace workspace;
public static void main(String[] args) {
// code generated from the File|New|ESRI Templates|ArcObjects Project|Console wizard
EngineInitializer.initializeEngine();
initializeArcGISLicenses();
// create the File Geodatbase and Workspace stuff... code copied more or less directly from the help
createFGDBStuff();
// create the feature dataset... code copied more or less directly from the help
createFeatureDataset();
}
static void initializeArcGISLicenses() {
try {
com.esri.arcgis.system.AoInitialize ao = new com.esri.arcgis.system.AoInitialize();
if (ao.isProductCodeAvailable(com.esri.arcgis.system.esriLicenseProductCode.esriLicenseProductCodeEngine) == com.esri.arcgis.system.esriLicenseStatus.esriLicenseAvailable)
ao.initialize(com.esri.arcgis.system.esriLicenseProductCode.esriLicenseProductCodeEngine);
else if (ao.isProductCodeAvailable(com.esri.arcgis.system.esriLicenseProductCode.esriLicenseProductCodeArcInfo) == com.esri.arcgis.system.esriLicenseStatus.esriLicenseAvailable)
ao.initialize(com.esri.arcgis.system.esriLicenseProductCode.esriLicenseProductCodeArcInfo);
} catch (Exception e) {
e.printStackTrace();
}
}
public static void createFGDBStuff(){
try {
//Create a FileGDB workspace factory
IWorkspaceFactory workspaceFactory = new FileGDBWorkspaceFactory();
//Create a new File geodatabase
IWorkspaceName workspaceName = workspaceFactory.create("C:\\GIS\\", "MyFGDB.gdb", null, 0);
//Cast for IName
// ... there are different ways to do this, it was the first sample I copied from the help.
// ... alot of people like opening the opening the FGDB using a path name, there are samples in the help for that.
IName name = (IName)workspaceName;
//Open a reference to the FGDB workspace through the name object
workspace = new IWorkspaceProxy(name.open());
} catch (UnknownHostException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
private static void createFeatureDataset(){
try {
// variable to hold the named constant value for this spatial reference
int wgs84 = com.esri.arcgis.geometry.esriSRGeoCSType.esriSRGeoCS_WGS1984;
// Create a SpatialReferenceEnvironment and ISpatialReference
SpatialReferenceEnvironment spatialRef = new SpatialReferenceEnvironment();
ISpatialReference gcswgs84 = spatialRef.createGeographicCoordinateSystem(wgs84);
// create the feature workspace
IFeatureWorkspace featureWorkspace = new IFeatureWorkspaceProxy(workspace);
// create the featureDataset (the name, the featureDataset spatial reference)
featureWorkspace.createFeatureDataset("MyFDS", gcswgs84);
} catch (AutomationException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
... View more
07-08-2014
05:15 PM
|
1
|
0
|
1707
|
POST
|
>>Would you mind taking a look at tomalley23's question? Can you help me find it in this new forum? I don't remember the title of that post.
... View more
07-08-2014
05:06 PM
|
0
|
0
|
650
|
POST
|
Robby, Every once in a while I get into conversations like these. It usually starts and ends the same way every time where someone wants to get in a word battle with me over what did you call it - academic meanings? I'm just using the standard language that is out there and I always run into people who what to use a different language (not programming language) in which to communicate. If you have a better word for my use of the word "implement" for classes that need to provide the guts to the method signatures in Interfaces, let me hear it. I'd be glad to consider to start using it. I'll agree to comment on the last paragraph where you asked my opinion about the Java 8 feature of default methods in Interfaces. I think if people "want" to add default methods to Interfaces, then maybe they should be looking at extending an Abstract Class for that instead. Abstract Classes can have "implementation" code in their methods. And, since you can re-declare and re-define the default methods in Interfaces, what would be the point? You would be breaking the intent of having a default method in Interfaces in the first place. But... with default non-abstract methods in Interfaces I can see where you gain the ability to have Abstract Class behavior without needing to declare "your" class as Abstract. I would be interested to know what "use cases" there are that have been championing this change in Java 8. I know, Lambda expressions. And to be fair, this new feature is a way to provide other new features without breaking the Collections API. So I don't know what to think about it, really.
... View more
07-02-2014
07:07 PM
|
0
|
0
|
650
|
POST
|
>>The point was that there was a property on the interface which means that the property must exist on any class that implements the interface You are correct. Not only must it exist, but the functionality must be provided by the class that implements the Interface, not within the Interface itself. Your auto-properties example works on classes, not Interfaces. Interfaces are abstract and only define method signatures. You can't instantiate an Interface, so if there was some kind of functionality provided by an auto-property inside an Interface, you would be breaking the nature of an Interface. >>Why couldn't you have written some sample code to illustrate the proper way of doing it? Because the forums shouldn't be vending machines for code samples. Why can't I answer the question the way I want to? The Original Poster did this:
ILegend2 legend = mapSurroundFrame.MapSurround as ILegend2;
IBoundsProperties bounds = legend as IBoundsProperties;
bounds.FixedAspectRatio = false;
mapSurroundFrame.MapSurround returns an Interface type, not an instance of a CoClass. He is essentially assigning an Interface reference to another Interface reference. Nothing wrong with that at this point, if they were related. Then he assigns the variable bounds (which is an Interface type) a reference type of legend. "legend" is a type of ILegend. Now he has two object references pointing to the same object, whatever it is. Using the .NET docs: There is no FixedAspectRatio property on the ILegend Interface: http://help.arcgis.com/en/sdk/10.0/vba_desktop/componenthelp/000t/000t00000775000000.htm I don't know why you want to make it sound like I'm quibbling, it is just a fact. Quibble about it all you want. But at the end, he got a NotImplementedException because he assigned an Interface type (ILegend) which does not implement or even define FixedAspectRatio to a reference variable type of IBoundsProperties which does. The compiler is going to check the actual type of the reference and tell you: "hey, FixedAspectRatio is not implemented on the object type you have currently". I disagree with you on the IGeometryInterface. Why couldn't it be possible for someone to create their own special geometry class that wants to provide implementation for the methods defined in the IGeometryInterface? Just because you don't do it, doesn't mean someone else might not want to. You can define constants in Java Interfaces now and people abuse them.
... View more
07-02-2014
10:59 AM
|
0
|
0
|
650
|
POST
|
Robby, When I said that IBoundsProperty does not implement FixedAspectRatio, it was not just some uninformed opinion. It is a fact. http://help.arcgis.com/en/sdk/10.0/vba_desktop/componenthelp/000t/000t000002mw000000.htm CoClasses "implement" the behavior defined by the Interface. Interfaces only define a contract, there is nothing between the curly braces, i.e. no implementation. What that is saying is that if you could look at the source code for the IBoundsProperty FixedAspectRatio method, there would be nothing in it. All of those CoClasses that "implement" the interface have to define what FixedAspectRatio means and it could very well be different for different CoClasses. I think perhaps we should take the time to educate a little bit on the concept of Interfaces. http://msdn.microsoft.com/en-us/library/87d83y5b.aspx An interface contains only the signatures of methods, properties, events or indexers. A class or struct that implements the interface must implement the members of the interface that are specified in the interface definition. It is correct to use Interface types as reference variables, but what I was trying to tell the original poster is that you cannot expect to assign Interface types to Interface types and expect to call a method that is only implemented on one of the CoClasses. I was hoping that by reading this he would know how to fix his problem. He needs to instantiate an instance of whatever CoClass he wants and assign it to an Interface. He was trying to get a Legend by calling some method that returns an Interface and then assign that Interface to his IBoundsProperty Interface and then he didn't know why he couldn't call FixedAspectRatio. I also hate the way any time they need to add a new member to an interface, they just create a whole new interface ("IGeometry needs a new XYZ property? Say hello to IGeometry16!" ), which half the time doesn't even inherit from the previous interface! What do you expect to happen here? If you create an Interface called YourInterface and that Interface defines two methods: doStuff{} doMoreStuff{} Every CoClass that implements the "YourInterface" Interface will be *required* to implement any additional methods that you add to it, such as doEvenMoreStuff{}. That is how it works in Java. I don't know how .NET handles that. Adding functionality to existing Interfaces breaks all of the CoClass implementations. This is why you see IInterface, IInterface2, IInterface3, etc. Each of those additional Interfaces should be implementing the previous Interface, which is why you only see "additional" methods being defined in those new ones. I don't know about "half the time". Do you have a specific example of on which Interface that happens?
... View more
07-02-2014
06:10 AM
|
0
|
0
|
1001
|
POST
|
Thanks for the example. Your original post wanted to call: FixedAspectRatio That method is not implemented in the ILegend, IBoundsProperties or the other Interfaces you have used to create an instance of a legend using IMapSurroundFrame.CreateSurroundFrame and passing the uid of a Legend. IBoundsProperties does indicate that any class that implements the IBoundsProperties Interface, provide some implementation for the FixedAspectRatio method. So for example, Legend implements the IBoundsProperties Interface, which means that Legend needs to provide the "how" for the FixedAspectRatio method. Interfaces are types, just like the CoClasses. What you are doing in your code is declaring a IMapSurroundFrame type and assigning a reference value to that type of yet another Interface type. What you could do is create a MapSurroundFrame variable or an actual Legend variable and assign that to your Interface type reference variable. In Java, Interfaces as types work like this: http://docs.oracle.com/javase/tutorial/java/IandI/interfaceAsType.html If you define a reference variable whose type is an interface, any object you assign to it must be an instance of a class that implements the interface. I see a lot of people on this forum, especially in the .NET user group, assign interface types to other interface variables. I honestly don't know how that works or why more people don't run into problems doing that.
... View more
07-01-2014
01:28 PM
|
0
|
0
|
1001
|
POST
|
mapSurroundFrame.MapSurround returns an instance of the Legend coclass Really? I don't think it says that exactly. Looking at the .NET documentation for IMapSurroundFrame Interface: http://help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/0012/001200000m4w000000.htm Click on the MapSurround member link.. at the bottom it says: "The MapSurround property allows you to retrieve or set the surround object (north arrow, legend, or scale bar) stored within the frame." You are getting a "surround object" that is stored within the frame, it could be any of the CoClasses that implement the IMapSurround Interface. Look at all the "concrete" CoClasses that implement the IMapSurround Interface: http://help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/0012/001200000m47000000.htm I'm not current on my .NET ArcObjects, but it seems to me that you still need an instance of a Legend CoClass somewhere.
... View more
06-25-2014
01:00 PM
|
0
|
0
|
1001
|
POST
|
When I run the code, I get "The method or operation is not implemented." That is because the method is not implemented on the ILengend2 interface, nor is it on the ILegend interface. Look at the API. http://resources.arcgis.com/en/help/arcobjects-java/api/arcobjects/com/esri/arcgis/carto/ILegend2.html I know that's not a C# link, but you should get the same results looking at that documentation. You need a concrete Legend object to call fixedAspectRatio. The Legend class implements that behavior, not the interface. "Program to an interface" doesn't literally mean, only use Interface types. At some point, you need to instantiate a concrete class for certain behavior.
... View more
06-25-2014
10:59 AM
|
0
|
0
|
1001
|
POST
|
Otherwide = otherwise. Fat fingered keyboard on phone.
... View more
05-01-2014
07:11 PM
|
0
|
0
|
481
|
POST
|
I will check again in the morning.Basically, there is 1 insert for zoning case, 1 insert for land use case, 1 insert for subdivion. Layer z should have/show 3 inserts representing each of those features and it only shows 1 in the version changes dialog.Layer z is a new layer that catches all of the previous layers but we grant edit rights to the previous layers for now for making text changes, but the process is not always followed and features get added to those previous layers.I don't want to ruffle feathers if someone said they added those features to layer z, until I can show otherwide for sure.
... View more
05-01-2014
07:10 PM
|
0
|
0
|
481
|
POST
|
Hi Bob, So you want to use the form to add the point? Does your form contain something like a lat/long text box and you want to enter that text in the form and translate that to a point in the point shapefile? I'm assuming your shapefile has a WGS 84 type of projection? How do you handle typos in the form? Can you post the link to the C# example and maybe we can help translate. I don't know your workflow, but sometimes people create a tool that lets the user interact with the map, and when the click event happens to place the point, a form will appear to enter the other non-spatial attribute data. Much like the way ArcMap does point editing.
... View more
05-01-2014
02:41 PM
|
0
|
0
|
351
|
POST
|
I should also add, the feature in layer x that should be copied to layer z, not only does not show in the version changes dialog, but that feature from layer x is not in layer z's table. I'm trying to understand if this is possible when a user says they copied that feature from layer x into layer z. It's not in either place from my perspective. At this point, I'm tending to not believe the copy/paste operation happened at all.
... View more
05-01-2014
12:47 PM
|
0
|
0
|
481
|
POST
|
It should be a copy/paste/save edits operation through ArcMap, no custom tools involved.
... View more
05-01-2014
12:41 PM
|
0
|
0
|
481
|
POST
|
ArcSDE 10.0 SP5 ArcGIS Desktop 10.0 SP5 Adding data to ArcMap from an ArcSDE edit version, clicking on "List by Source" in the ArcMap TOC, and then clicking on the "Version Changes" button shows me what edits have been made to the edit version compared with sde.Default. If we have a policy that data in layer x also get copied to layer z, and if layer x shows one insert, but layer z does not show the insert, under what scenario would that happen?
... View more
05-01-2014
11:01 AM
|
0
|
6
|
706
|
POST
|
And because I am using C# and don't exaclty know of all the references needed to import, You will likely have several of the same references that I imported using Java in .NET. I still have no real understanding of all the misc other function calls (SimpleMarkerSymbol, MarkerElement, etc). I can look up their meaning but do not understand really why they are needed or why they should/would be needed You should start here: GraphicsContainer addElement() - this is really your objective. Add some text to a map. Now that you have found a starting point, you work your way through the API. I gave you the namespace for GraphicsContainer: Carto So go here: IGraphicsContainer.AddElement Method Do you see where IElement is a parameter to this method call? It's right there in the C# sample. So go here: IElement Interface What kind of element do you want? TextElment? There is one of those, just click on it. You should now be here: TextElementClass Class Now click on ITextElement in that page. What does this class need to do it's job? Answer: It needs Text and a Symbol. And everything that inherites from IElement will need to have a geometry. So you need to go look at what it takes to create a geometry, like a point. What kind of symbols are there? Answer: ISymbol Interface As you work your way through the seemingly simple task of adding a TextElement to a map, you discover that there is alot more that you need to do to get the job done. You don't necessarily need the marker symbol, I just threw that in there for the sake of displaying the dot. I could have left it out, I could have left out the Group Element and I could have moved the code from getMapCoordinatesFromScreenCoordinates up into the other part of the code. Code without explanation in my context won't really help You are welcome for the post. Good luck.
... View more
04-24-2014
01:10 PM
|
1
|
0
|
153
|
Title | Kudos | Posted |
---|---|---|
1 | 12-28-2012 01:09 PM | |
1 | 07-17-2013 10:23 AM | |
1 | 02-26-2014 06:11 AM | |
1 | 01-19-2014 07:12 AM | |
1 | 04-09-2013 06:55 AM |
Online Status |
Offline
|
Date Last Visited |
06-05-2021
06:02 AM
|