[xsd-users] CityGML deserialization - CityModel generation
Adrian Victor Manoliu
victor.manoliu at yahoo.com
Thu Feb 24 04:58:02 EST 2011
Greetings,
I really am sorry, but I just can't figure this out. To be more specific:
Here I create the CityModelType object, iCity:
const std::string fName = "waldbruecke_v1.0.0.gml";
std::auto_ptr<CityModelType> iCity(CityModel(fName, flags.dont_validate));
While debugging, after this instruction, in my 'Locals' tab iCity is composed of
two elements:
- a public gml::AbstractFeatureCollectionType, which includes:
- public gml::AbstractFeatureType wrapper
- private featureMember_
- private featureMembers_
- the private _GenericApplicationPropertyOfCityModel_ which contains the
sequence of private items:
- flags_
- container_
- v_
Now, once I have iCity, I simply want to iterate over its elements, that is the
Buildings, BuildingParts etc.
by doing something like this (I have been doing this from the start):
CityModelType::_GenericApplicationPropertyOfCityModel_const_iterator ci;
for ( ci = iCity->_GenericApplicationPropertyOfCityModel().begin();
ci != iCity->_GenericApplicationPropertyOfCityModel().end();
++ci)
{
[...]
}
I understand there's a problem of abstract objects and I have read the manual
chapter concerning dynamic
casts, however in this case I don't see how I could know what type to cast these
objects to (this is
also due to my lack of experience in dealing with these automatically generated
classes which relate
in an intricate way).
The reason for which I insist on flags_, container_ and v_ is the way projects
like "library"
(in the XSD example suite) work - the iterator which is used there looks in the
v_ field. Actually, it's quite
the same thing here, the "begin()" function returns the iterator at the position
v_.begin(). In the "library"
example, v_ contains the three elements corresponding to the book records. Here,
like I said, for iCity this
field is [0](), so the for loop doesn't happen. The objects are not there, but
they can, however, be found
in the map_ of the container_ field. I don't know what I could use from the
public interface to get to those
records. Actually, if this is the right situation (and those earlier mentioned
maps aren't wrong), what I would
like to know is what I can iterate upon in this case.
Again, I'm sorry if I'm being obnoxious, but this is rather stressful. Thank you
for your understanding.
Victor
----- Original Message ----
From: Boris Kolpackov <boris at codesynthesis.com>
To: Adrian Victor Manoliu <victor.manoliu at yahoo.com>
Cc: xsd-users at codesynthesis.com
Sent: Wed, February 23, 2011 2:31:45 PM
Subject: Re: [xsd-users] CityGML deserialization - CityModel generation
Hi Victor,
Adrian Victor Manoliu <victor.manoliu at yahoo.com> writes:
> What I meant to say was that after the CityModel method is called, iCity is
>made
> of three fields: flags_, container_ and v_.
These are private, implementation-specific members of the CityModelType
class. Why do you insist on looking into the implementation details? Did
you try to access the data stored in CityModelType using the public
interface? In particular, did you try to iterate over the
_GenericApplicationPropertyOfCityModel element sequence that is contained
in CityModelType? Note also that it is an abstract element and you will
need to cast it to one of the concrete types, as described in Section
2.11, "Mapping for xsi:type and Substitution Groups" in the C++/Tree
Mapping User Manual:
http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/manual/#2.11
Boris
More information about the xsd-users
mailing list