void GeoDataPlacemark::unpack( QDataStream& stream ) { detach(); p()->m_geometry->setParent( this ); GeoDataFeature::unpack( stream ); stream >> p()->m_countrycode; stream >> p()->m_area; stream >> p()->m_population; int geometryId; stream >> geometryId; switch( geometryId ) { case InvalidGeometryId: break; case GeoDataPointId: { GeoDataPoint* point = new GeoDataPoint; point->unpack( stream ); delete p()->m_geometry; p()->m_geometry = point; } break; case GeoDataLineStringId: { GeoDataLineString* lineString = new GeoDataLineString; lineString->unpack( stream ); delete p()->m_geometry; p()->m_geometry = lineString; } break; case GeoDataLinearRingId: { GeoDataLinearRing* linearRing = new GeoDataLinearRing; linearRing->unpack( stream ); delete p()->m_geometry; p()->m_geometry = linearRing; } break; case GeoDataPolygonId: { GeoDataPolygon* polygon = new GeoDataPolygon; polygon->unpack( stream ); delete p()->m_geometry; p()->m_geometry = polygon; } break; case GeoDataMultiGeometryId: { GeoDataMultiGeometry* multiGeometry = new GeoDataMultiGeometry; multiGeometry->unpack( stream ); delete p()->m_geometry; p()->m_geometry = multiGeometry; } break; case GeoDataModelId: break; default: break; }; }
void GeoDataMultiGeometry::unpack( QDataStream& stream ) { detach(); GeoDataGeometry::unpack( stream ); int size = 0; stream >> size; for( int i = 0; i < size; i++ ) { int geometryId; stream >> geometryId; switch( geometryId ) { case InvalidGeometryId: break; case GeoDataPointId: { GeoDataPoint *point = new GeoDataPoint; point->unpack( stream ); p()->m_vector.append( point ); } break; case GeoDataLineStringId: { GeoDataLineString *lineString = new GeoDataLineString; lineString->unpack( stream ); p()->m_vector.append( lineString ); } break; case GeoDataLinearRingId: { GeoDataLinearRing *linearRing = new GeoDataLinearRing; linearRing->unpack( stream ); p()->m_vector.append( linearRing ); } break; case GeoDataPolygonId: { GeoDataPolygon *polygon = new GeoDataPolygon; polygon->unpack( stream ); p()->m_vector.append( polygon ); } break; case GeoDataMultiGeometryId: { GeoDataMultiGeometry *multiGeometry = new GeoDataMultiGeometry; multiGeometry->unpack( stream ); p()->m_vector.append( multiGeometry ); } break; case GeoDataModelId: break; default: break; }; } }