- color and altitude mode can be changed from GUI
git-svn-id: http://moon:8086/svn/software/trunk/projects/FsTrack@126 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
+35
-5
@@ -10,6 +10,8 @@ Kml::Kml(const char *pDocRoot)
|
||||
, m_pPlanePlaceMark(nullptr)
|
||||
, m_pPathPlaceMark(nullptr)
|
||||
, m_docRoot(pDocRoot)
|
||||
, m_altitudeModeString("absolute")
|
||||
, m_pathColorString("0xff00ffff")
|
||||
{
|
||||
memset(m_path, 0, sizeof(m_path));
|
||||
}
|
||||
@@ -60,6 +62,35 @@ void Kml::destroy()
|
||||
m_pPathPlaceMark = nullptr;
|
||||
}
|
||||
|
||||
void Kml::setAltitudeMode(String const &modeString)
|
||||
{
|
||||
m_altitudeModeString = modeString;
|
||||
|
||||
if (m_pPlanePlaceMark)
|
||||
{
|
||||
m_pPlanePlaceMark->getChildByName("Point")->getChildByName("altitudeMode")->getFirstChildElement()->setText(modeString);
|
||||
}
|
||||
|
||||
if (m_pPathPlaceMark)
|
||||
{
|
||||
m_pPathPlaceMark->getChildByName("LineString")->getChildByName("altitudeMode")->getFirstChildElement()->setText(modeString);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Kml::setPathColor(String const &colorString)
|
||||
{
|
||||
const ScopedLock sl (m_lock);
|
||||
|
||||
m_pathColorString = colorString;
|
||||
|
||||
if (m_pPathPlaceMark)
|
||||
{
|
||||
m_pPathPlaceMark->getChildByName("Style")->getChildByName("LineStyle")->getChildByName("color")->getFirstChildElement()->setText(colorString);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Kml::update(FlightData const &flightData)
|
||||
{
|
||||
const ScopedLock sl (m_lock);
|
||||
@@ -143,7 +174,7 @@ void Kml::updatePlane(FlightData const &flightData)
|
||||
pTesselate = pPoint->createNewChildElement("tesselate");
|
||||
pTesselate->addTextElement("1");
|
||||
pAltitudeMode = pPoint->createNewChildElement("altitudeMode");
|
||||
pAltitudeMode->addTextElement("absolute");
|
||||
pAltitudeMode->addTextElement(m_altitudeModeString);
|
||||
pCoords = pPoint->createNewChildElement("coordinates");
|
||||
sprintf(temp_str, "%9.6f,%9.6f,%9.6f", flightData.lon, flightData.lat, flightData.alt_meter);
|
||||
pCoords->addTextElement(temp_str);
|
||||
@@ -206,8 +237,7 @@ void Kml::updatePath(FlightData const &flightData)
|
||||
// LineStyle
|
||||
pLineStyle = pStyle->createNewChildElement("LineStyle");
|
||||
pLineColor = pLineStyle->createNewChildElement("color");
|
||||
sprintf(temp_str, "%4.4X\n", 0xff00ffff);
|
||||
pLineColor->addTextElement(temp_str);
|
||||
pLineColor->addTextElement(m_pathColorString);
|
||||
|
||||
pLineWidth = pLineStyle->createNewChildElement("width");
|
||||
pLineWidth->addTextElement("4");
|
||||
@@ -215,7 +245,7 @@ void Kml::updatePath(FlightData const &flightData)
|
||||
// PolyStyle
|
||||
pPolyStyle = pStyle->createNewChildElement("PolyStyle");
|
||||
pPolyColor = pPolyStyle->createNewChildElement("color");
|
||||
sprintf(temp_str, "%4.4X\n", 0x7f00ff00);
|
||||
sprintf(temp_str, "%4.4X", 0x7f00ff00);
|
||||
pPolyColor->addTextElement(temp_str);
|
||||
|
||||
// LineString
|
||||
@@ -225,7 +255,7 @@ void Kml::updatePath(FlightData const &flightData)
|
||||
pTesselate = pLineString->createNewChildElement("tesselate");
|
||||
pTesselate->addTextElement("1");
|
||||
pAltitudeMode = pLineString->createNewChildElement("altitudeMode");
|
||||
pAltitudeMode->addTextElement("absolute");
|
||||
pAltitudeMode->addTextElement(m_altitudeModeString);
|
||||
pCoords = pLineString->createNewChildElement("coordinates");
|
||||
sprintf(temp_str, "%9.6f,%9.6f,%9.6f", flightData.lon, flightData.lat, flightData.alt_meter);
|
||||
pCoords->addTextElement(temp_str);
|
||||
|
||||
Reference in New Issue
Block a user