Select to view content in your preferred language

How to get SchematicInMemoryFeatureClass with java api ?

1263
5
02-15-2011 08:04 PM
joshuasun
Emerging Contributor
i want to edit schemtaic diagram,including add or delete feature of node and link .first i have to get SchematicInMemoryFeatureClass from SchematicInMemoryDiagram.but the problem is that i can not
do it with java api.the code as show :
ISchematicLayer schematicLry = (ISchematicLayer) hookHelper
     .getFocusMap().getLayer(0);
schematicLry.startEditSchematicDiagram(false);    ISchematicInMemoryDiagram inMemoryDiagram = schematicLry
     .getSchematicInMemoryDiagram();
// ISchematicInMemoryFeatureClassContainer sifcc =(ISchematicInMemoryFeatureClassContainer) inMemoryDiagram;
SchematicInMemoryDiagram sifcc = new SchematicInMemoryDiagram(inMemoryDiagram);
   ISchematicInMemoryFeatureClassContainer sifcc1 = new ISchematicInMemoryFeatureClassContainerProxy(
     inMemoryDiagram);
   IEnumSchematicInMemoryFeatureClass enumInMemoryFC = sifcc
     .getSchematicInMemoryFeatureClasses();
   int count = enumInMemoryFC.getCount();
   enumInMemoryFC.reset();
   int count1 = enumInMemoryFC.getCount();
   ISchematicInMemoryFeatureClass schInMrmoryFeatureClass = enumInMemoryFC.next();
   schInMrmoryFeatureClass.createSchematicInMemoryFeatureNode(point,
     "");
---------------------
the blod font  is the different use ,the count = enumInMemoryFC.getCount(); cont =4,but the schInMrmoryFeatureClass =null, i can not get schInMrmoryFeatureClass , why ?
Tags (2)
0 Kudos
5 Replies
joshuasun
Emerging Contributor
p.s. the code is about schematic 10
0 Kudos
RickAnderson
Frequent Contributor
Not a java expert, so I can't be certain...  Anyway, the line you have commented out looks like it should be the better line to use.  In C# the code you want would look like this (and works just fine on several samples I have):


ISchematicInMemoryFeatureClassContainer sifcc =(ISchematicInMemoryFeatureClassContainer) inMemoryDiagram;

IEnumSchematicInMemoryFeatureClass enumInMemoryFC = sifcc.getSchematicInMemoryFeatureClasses();

enumInMemoryFC.reset();

ISchematicInMemoryFeatureClass schInMrmoryFeatureClass = enumInMemoryFC.next();
0 Kudos
joshuasun
Emerging Contributor
Not a java expert, so I can't be certain...  Anyway, the line you have commented out looks like it should be the better line to use.  In C# the code you want would look like this (and works just fine on several samples I have):


ISchematicInMemoryFeatureClassContainer sifcc =(ISchematicInMemoryFeatureClassContainer) inMemoryDiagram;

IEnumSchematicInMemoryFeatureClass enumInMemoryFC = sifcc.getSchematicInMemoryFeatureClasses();

enumInMemoryFC.reset();

ISchematicInMemoryFeatureClass schInMrmoryFeatureClass = enumInMemoryFC.next();


thx very much. i try another method getSchematicInMemoryFeatureClass(schemElementClass),but it stall not work. the code as follow:
-------------------------------------
ISchematicLayer schematicLry = (ISchematicLayer) hookHelper
.getFocusMap().getLayer(0);
schematicLry.startEditSchematicDiagram(false);//
ISchematicInMemoryDiagram inMemoryDiagram = schematicLry
.getSchematicInMemoryDiagram();
IEnumSchematicElementClass enumElementClass = inMemoryDiagram.getSchematicDiagramClass().getAssociatedSchematicElementClasses();
enumElementClass.getCount();
enumElementClass.reset();
ISchematicElementClass schemElementClass = enumElementClass.next();
while(schemElementClass!=null){
schemElementClass.getName();
ISchematicInMemoryFeatureClassContainer sifcc =
(ISchematicInMemoryFeatureClassContainer) inMemoryDiagram;
ISchematicInMemoryFeatureClass schematicInMemoryFeatureClass= sifcc.getSchematicInMemoryFeatureClass(schemElementClass);
//  schematicInMemoryFeatureClass.createSchematicInMemoryFeatureNode(point,
// "");
schemElementClass = enumElementClass.next();
}
------------------------------------------------------------------------------------------------
this method of get schematicInMemoryFeatureClass has been shown in esri demo of .net, but why it is not work with java code? my God!
0 Kudos
RickAnderson
Frequent Contributor
One of the core developers looked at this and they found a bad declaration for that particular class.  So that is probably causing this issue in Java... .NET just manages to handle it.  It is too late for us to get it into 10 SP2 though, so if you require this fix asap, you will need to submit through the appropriate channels in order to get a hot fix.
0 Kudos
joshuasun
Emerging Contributor
thax,i get it .
0 Kudos