std::string ShipDesign::Dump() const { std::string retval = DumpIndent() + "ShipDesign\n"; ++g_indent; retval += DumpIndent() + "name = \"" + m_name + "\"\n"; retval += DumpIndent() + "description = \"" + m_description + "\"\n"; std::cout << "ShipDesign::Dump: m_name_desc_in_stringtable: " << m_name_desc_in_stringtable << std::endl; if (!m_name_desc_in_stringtable) retval += DumpIndent() + "NoStringtableLookup\n"; retval += DumpIndent() + "hull = \"" + m_hull + "\"\n"; retval += DumpIndent() + "parts = "; if (m_parts.empty()) { retval += "[]\n"; } else if (m_parts.size() == 1) { retval += "\"" + *m_parts.begin() + "\"\n"; } else { retval += "[\n"; ++g_indent; for (std::vector<std::string>::const_iterator it = m_parts.begin(); it != m_parts.end(); ++it) { retval += DumpIndent() + "\"" + *it + "\"\n"; } --g_indent; retval += DumpIndent() + "]\n"; } if (!m_icon.empty()) retval += DumpIndent() + "icon = \"" + m_icon + "\"\n"; retval += DumpIndent() + "model = \"" + m_3D_model + "\"\n"; --g_indent; return retval; }
std::string ShipDesign::Dump() const { std::string retval = DumpIndent() + "ShipDesign\n"; ++g_indent; retval += DumpIndent() + "name = \"" + m_name + "\"\n"; retval += DumpIndent() + "description = \"" + m_description + "\"\n"; retval += DumpIndent() + "lookup_strings = " + (m_name_desc_in_stringtable ? "true" : "false") + "\n"; retval += DumpIndent() + "hull = \"" + m_hull + "\"\n"; retval += DumpIndent() + "parts = "; if (m_parts.empty()) { retval += "[]\n"; } else if (m_parts.size() == 1) { retval += "\"" + *m_parts.begin() + "\"\n"; } else { retval += "[\n"; ++g_indent; for (std::vector<std::string>::const_iterator it = m_parts.begin(); it != m_parts.end(); ++it) { retval += DumpIndent() + "\"" + *it + "\"\n"; } --g_indent; retval += DumpIndent() + "]\n"; } retval += DumpIndent() + "icon = \"" + m_icon + "\"\n"; retval += DumpIndent() + "model = \"" + m_3D_model + "\"\n"; --g_indent; return retval; }
std::string FocusType::Dump(unsigned short ntabs) const { std::string retval = DumpIndent(ntabs) + "FocusType\n"; retval += DumpIndent(ntabs+1) + "name = \"" + m_name + "\"\n"; retval += DumpIndent(ntabs+1) + "description = \"" + m_description + "\"\n"; retval += DumpIndent(ntabs+1) + "location = \n"; retval += m_location->Dump(ntabs+2); retval += DumpIndent(ntabs+1) + "graphic = \"" + m_graphic + "\"\n"; return retval; }
std::string FocusType::Dump() const { std::string retval = DumpIndent() + "FocusType\n"; ++g_indent; retval += DumpIndent() + "name = \"" + m_name + "\"\n"; retval += DumpIndent() + "description = \"" + m_description + "\"\n"; retval += DumpIndent() + "location = \n"; ++g_indent; retval += m_location->Dump(); --g_indent; retval += DumpIndent() + "graphic = \"" + m_graphic + "\"\n"; --g_indent; return retval; }
static void DumpTags(const osmscout::TypeConfig* typeConfig, const std::vector<osmscout::Tag>& tags, size_t indent) { DumpIndent(indent); std::cout << "tags {" << std::endl; for (size_t t=0; t<tags.size(); t++) { DumpIndent(indent+2); std::cout << typeConfig->GetTagInfo(tags[t].key).GetName() << ": " <<tags[t].value << std::endl; } DumpIndent(indent); std::cout << "}" << std::endl; }
std::string FieldType::Dump() const { std::string retval = DumpIndent() + "FieldType\n"; ++g_indent; retval += DumpIndent() + "name = \"" + m_name + "\"\n"; retval += DumpIndent() + "description = \"" + m_description + "\"\n"; retval += DumpIndent() + "location = \n"; //++g_indent; //retval += m_location->Dump(); //--g_indent; if (m_effects.size() == 1) { retval += DumpIndent() + "effectsgroups =\n"; ++g_indent; retval += m_effects[0]->Dump(); --g_indent; } else { retval += DumpIndent() + "effectsgroups = [\n"; ++g_indent; for (std::shared_ptr<Effect::EffectsGroup> effect : m_effects) { retval += effect->Dump(); } --g_indent; retval += DumpIndent() + "]\n"; } retval += DumpIndent() + "graphic = \"" + m_graphic + "\"\n"; --g_indent; return retval; }
static void DumpAccessRestrictedFeatureValue(const osmscout::AccessRestrictedFeatureValue& accessValue, size_t indent) { DumpIndent(indent); std::cout << "AccessRestricted {" << std::endl; if (!accessValue.CanAccessFoot()) { DumpIndent(indent+2); std::cout << "foot: restricted" << std::endl; } if (!accessValue.CanAccessBicycle()) { DumpIndent(indent+2); std::cout << "bicycle: restricted" << std::endl; } if (!accessValue.CanAccessCar()) { DumpIndent(indent+2); std::cout << "car: restricted" << std::endl; } DumpIndent(indent); std::cout << "}" << std::endl; }
static void DumpNodeAttributes(const osmscout::TypeId& type, const osmscout::NodeAttributes& attributes, const osmscout::TypeConfig* typeConfig, size_t indent) { if (type!=osmscout::typeIgnore) { std::cout << " type: " << typeConfig->GetTypeInfo(type).GetName() << std::endl; } if (!attributes.GetName().empty()) { DumpIndent(indent); std::cout << "name: " << attributes.GetName() << std::endl; } if (!attributes.GetNameAlt().empty()) { DumpIndent(indent); std::cout << "nameAlt: " << attributes.GetNameAlt() << std::endl; } if (!attributes.GetLocation().empty()) { DumpIndent(indent); std::cout << "street: " << attributes.GetLocation() << std::endl; } if (!attributes.GetAddress().empty()) { DumpIndent(indent); std::cout << "houseNr: " << attributes.GetAddress() << std::endl; } if (attributes.HasTags()) { std::cout << std::endl; DumpTags(typeConfig, attributes.GetTags(), indent); } }
std::string FieldType::Dump(unsigned short ntabs) const { std::string retval = DumpIndent(ntabs) + "FieldType\n"; retval += DumpIndent(ntabs+1) + "name = \"" + m_name + "\"\n"; retval += DumpIndent(ntabs+1) + "description = \"" + m_description + "\"\n"; retval += DumpIndent(ntabs+1) + "location = \n"; //retval += m_location->Dump(ntabs+2); if (m_effects.size() == 1) { retval += DumpIndent(ntabs+1) + "effectsgroups =\n"; retval += m_effects[0]->Dump(ntabs+2); } else { retval += DumpIndent(ntabs+1) + "effectsgroups = [\n"; for (auto& effect : m_effects) { retval += effect->Dump(ntabs+2); } retval += DumpIndent(ntabs+1) + "]\n"; } retval += DumpIndent(ntabs+1) + "graphic = \"" + m_graphic + "\"\n"; return retval; }
static void DoDump( reg_tree *tree, int indent ) { /****************************************************/ DumpIndent( indent ); DumpRegs( tree->regs ); DumpNL(); DumpIndent( indent ); DumpLiteral( "offset " ); DumpInt( tree->offset ); DumpLiteral( " size " ); DumpInt( tree->size ); DumpNL(); if( tree->temp != NULL ) { DumpIndent( indent ); DumpLiteral( "name " ); DumpPtr( tree->temp ); DumpChar( ' ' ); DumpSym( tree->temp ); DumpNL(); } if( tree->alt != NULL ) { DumpIndent( indent ); DumpLiteral( "alt " ); DumpPtr( tree->alt ); DumpChar( ' ' ); DumpSym( tree->alt ); DumpNL(); } if( tree->hi != NULL ) { DumpIndent( indent ); DumpLiteral( "high " ); DumpNL(); DoDump( tree->hi, indent + 4 ); } if( tree->lo != NULL ) { DumpIndent( indent ); DumpLiteral( "low " ); DumpNL(); DoDump( tree->lo, indent + 4 ); } }
std::string Species::Dump() const { std::string retval = DumpIndent() + "Species\n"; ++g_indent; retval += DumpIndent() + "name = \"" + m_name + "\"\n"; retval += DumpIndent() + "description = \"" + m_description + "\"\n"; retval += DumpIndent() + "gameplay_description = \"" + m_gameplay_description + "\"\n"; if (m_playable) retval += DumpIndent() + "Playable\n"; if (m_native) retval += DumpIndent() + "Native\n"; if (m_can_produce_ships) retval += DumpIndent() + "CanProduceShips\n"; if (m_can_colonize) retval += DumpIndent() + "CanColonize\n"; if (m_foci.size() == 1) { retval += DumpIndent() + "foci =\n"; m_foci.begin()->Dump(); } else { retval += DumpIndent() + "foci = [\n"; ++g_indent; for (std::vector<FocusType>::const_iterator it = m_foci.begin(); it != m_foci.end(); ++it) { retval += it->Dump(); } --g_indent; retval += DumpIndent() + "]\n"; } if (m_effects.size() == 1) { retval += DumpIndent() + "effectsgroups =\n"; ++g_indent; retval += m_effects[0]->Dump(); --g_indent; } else { retval += DumpIndent() + "effectsgroups = [\n"; ++g_indent; for (unsigned int i = 0; i < m_effects.size(); ++i) { retval += m_effects[i]->Dump(); } --g_indent; retval += DumpIndent() + "]\n"; } if (m_planet_environments.size() == 1) { retval += DumpIndent() + "environments =\n"; ++g_indent; retval += DumpIndent() + "type = " + PlanetTypeToString(m_planet_environments.begin()->first) + " environment = " + PlanetEnvironmentToString(m_planet_environments.begin()->second) + "\n"; --g_indent; } else { retval += DumpIndent() + "environments = [\n"; ++g_indent; for (std::map<PlanetType, PlanetEnvironment>::const_iterator it = m_planet_environments.begin(); it != m_planet_environments.end(); ++it) { retval += DumpIndent() + "type = " + PlanetTypeToString(it->first) + " environment = " + PlanetEnvironmentToString(it->second) + "\n"; } --g_indent; retval += DumpIndent() + "]\n"; } retval += DumpIndent() + "graphic = \"" + m_graphic + "\"\n"; --g_indent; return retval; }
std::string Species::Dump(unsigned short ntabs) const { std::string retval = DumpIndent(ntabs) + "Species\n"; retval += DumpIndent(ntabs+1) + "name = \"" + m_name + "\"\n"; retval += DumpIndent(ntabs+1) + "description = \"" + m_description + "\"\n"; retval += DumpIndent(ntabs+1) + "gameplay_description = \"" + m_gameplay_description + "\"\n"; if (m_playable) retval += DumpIndent(ntabs+1) + "Playable\n"; if (m_native) retval += DumpIndent(ntabs+1) + "Native\n"; if (m_can_produce_ships) retval += DumpIndent(ntabs+1) + "CanProduceShips\n"; if (m_can_colonize) retval += DumpIndent(ntabs+1) + "CanColonize\n"; if (m_foci.size() == 1) { retval += DumpIndent(ntabs+1) + "foci =\n"; m_foci.begin()->Dump(ntabs+1); } else { retval += DumpIndent(ntabs+1) + "foci = [\n"; for (const FocusType& focus : m_foci) retval += focus.Dump(ntabs+2); retval += DumpIndent(ntabs+1) + "]\n"; } if (m_effects.size() == 1) { retval += DumpIndent(ntabs+1) + "effectsgroups =\n"; retval += m_effects[0]->Dump(ntabs+2); } else { retval += DumpIndent(ntabs+1) + "effectsgroups = [\n"; for (auto& effect : m_effects) retval += effect->Dump(ntabs+2); retval += DumpIndent(ntabs+1) + "]\n"; } if (m_combat_targets) retval += DumpIndent(ntabs+1) + "combatTargets = " + m_combat_targets->Dump(ntabs+2); if (m_planet_environments.size() == 1) { retval += DumpIndent(ntabs+1) + "environments =\n"; retval += DumpIndent(ntabs+2) + "type = " + PlanetTypeToString(m_planet_environments.begin()->first) + " environment = " + PlanetEnvironmentToString(m_planet_environments.begin()->second) + "\n"; } else { retval += DumpIndent(ntabs+1) + "environments = [\n"; for (const auto& entry : m_planet_environments) { retval += DumpIndent(ntabs+2) + "type = " + PlanetTypeToString(entry.first) + " environment = " + PlanetEnvironmentToString(entry.second) + "\n"; } retval += DumpIndent(ntabs+1) + "]\n"; } retval += DumpIndent(ntabs+1) + "graphic = \"" + m_graphic + "\"\n"; return retval; }
static void DumpAccessFeatureValue(const osmscout::AccessFeatureValue& accessValue, size_t indent) { DumpIndent(indent); std::cout << "Access {" << std::endl; if (accessValue.IsOnewayForward()) { DumpIndent(indent+2); std::cout << "oneway: forward" << std::endl; } else if (accessValue.IsOnewayBackward()) { DumpIndent(indent+2); std::cout << "oneway: backward" << std::endl; } if (accessValue.CanRouteFoot()) { DumpIndent(indent+2); std::cout << "foot: both" << std::endl; } else if (accessValue.CanRouteFootForward()) { DumpIndent(indent+2); std::cout << "foot: forward" << std::endl; } else if (accessValue.CanRouteFootBackward()) { DumpIndent(indent+2); std::cout << "foot: backward" << std::endl; } if (accessValue.CanRouteBicycle()) { DumpIndent(indent+2); std::cout << "bicycle: both" << std::endl; } else if (accessValue.CanRouteBicycleForward()) { DumpIndent(indent+2); std::cout << "bicycle: forward" << std::endl; } else if (accessValue.CanRouteBicycleBackward()) { DumpIndent(indent+2); std::cout << "bicycle: backward" << std::endl; } if (accessValue.CanRouteCar()) { DumpIndent(indent+2); std::cout << "car: both" << std::endl; } else if (accessValue.CanRouteCarForward()) { DumpIndent(indent+2); std::cout << "car: forward" << std::endl; } else if (accessValue.CanRouteCarBackward()) { DumpIndent(indent+2); std::cout << "car: backward" << std::endl; } DumpIndent(indent); std::cout << "}" << std::endl; }
std::string Special::Dump() const { std::string retval = DumpIndent() + "Special\n"; ++g_indent; retval += DumpIndent() + "name = \"" + m_name + "\"\n"; retval += DumpIndent() + "description = \"" + m_description + "\"\n"; if (m_stealth) retval += DumpIndent() + "stealth = " + m_stealth->Dump() + "\n"; retval += DumpIndent() + "spawnrate = " + boost::lexical_cast<std::string>(m_spawn_rate) + "\n" + DumpIndent() + "spawnlimit = " + boost::lexical_cast<std::string>(m_spawn_limit) + "\n"; if (m_initial_capacity) { retval += DumpIndent() + "initialcapacity = "; ++g_indent; retval += m_initial_capacity->Dump(); --g_indent; } if (m_location) { retval += DumpIndent() + "location =\n"; ++g_indent; retval += m_location->Dump(); --g_indent; } if (m_effects.size() == 1) { retval += DumpIndent() + "effectsgroups =\n"; ++g_indent; retval += m_effects[0]->Dump(); --g_indent; } else { retval += DumpIndent() + "effectsgroups = [\n"; ++g_indent; for (boost::shared_ptr<Effect::EffectsGroup> effect : m_effects) { retval += effect->Dump(); } --g_indent; retval += DumpIndent() + "]\n"; } retval += DumpIndent() + "graphic = \"" + m_graphic + "\"\n"; --g_indent; return retval; }
std::string BuildingType::Dump() const { std::string retval = DumpIndent() + "BuildingType\n"; ++g_indent; retval += DumpIndent() + "name = \"" + m_name + "\"\n"; retval += DumpIndent() + "description = \"" + m_description + "\"\n"; if (m_production_cost) retval += DumpIndent() + "buildcost = " + m_production_cost->Dump() + "\n"; if (m_production_time) retval += DumpIndent() + "buildtime = " + m_production_time->Dump() + "\n"; retval += DumpIndent() + (m_producible ? "Producible" : "Unproducible") + "\n"; retval += DumpIndent() + "captureresult = " + boost::lexical_cast<std::string>(m_capture_result) + "\n"; if (!m_tags.empty()) { if (m_tags.size() == 1) { retval += DumpIndent() + "tags = \"" + *m_tags.begin() + "\"\n"; } else { retval += DumpIndent() + "tags = [ "; for (const std::string& tag : m_tags) { retval += "\"" + tag + "\" "; } retval += " ]\n"; } } if (m_location) { retval += DumpIndent() + "location = \n"; ++g_indent; retval += m_location->Dump(); --g_indent; } if (m_enqueue_location) { retval += DumpIndent() + "enqueue location = \n"; ++g_indent; retval += m_enqueue_location->Dump(); --g_indent; } if (m_effects.size() == 1) { retval += DumpIndent() + "effectsgroups =\n"; ++g_indent; retval += m_effects[0]->Dump(); --g_indent; } else { retval += DumpIndent() + "effectsgroups = [\n"; ++g_indent; for (std::shared_ptr<Effect::EffectsGroup> effect : m_effects) { retval += effect->Dump(); } --g_indent; retval += DumpIndent() + "]\n"; } retval += DumpIndent() + "icon = \"" + m_icon + "\"\n"; --g_indent; return retval; }
static void DumpWayAttributes(const osmscout::WayAttributes& attributes, const osmscout::TypeConfig* typeConfig, size_t indent) { if (attributes.GetType()!=osmscout::typeIgnore) { DumpIndent(indent); std::cout << "type: " << typeConfig->GetTypeInfo(attributes.GetType()).GetName() << std::endl; } if (!attributes.GetName().empty()) { DumpIndent(indent); std::cout << "name: " << attributes.GetName() << std::endl; } if (!attributes.GetNameAlt().empty()) { DumpIndent(indent); std::cout << "nameAlt: " << attributes.GetNameAlt() << std::endl; } if (!attributes.GetLocation().empty()) { DumpIndent(indent); std::cout << "street: " << attributes.GetLocation() << std::endl; } if (!attributes.GetAddress().empty()) { DumpIndent(indent); std::cout << "houseNr: " << attributes.GetAddress() << std::endl; } if (!attributes.GetRefName().empty()) { DumpIndent(indent); std::cout << "ref: " << attributes.GetRefName() << std::endl; } if (!attributes.HasAccess()) { DumpIndent(indent); std::cout << "access: false" << std::endl; } if (attributes.GetAccess().IsOnewayForward()) { DumpIndent(indent); std::cout << "oneway: forward" << std::endl; } else if (attributes.GetAccess().IsOnewayBackward()) { DumpIndent(indent); std::cout << "oneway: backward" << std::endl; } if (attributes.GetAccess().CanRouteFoot()) { DumpIndent(indent); std::cout << "foot: both" << std::endl; } else if (attributes.GetAccess().CanRouteFootForward()) { DumpIndent(indent); std::cout << "foot: forward" << std::endl; } else if (attributes.GetAccess().CanRouteFootBackward()) { DumpIndent(indent); std::cout << "foot: backward" << std::endl; } if (attributes.GetAccess().CanRouteBicycle()) { DumpIndent(indent); std::cout << "bicycle: both" << std::endl; } else if (attributes.GetAccess().CanRouteBicycleForward()) { DumpIndent(indent); std::cout << "bicycle: forward" << std::endl; } else if (attributes.GetAccess().CanRouteBicycleBackward()) { DumpIndent(indent); std::cout << "bicycle: backward" << std::endl; } if (attributes.GetAccess().CanRouteCar()) { DumpIndent(indent); std::cout << "car: both" << std::endl; } else if (attributes.GetAccess().CanRouteCarForward()) { DumpIndent(indent); std::cout << "car: forward" << std::endl; } else if (attributes.GetAccess().CanRouteCarBackward()) { DumpIndent(indent); std::cout << "car: backward" << std::endl; } if (attributes.IsBridge()) { DumpIndent(indent); std::cout << "bridge: true" << std::endl; } if (attributes.IsTunnel()) { DumpIndent(indent); std::cout << "tunnel: true" << std::endl; } if (attributes.IsRoundabout()) { DumpIndent(indent); std::cout << "roundabout: true" << std::endl; } if (attributes.GetWidth()!=0) { DumpIndent(indent); std::cout << "width: " << (size_t)attributes.GetWidth() << std::endl; } if (attributes.GetLayer()!=0) { DumpIndent(indent); std::cout << "layer: " << (size_t)attributes.GetLayer() << std::endl; } if (attributes.GetMaxSpeed()!=0) { DumpIndent(indent); std::cout << "maxSpeed: " << (size_t)attributes.GetMaxSpeed() << std::endl; } DumpIndent(indent); std::cout << "grade: " << (size_t)attributes.GetGrade() << std::endl; if (attributes.HasTags()) { std::cout << std::endl; DumpTags(typeConfig, attributes.GetTags(), indent); } }
std::string Species::Dump() const { std::string retval = DumpIndent() + "Species\n"; ++g_indent; retval += DumpIndent() + "name = \"" + m_name + "\"\n"; retval += DumpIndent() + "description = \"" + m_description + "\"\n"; retval += DumpIndent() + "gameplay_description = \"" + m_gameplay_description + "\"\n"; if (m_playable) retval += DumpIndent() + "Playable\n"; if (m_native) retval += DumpIndent() + "Native\n"; if (m_can_produce_ships) retval += DumpIndent() + "CanProduceShips\n"; if (m_can_colonize) retval += DumpIndent() + "CanColonize\n"; if (m_foci.size() == 1) { retval += DumpIndent() + "foci =\n"; m_foci.begin()->Dump(); } else { retval += DumpIndent() + "foci = [\n"; ++g_indent; for (const FocusType& focus : m_foci) { retval += focus.Dump(); } --g_indent; retval += DumpIndent() + "]\n"; } if (m_effects.size() == 1) { retval += DumpIndent() + "effectsgroups =\n"; ++g_indent; retval += m_effects[0]->Dump(); --g_indent; } else { retval += DumpIndent() + "effectsgroups = [\n"; ++g_indent; for (std::shared_ptr<Effect::EffectsGroup> effect : m_effects) { retval += effect->Dump(); } --g_indent; retval += DumpIndent() + "]\n"; } if (m_planet_environments.size() == 1) { retval += DumpIndent() + "environments =\n"; ++g_indent; retval += DumpIndent() + "type = " + PlanetTypeToString(m_planet_environments.begin()->first) + " environment = " + PlanetEnvironmentToString(m_planet_environments.begin()->second) + "\n"; --g_indent; } else { retval += DumpIndent() + "environments = [\n"; ++g_indent; for (const std::map<PlanetType, PlanetEnvironment>::value_type& entry : m_planet_environments) { retval += DumpIndent() + "type = " + PlanetTypeToString(entry.first) + " environment = " + PlanetEnvironmentToString(entry.second) + "\n"; } --g_indent; retval += DumpIndent() + "]\n"; } retval += DumpIndent() + "graphic = \"" + m_graphic + "\"\n"; --g_indent; return retval; }
static void DumpFeatureValueBuffer(const osmscout::FeatureValueBuffer& buffer, size_t indent) { for (size_t idx=0; idx<buffer.GetFeatureCount(); idx++) { osmscout::FeatureInstance meta=buffer.GetFeature(idx); if (buffer.HasFeature(idx)) { if (meta.GetFeature()->HasValue()) { osmscout::FeatureValue *value=buffer.GetValue(idx); if (dynamic_cast<osmscout::NameFeatureValue*>(value)!=NULL) { osmscout::NameFeatureValue *nameValue=dynamic_cast<osmscout::NameFeatureValue*>(value); DumpIndent(indent); std::cout << "Name: " << nameValue->GetName() << std::endl; } else if (dynamic_cast<osmscout::NameAltFeatureValue*>(value)!=NULL) { osmscout::NameAltFeatureValue *nameAltValue=dynamic_cast<osmscout::NameAltFeatureValue*>(value); DumpIndent(indent); std::cout << "NameAlt: " << nameAltValue->GetNameAlt() << std::endl; } else if (dynamic_cast<osmscout::RefFeatureValue*>(value)!=NULL) { osmscout::RefFeatureValue *refValue=dynamic_cast<osmscout::RefFeatureValue*>(value); DumpIndent(indent); std::cout << "Ref: " << refValue->GetRef() << std::endl; } else if (dynamic_cast<osmscout::LocationFeatureValue*>(value)!=NULL) { osmscout::LocationFeatureValue *locationValue=dynamic_cast<osmscout::LocationFeatureValue*>(value); DumpIndent(indent); std::cout << "Location: "<< locationValue->GetLocation() << std::endl; } else if (dynamic_cast<osmscout::AddressFeatureValue*>(value)!=NULL) { osmscout::AddressFeatureValue *addressValue=dynamic_cast<osmscout::AddressFeatureValue*>(value); DumpIndent(indent); std::cout << "Address: " << addressValue->GetAddress() << std::endl; } else if (dynamic_cast<osmscout::AccessFeatureValue*>(value)!=NULL) { osmscout::AccessFeatureValue *accessValue=dynamic_cast<osmscout::AccessFeatureValue*>(value); DumpAccessFeatureValue(*accessValue, indent); } else if (dynamic_cast<osmscout::AccessRestrictedFeatureValue*>(value)!=NULL) { osmscout::AccessRestrictedFeatureValue *accessValue=dynamic_cast<osmscout::AccessRestrictedFeatureValue*>(value); DumpAccessRestrictedFeatureValue(*accessValue, indent); } else if (dynamic_cast<osmscout::LayerFeatureValue*>(value)!=NULL) { osmscout::LayerFeatureValue *layerValue=dynamic_cast<osmscout::LayerFeatureValue*>(value); DumpIndent(indent); std::cout << "Layer: " << (int)layerValue->GetLayer() << std::endl; } else if (dynamic_cast<osmscout::WidthFeatureValue*>(value)!=NULL) { osmscout::WidthFeatureValue *widthValue=dynamic_cast<osmscout::WidthFeatureValue*>(value); DumpIndent(indent); std::cout << "Width: " << (int)widthValue->GetWidth() << std::endl; } else if (dynamic_cast<osmscout::MaxSpeedFeatureValue*>(value)!=NULL) { osmscout::MaxSpeedFeatureValue *maxSpeedValue=dynamic_cast<osmscout::MaxSpeedFeatureValue*>(value); DumpIndent(indent); std::cout << "MaxSpeed: " << (int)maxSpeedValue->GetMaxSpeed() << std::endl; } else if (dynamic_cast<osmscout::GradeFeatureValue*>(value)!=NULL) { osmscout::GradeFeatureValue *gradeValue=dynamic_cast<osmscout::GradeFeatureValue*>(value); DumpIndent(indent); std::cout << "Grade: " << (int)gradeValue->GetGrade() << std::endl; } else if (dynamic_cast<osmscout::AdminLevelFeatureValue*>(value)!=NULL) { osmscout::AdminLevelFeatureValue *adminLevelValue=dynamic_cast<osmscout::AdminLevelFeatureValue*>(value); DumpIndent(indent); std::cout << "AdminLevel: " << (unsigned int)adminLevelValue->GetAdminLevel() << std::endl; } else if (meta.GetFeature()->HasLabel()) { DumpIndent(indent); std::cout << meta.GetFeature()->GetName() << ": "; std::cout << value->GetLabel(); std::cout << std::endl; } else { DumpIndent(indent); std::cout << meta.GetFeature()->GetName() << ": "; std::cout << "<Unknown value>"; std::cout << std::endl; } } // Flag-like Features else { // We are just a flag... DumpIndent(indent); std::cout << meta.GetFeature()->GetName() << ": true"; std::cout << std::endl; } } // Features with default value else { if (meta.GetFeature()->GetName()==osmscout::AccessFeature::NAME) { osmscout::AccessFeatureValue accessValue(buffer.GetType()->GetDefaultAccess()); DumpAccessFeatureValue(accessValue, indent); } else if (!meta.GetFeature()->HasValue()) { // We are just a flag... DumpIndent(indent); std::cout << meta.GetFeature()->GetName() << ": false"; std::cout << std::endl; } } } }
std::string Special::Dump() const { std::string retval = DumpIndent() + "Special\n"; ++g_indent; retval += DumpIndent() + "name = \"" + m_name + "\"\n"; retval += DumpIndent() + "description = \"" + m_description + "\"\n"; retval += DumpIndent() + "stealth = " + boost::lexical_cast<std::string>(m_stealth) + "\n"; retval += DumpIndent() + "spawnrate = " + boost::lexical_cast<std::string>(m_spawn_rate) + "\n" + DumpIndent() + "spawnlimit = " + boost::lexical_cast<std::string>(m_spawn_limit) + "\n"; retval += DumpIndent() + "location = \n"; ++g_indent; retval += m_location->Dump(); --g_indent; if (m_effects.size() == 1) { retval += DumpIndent() + "effectsgroups =\n"; ++g_indent; retval += m_effects[0]->Dump(); --g_indent; } else { retval += DumpIndent() + "effectsgroups = [\n"; ++g_indent; for (unsigned int i = 0; i < m_effects.size(); ++i) { retval += m_effects[i]->Dump(); } --g_indent; retval += DumpIndent() + "]\n"; } retval += DumpIndent() + "graphic = \"" + m_graphic + "\"\n"; --g_indent; return retval; }
std::string Special::Dump(unsigned short ntabs) const { std::string retval = DumpIndent(ntabs) + "Special\n"; retval += DumpIndent(ntabs+1) + "name = \"" + m_name + "\"\n"; retval += DumpIndent(ntabs+1) + "description = \"" + m_description + "\"\n"; if (m_stealth) retval += DumpIndent(ntabs+1) + "stealth = " + m_stealth->Dump(ntabs+1) + "\n"; retval += DumpIndent(ntabs+1) + "spawnrate = " + std::to_string(m_spawn_rate) + "\n" + DumpIndent(ntabs+1) + "spawnlimit = " + std::to_string(m_spawn_limit) + "\n"; if (m_initial_capacity) { retval += DumpIndent(ntabs+1) + "initialcapacity = "; retval += m_initial_capacity->Dump(ntabs+2); } if (m_location) { retval += DumpIndent(ntabs+1) + "location =\n"; retval += m_location->Dump(ntabs+2); } if (m_effects.size() == 1) { retval += DumpIndent(ntabs+1) + "effectsgroups =\n"; retval += m_effects[0]->Dump(ntabs+2); } else { retval += DumpIndent(ntabs+1) + "effectsgroups = [\n"; for (auto& effect : m_effects) retval += effect->Dump(ntabs+2); retval += DumpIndent(ntabs+1) + "]\n"; } retval += DumpIndent(ntabs+1) + "graphic = \"" + m_graphic + "\"\n"; return retval; }
static void DumpArea(const osmscout::AreaRef area, osmscout::Id id) { osmscout::GeoBox boundingBox; osmscout::GeoCoord center; area->GetBoundingBox(boundingBox); std::cout << "Area {" << std::endl; std::cout << " OSM id: " << id << std::endl; std::cout << " fileOffset: " << area->GetFileOffset() << std::endl; std::cout << " type: " << area->GetType()->GetName() << std::endl; std::cout << " boundingBox: " << boundingBox.GetDisplayText() << std::endl; std::cout << " center: " << boundingBox.GetCenter().GetDisplayText() << std::endl; std::cout << " cell level: " << CalculateCellLevel(boundingBox) << std::endl; std::cout << std::endl; DumpFeatureValueBuffer(area->rings.front().GetFeatureValueBuffer(), IDENT); for (size_t r=0; r<area->rings.size(); r++) { if (!area->rings[r].nodes.empty()) { area->rings[r].GetBoundingBox(boundingBox); } std::cout << std::endl; size_t ident; if (area->rings[r].IsMasterRing()) { ident=IDENT; } else { std::cout << " role[" << r << "] {" << std::endl; ident=IDENT+2; } if (area->rings[r].IsMasterRing()) { DumpIndent(ident); std::cout << "master" << std::endl; } else if (area->rings[r].IsOuterRing()) { DumpIndent(ident); std::cout << "outer" << std::endl; DumpIndent(ident); std::cout << "type: " << area->rings[r].GetType()->GetName() << std::endl; } else { DumpIndent(ident); std::cout << "ring: " << (size_t)area->rings[r].GetRing() << std::endl; DumpIndent(ident); std::cout << "type: " << area->rings[r].GetType()->GetName() << std::endl; } if (!area->rings[r].nodes.empty()) { DumpIndent(ident); std::cout << "boundingBox: " << boundingBox.GetDisplayText() << std::endl; DumpIndent(ident); std::cout << "center: " << boundingBox.GetCenter().GetDisplayText() << std::endl; } DumpFeatureValueBuffer(area->rings[r].GetFeatureValueBuffer(), ident); if (!area->rings[r].nodes.empty()) { std::cout << std::endl; for (size_t n=0; n<area->rings[r].nodes.size(); n++) { DumpIndent(ident); std::cout << "node[" << n << "] {"; if (area->rings[r].GetSerial(n)!=0) { std::cout << "serial: " << area->rings[r].GetSerial(n); } std::cout << " lat: " << area->rings[r].nodes[n].GetLat() << " lon: "<< area->rings[r].nodes[n].GetLon() << " }" << std::endl; } } if (!area->rings[r].IsMasterRing()) { ident-=2; DumpIndent(ident); std::cout << "}" << std::endl; } } std::cout << "}" << std::endl; }