Beispiel #1
0
/**
 * @brief KmlExport::createTimespanPlacemark Creates a timespan placemark, which allows the
 * trajectory to be played forward in time. The placemark also contains pertinent data about
 * the vehicle's state at that timespan
 * @param timestampPoint
 * @param lastPlacemarkTime
 * @param newPlacemarkTime
 * @return Returns the placemark containing the timespan
 */
PlacemarkPtr KmlExport::createTimespanPlacemark(const LLAVCoordinates &timestampPoint, quint32 lastPlacemarkTime, quint32 newPlacemarkTime)
{
    // Create coordinates
    CoordinatesPtr coordinates = factory->CreateCoordinates();
    coordinates->add_latlngalt(timestampPoint.latitude, timestampPoint.longitude, timestampPoint.altitude);

    // Create point, using previous coordinates
    PointPtr point = factory->CreatePoint();
    point->set_extrude(true); // Extrude to ground
    point->set_altitudemode(kmldom::ALTITUDEMODE_ABSOLUTE);
    point->set_coordinates(coordinates);

    // Create the timespan
    TimeSpanPtr timeSpan = factory->CreateTimeSpan();
    QDateTime startTime = QDateTime::currentDateTimeUtc().addMSecs(lastPlacemarkTime); // FIXME: Make it a function of the realtime preferably gotten from the GPS
    QDateTime endTime = QDateTime::currentDateTimeUtc().addMSecs(newPlacemarkTime);
    timeSpan->set_begin(startTime.toString(dateTimeFormat).toStdString());
    timeSpan->set_end(endTime.toString(dateTimeFormat).toStdString());

    // Create an icon style. This arrow icon will be rotated and colored to represent velocity
    AttitudeActual::DataFields attitudeActualData = attitudeActual->getData();
    AirspeedActual::DataFields airspeedActualData = airspeedActual->getData();
    IconStylePtr iconStyle = factory->CreateIconStyle();
    iconStyle->set_color(mapVelocity2Color(airspeedActualData.CalibratedAirspeed));
    iconStyle->set_heading(attitudeActualData.Yaw + 180); //Adding 180 degrees because the arrow art points down, i.e. south.

    // Create a line style. This defines the style for the "legs" connecting the points to the ground.
    LineStylePtr lineStyle = factory->CreateLineStyle();
    lineStyle->set_color(mapVelocity2Color(timestampPoint.groundspeed));

    // Link the style to the icon
    StylePtr style = factory->CreateStyle();
    style->set_linestyle(lineStyle);
    style->set_iconstyle(iconStyle);

    // Generate the placemark with all above attributes
    PlacemarkPtr placemark = factory->CreatePlacemark();
    placemark->set_geometry(point);
    placemark->set_timeprimitive(timeSpan);
    placemark->set_name(QString("%1").arg(timeStamp / 1000.0).toStdString());
    placemark->set_visibility(true);

    // Set the placemark to use the custom rotated arrow style
    placemark->set_styleurl("#directiveArrowStyle");
    placemark->set_styleselector(style);

    // Add a nice description to the placemark
    placemark->set_description(informationString.toStdString());

    return placemark;
}
Beispiel #2
0
void SchemeConfigParser::ResetClasses()
{
	for(StylePtrMap::iterator i = m_LoadState.m_Classes.begin(); 
		i != m_LoadState.m_Classes.end();
		++i)
	{
		(*i).second->Reset();
	}

	// Also going to reset the default colours here:
	m_LoadState.m_DefaultColours.Clear();

	// Now re-set the default style:
	StylePtr defcls = GetClass(_T("default"));
	defcls->Combine(NULL, m_LoadState.m_Default);
}
Beispiel #3
0
void createkmlliststyle (
    KmlFactory * poKmlFactory,
    const char* pszBaseName,
    ContainerPtr poKmlLayerContainer,
    DocumentPtr poKmlDocument,
    const CPLString& osListStyleType,
    const CPLString& osListStyleIconHref)
{
    if( osListStyleType.size() || osListStyleIconHref.size() )
    {
        StylePtr poKmlStyle = poKmlFactory->CreateStyle (  );

        const char* pszStyleName = CPLSPrintf("%s_liststyle", OGRLIBKMLGetSanitizedNCName(pszBaseName).c_str());
        poKmlStyle->set_id ( pszStyleName );

        ListStylePtr poKmlListStyle = poKmlFactory->CreateListStyle (  );
        poKmlStyle->set_liststyle ( poKmlListStyle );
        if( osListStyleType.size() )
        {
            if( EQUAL(osListStyleType, "check") )
                poKmlListStyle->set_listitemtype( kmldom::LISTITEMTYPE_CHECK );
            else if( EQUAL(osListStyleType, "radioFolder") )
                poKmlListStyle->set_listitemtype( kmldom::LISTITEMTYPE_RADIOFOLDER );
            else if( EQUAL(osListStyleType, "checkOffOnly") )
                poKmlListStyle->set_listitemtype( kmldom::LISTITEMTYPE_CHECKOFFONLY );
            else if( EQUAL(osListStyleType, "checkHideChildren") )
                poKmlListStyle->set_listitemtype( kmldom::LISTITEMTYPE_CHECKHIDECHILDREN );
            else
            {
                CPLError(CE_Warning, CPLE_AppDefined,
                         "Invalid value for list style type: %s. Defaulting to Check",
                         osListStyleType.c_str());
                poKmlListStyle->set_listitemtype( kmldom::LISTITEMTYPE_CHECK );
            }
        }

        if( osListStyleIconHref.size() )
        {
            ItemIconPtr poItemIcon = poKmlFactory->CreateItemIcon (  );
            poItemIcon->set_href( osListStyleIconHref.c_str() );
            poKmlListStyle->add_itemicon(poItemIcon);
        }

        poKmlDocument->add_styleselector ( poKmlStyle );
        poKmlLayerContainer->set_styleurl( CPLSPrintf("#%s", pszStyleName) );
    }
}
Beispiel #4
0
void SchemeConfigParser::onStyleGroup(const XMLAttributes& att, const StylePtr& pClass)
{
	PNASSERT(m_pCurrent != NULL);

	LPCTSTR name = att.getValue(_T("name"));
	if(name)
	{
		m_pCurrent->BeginStyleGroup(name, att.getValue(_T("description")), (pClass.get() ? pClass->Style->name.c_str() : NULL) );
	}
}
NodePtr NodeRegistry::createNode(const string& sType, const py::dict& pyDict)
{
    const NodeDefinition& def = getNodeDef(sType);
    py::dict effParams;
    StylePtr pStyle;
    if (pyDict.has_key("style")) {
        py::object param = pyDict["style"];
        pyDict.attr("__delitem__")("style");
        pStyle = py::extract<StylePtr>(param);
        effParams = pStyle->mergeParams(pyDict);
    } else {
        effParams = pyDict;
    }
    ArgList args(def.getDefaultArgs(), effParams);
    NodeBuilder builder = def.getBuilder();
    NodePtr pNode = builder(args);
    pNode->setTypeInfo(&def);
    pNode->setStyle(pStyle);
    return pNode;
}
Beispiel #6
0
void SchemeConfigParser::onStyle(const StylePtr& style, bool isBaseStyle)
{
	PNASSERT(m_pCurrent != NULL);
	
	if(isBaseStyle)
	{
		// Not already stored in the current one...
        StylePtr p(new FullStyleDetails(*style.get()));
		m_pCurrent->Styles.push_back(p);
	}
}
Beispiel #7
0
void styletable2kml (
    OGRStyleTable * poOgrStyleTable,
    KmlFactory * poKmlFactory,
    ContainerPtr poKmlContainer )
{

    /***** just return if the styletable is null *****/

    if ( !poOgrStyleTable )
        return;

    /***** parse the style table *****/

    poOgrStyleTable->ResetStyleStringReading (  );
    const char *pszStyleString;

    while ( ( pszStyleString = poOgrStyleTable->GetNextStyle (  ) ) ) {
        const char *pszStyleName = poOgrStyleTable->GetLastStyleName (  );

        /***** add the style header to the kml *****/

        StylePtr poKmlStyle = poKmlFactory->CreateStyle (  );

        poKmlStyle->set_id ( pszStyleName + 1 );

        /***** parse the style string *****/

        addstylestring2kml ( pszStyleString, poKmlStyle, poKmlFactory, NULL, NULL );

        /***** add the style to the container *****/

        DocumentPtr poKmlDocument = AsDocument ( poKmlContainer );

        //ObjectPtr pokmlObject = boost::static_pointer_cast <kmldom::Object> () ;
        //poKmlContainer->add_feature ( AsFeature( poKmlStyle) );
        poKmlDocument->add_styleselector ( poKmlStyle );

    }

    return;
}
Beispiel #8
0
/**
 * @brief KmlExport::createGroundTrackStyle Creates a custom style for the ground track.
 * @return Returns the custom style.
 */
StylePtr KmlExport::createGroundTrackStyle()
{
    // Add custom balloon style (gets rid of "Directions to here...")
    // https://groups.google.com/forum/?fromgroups#!topic/kml-support-getting-started/2CqF9oiynRY
    BalloonStylePtr balloonStyle = factory->CreateBalloonStyle();
    balloonStyle->set_text("$[id]");

    // Create an icon style
    IconStylePtr iconStyle = factory->CreateIconStyle();
    iconStyle->set_scale(0);

    // Create a label style
    LabelStylePtr labelStyle = factory->CreateLabelStyle();
    labelStyle->set_color(kmlbase::Color32(255, 0, 255, 255));
    labelStyle->set_scale(0);

    // Create a line style
    LineStylePtr lineStyle = factory->CreateLineStyle();
    lineStyle->set_color(kmlbase::Color32(255, 0, 0, 0)); // Black
    lineStyle->set_width(9);

    // Link the style to the icon
    StylePtr style = factory->CreateStyle();
    style->set_balloonstyle(balloonStyle);
    style->set_iconstyle(iconStyle);
    style->set_linestyle(lineStyle);
    style->set_labelstyle(labelStyle);

    style->set_id("ts_2_tb");

    return style;
}
Beispiel #9
0
void SchemeConfigParser::LoadPresets(LPCTSTR path)
{
	// Reset the current settings:
	m_LoadState.m_DefaultColours.Clear();

	for(SchemeDetailsList::iterator i = m_Schemes.begin();
		i != m_Schemes.end();
		++i)
	{
		(*i)->ResetAll();
	}

	for(StylePtrMap::iterator j = m_LoadState.m_Classes.begin();
		j != m_LoadState.m_Classes.end();
		++j)
	{
		(*j).second->Reset();
	}

	// Now load the new...
	UserSettingsParser usp;
	usp.SetPresetLoadMode();
	usp.Parse(path, &m_LoadState);

	StylePtr defcls = GetClass(_T("default"));

	// Minor validation (want our default font to look good):
	if(defcls->CustomStyle != NULL && (defcls->CustomStyle->values & edvFontName))
	{
		if(!validateFont(defcls->CustomStyle->FontName.c_str()))
		{
			defcls->CustomStyle->FontName = _T("");
			defcls->CustomStyle->values ^= edvFontName;
		}
	}

	// Now re-set the default style:
	defcls->Combine(NULL, m_LoadState.m_Default);
}
Beispiel #10
0
void kml2styletable (
    OGRStyleTable * poOgrStyleTable,
    StylePtr poKmlStyle )
{


    /***** no reason to add it if it don't have an id *****/

    if ( poKmlStyle->has_id (  ) ) {

        OGRStyleMgr *poOgrSM = new OGRStyleMgr ( poOgrStyleTable );

        poOgrSM->InitStyleString ( NULL );

        /***** read the style *****/

        kml2stylestring ( poKmlStyle, poOgrSM );

        /***** add the style to the style table *****/

        const std::string oName = poKmlStyle->get_id (  );


        poOgrSM->AddStyle ( CPLString (  ).Printf ( "@%s",
                                                    oName.c_str (  ) ), NULL );

        /***** cleanup the style manager *****/

        delete poOgrSM;
    }

    else {
        CPLError ( CE_Failure, CPLE_AppDefined,
                   "ERROR Parseing kml Style: No id" );
    }

    return;
}
Beispiel #11
0
	RenderContext::Manager::Manager(const css::PropertyList& plist)
		: update_list(),
		  pushed_font_change_(false)
	{
		for(int n = 0; n != max_properties; ++n) {
			const Property p = static_cast<Property>(n);
			auto& stk = get_stack_array()[n];
			const StylePtr style = plist.getProperty(p);
			if(style == nullptr) {
				// get default property
				auto& pinfo = get_default_property_info(p);
				// default properties that aren't inherited pushed, if they aren't the current default.
				if(!pinfo.inherited) {
					update_list.emplace_back(n);
					get_stack_array()[n].emplace(pinfo.obj);
					// XXX get_stack_array()[n]->calculateComputedValues();
					if(is_font_property(p)) {
						pushed_font_change_ = true;
					}
				}
			} else if(!style->isInherited()) {
				// Is the property isn't marked as being inherited, we handle it here.
				if(style != get_stack_array()[n].top()) {
					update_list.emplace_back(n);				
					get_stack_array()[n].emplace(style);
					// XXX get_stack_array()[n]->calculateComputedValues();
					if(is_font_property(p)) {
						pushed_font_change_ = true;
					}
				}
			}
		}
		// If font parameters changed that would cause a new font handle to be allocated we do it here
		if(pushed_font_change_) {
			get_font_handle_stack().emplace(get_font_handle());
		}
	}
Beispiel #12
0
/**
 * @brief KmlExport::createCustomBalloonStyle Creates a custom balloon stye, using an arrow as an icon.
 * @return Returns the custom balloon style.
 */
StyleMapPtr KmlExport::createCustomBalloonStyle()
{
    StyleMapPtr styleMap = factory->CreateStyleMap();

    {

        // Add custom balloon style (gets rid of "Directions to here...")
        // https://groups.google.com/forum/?fromgroups#!topic/kml-support-getting-started/2CqF9oiynRY
        BalloonStylePtr balloonStyle = factory->CreateBalloonStyle();
        balloonStyle->set_text("$[description]");

        // Change the icon
        IconStyleIconPtr iconStyleIcon = factory->CreateIconStyleIcon();
        iconStyleIcon->set_href("http://maps.google.com/mapfiles/kml/shapes/arrow.png");

        // Create a label style
        LabelStylePtr labelStyle = factory->CreateLabelStyle();
        labelStyle->set_color(kmlbase::Color32(255, 0, 255, 255));
        labelStyle->set_scale(0.75);

        // Create an icon style
        IconStylePtr iconStyle = factory->CreateIconStyle();
        iconStyle->set_icon(iconStyleIcon);
        iconStyle->set_scale(0.65);

        // Create a line style
        LineStylePtr lineStyle = factory->CreateLineStyle();
        lineStyle->set_width(3.25);

        // Link the style to the icon
        StylePtr style = factory->CreateStyle();
        style->set_balloonstyle(balloonStyle);
        style->set_iconstyle(iconStyle);
        style->set_linestyle(lineStyle);
        style->set_labelstyle(labelStyle);

        PairPtr pair = factory->CreatePair();
        pair->set_styleselector(style);
        pair->set_key(kmldom::STYLESTATE_NORMAL);

        styleMap->add_pair(pair);
    }

    {
        // Add custom balloon style (gets rid of "Directions to here...")
        // https://groups.google.com/forum/?fromgroups#!topic/kml-support-getting-started/2CqF9oiynRY
        BalloonStylePtr balloonStyle = factory->CreateBalloonStyle();
        balloonStyle->set_text("$[description]");

        // Change the icon
        IconStyleIconPtr iconStyleIcon = factory->CreateIconStyleIcon();
        iconStyleIcon->set_href("http://maps.google.com/mapfiles/kml/shapes/arrow.png");

        // Create an icon style
        IconStylePtr iconStyle = factory->CreateIconStyle();
        iconStyle->set_icon(iconStyleIcon);
        iconStyle->set_scale(0.65);

        // Create a label style
        LabelStylePtr labelStyle = factory->CreateLabelStyle();
        labelStyle->set_color(kmlbase::Color32(255, 0, 255, 255));
        labelStyle->set_scale(0.9);

        // Create a line style
        LineStylePtr lineStyle = factory->CreateLineStyle();
        lineStyle->set_width(6.5);

        // Link the style to the icon
        StylePtr style = factory->CreateStyle();
        style->set_balloonstyle(balloonStyle);
        style->set_iconstyle(iconStyle);
        style->set_linestyle(lineStyle);
        style->set_labelstyle(labelStyle);

        PairPtr pair = factory->CreatePair();
        pair->set_styleselector(style);
        pair->set_key(kmldom::STYLESTATE_HIGHLIGHT);

        styleMap->add_pair(pair);
    }

    styleMap->set_id("directiveArrowStyle");

    return styleMap;
}
Beispiel #13
0
StyleMapPtr KmlExport::createWallAxesStyle()
{
    StyleMapPtr styleMap = factory->CreateStyleMap();

    {
        // Add custom balloon style (gets rid of "Directions to here...")
        // https://groups.google.com/forum/?fromgroups#!topic/kml-support-getting-started/2CqF9oiynRY
        BalloonStylePtr balloonStyle = factory->CreateBalloonStyle();
        balloonStyle->set_text("$[id]");

        // Create an icon style
        IconStylePtr iconStyle = factory->CreateIconStyle();
        iconStyle->set_scale(0);

        // Create a label style
        LabelStylePtr labelStyle = factory->CreateLabelStyle();
        labelStyle->set_color(kmlbase::Color32(255, 0, 255, 255));
        labelStyle->set_scale(0);

        // Create a line style
        LineStylePtr lineStyle = factory->CreateLineStyle();
        lineStyle->set_color(kmlbase::Color32(255, 0, 0, 0)); // Black
        lineStyle->set_width(.9);

        // Link the style to the icon
        StylePtr style = factory->CreateStyle();
        style->set_balloonstyle(balloonStyle);
        style->set_iconstyle(iconStyle);
        style->set_linestyle(lineStyle);
        style->set_labelstyle(labelStyle);

        PairPtr pair = factory->CreatePair();
        pair->set_styleselector(style);
        pair->set_key(kmldom::STYLESTATE_NORMAL);

        styleMap->add_pair(pair);
    }

    {
        // Add custom balloon style (gets rid of "Directions to here...")
        // https://groups.google.com/forum/?fromgroups#!topic/kml-support-getting-started/2CqF9oiynRY
        BalloonStylePtr balloonStyle = factory->CreateBalloonStyle();
        balloonStyle->set_text("$[id]");

        // Create an icon style
        IconStylePtr iconStyle = factory->CreateIconStyle();
        iconStyle->set_scale(0);

        // Create a label style
        LabelStylePtr labelStyle = factory->CreateLabelStyle();
        labelStyle->set_color(kmlbase::Color32(255, 0, 255, 255));
        labelStyle->set_scale(0.75);

        // Create a line style
        LineStylePtr lineStyle = factory->CreateLineStyle();
        lineStyle->set_color(kmlbase::Color32(255, 0, 0, 0)); // Black
        lineStyle->set_width(1.8);

        // Link the style to the icon
        StylePtr style = factory->CreateStyle();
        style->set_balloonstyle(balloonStyle);
        style->set_iconstyle(iconStyle);
        style->set_linestyle(lineStyle);
        style->set_labelstyle(labelStyle);

        PairPtr pair = factory->CreatePair();
        pair->set_styleselector(style);
        pair->set_key(kmldom::STYLESTATE_HIGHLIGHT);

        styleMap->add_pair(pair);
    }

    styleMap->set_id("ts_1_tb");


    return styleMap;
}
Beispiel #14
0
/**
 * @brief KmlExport::CreateLineStringPlacemark Adds a line segment which is colored according to the
 * vehicle's speed.
 * @param startPoint Beginning point along line
 * @param endPoint End point point along line
 * @return Returns the placemark containing the line segment
 */
PlacemarkPtr KmlExport::CreateLineStringPlacemark(const LLAVCoordinates &startPoint, const LLAVCoordinates &endPoint, quint32 newPlacemarkTime)
{
    CoordinatesPtr coordinates = factory->CreateCoordinates();
    coordinates->add_latlngalt(startPoint.latitude, startPoint.longitude, startPoint.altitude);
    coordinates->add_latlngalt(endPoint.latitude,   endPoint.longitude,   endPoint.altitude);

    LineStringPtr linestring = factory->CreateLineString();
    linestring->set_extrude(true); // Extrude to ground
    linestring->set_altitudemode(kmldom::ALTITUDEMODE_ABSOLUTE);
    linestring->set_coordinates(coordinates);

    StyleMapPtr styleMap = factory->CreateStyleMap();


    // Add custom balloon style (gets rid of "Directions to here...")
    // https://groups.google.com/forum/?fromgroups#!topic/kml-support-getting-started/2CqF9oiynRY
    BalloonStylePtr balloonStyle = factory->CreateBalloonStyle();
    balloonStyle->set_text("$[description]");

    {
        double currentVelocity = (startPoint.groundspeed + endPoint.groundspeed)/2;

        // Set the linestyle. The color is a function of speed.
        LineStylePtr lineStyle = factory->CreateLineStyle();
        lineStyle->set_color(mapVelocity2Color(currentVelocity));

        PolyStylePtr polyStyle = factory->CreatePolyStyle();
        polyStyle->set_color(mapVelocity2Color(currentVelocity, 100));

        // Link the style to the icon
        StylePtr style = factory->CreateStyle();
        style->set_balloonstyle(balloonStyle);
        style->set_linestyle(lineStyle);
        style->set_polystyle(polyStyle);

        PairPtr pair = factory->CreatePair();
        pair->set_styleselector(style);
        pair->set_key(kmldom::STYLESTATE_NORMAL);

        styleMap->add_pair(pair);
    }

    {
        double currentVelocity = (startPoint.groundspeed + endPoint.groundspeed)/2;

        // Set the linestyle. The color is a function of speed.
        LineStylePtr lineStyle = factory->CreateLineStyle();
        lineStyle->set_color(mapVelocity2Color(currentVelocity));

        PolyStylePtr polyStyle = factory->CreatePolyStyle();
        polyStyle->set_color(mapVelocity2Color(currentVelocity, 100));
        polyStyle->set_fill(false);

        // Link the style to the icon
        StylePtr style = factory->CreateStyle();
        style->set_balloonstyle(balloonStyle);
        style->set_linestyle(lineStyle);
        style->set_polystyle(polyStyle);

        PairPtr pair = factory->CreatePair();
        pair->set_styleselector(style);
        pair->set_key(kmldom::STYLESTATE_HIGHLIGHT);

        styleMap->add_pair(pair);
    }

    PlacemarkPtr placemark = factory->CreatePlacemark();
    placemark->set_geometry(linestring);
    placemark->set_styleselector(styleMap);
    placemark->set_visibility(true);

    // Create the timespan
    TimeSpanPtr timeSpan = factory->CreateTimeSpan();
    QDateTime startTime = QDateTime::currentDateTimeUtc().addMSecs(newPlacemarkTime); // FIXME: Make this a function of the true time, preferably gotten from the GPS
    QDateTime endTime = QDateTime::currentDateTimeUtc().addMSecs(newPlacemarkTime);
    timeSpan->set_begin(startTime.toString(dateTimeFormat).toStdString());
    timeSpan->set_end(endTime.toString(dateTimeFormat).toStdString());

    // Set the name
    QDateTime trackTime = QDateTime::currentDateTimeUtc().addMSecs(newPlacemarkTime); // FIXME: Make it a function of the realtime preferably gotten from the GPS
    placemark->set_name(trackTime.toString(dateTimeFormat).toStdString());

    // Add a nice description to the track placemark
    placemark->set_description(informationString.toStdString());

    // Set the timespan
    placemark->set_timeprimitive(timeSpan);

    return placemark;
}
Beispiel #15
0
void addstylestring2kml (
    const char *pszStyleString,
    StylePtr poKmlStyle,
    KmlFactory * poKmlFactory,
    PlacemarkPtr poKmlPlacemark,
    OGRFeature * poOgrFeat )
{

    LineStylePtr poKmlLineStyle = NULL;
    PolyStylePtr poKmlPolyStyle = NULL;
    IconStylePtr poKmlIconStyle = NULL;
    LabelStylePtr poKmlLabelStyle = NULL;
    
    /***** just bail now if stylestring is empty *****/

    if ( !pszStyleString || !*pszStyleString ) {
        return;
    }

    /***** create and init a style mamager with the style string *****/

    OGRStyleMgr *poOgrSM = new OGRStyleMgr;

    poOgrSM->InitStyleString ( pszStyleString );

    /***** loop though the style parts *****/

    int i;

    for ( i = 0; i < poOgrSM->GetPartCount ( NULL ); i++ ) {
        OGRStyleTool *poOgrST = poOgrSM->GetPart ( i, NULL );

        if ( !poOgrST ) {
            continue;
        }
        
        switch ( poOgrST->GetType (  ) ) {
        case OGRSTCPen:
            {
                GBool nullcheck;

                poKmlLineStyle = poKmlFactory->CreateLineStyle (  );

                OGRStylePen *poStylePen = ( OGRStylePen * ) poOgrST;

                /***** pen color *****/

                int nR,
                    nG,
                    nB,
                    nA;

                const char *pszcolor = poStylePen->Color ( nullcheck );

                if ( !nullcheck
                     && poStylePen->GetRGBFromString ( pszcolor, nR, nG, nB, nA ) ) {
                    poKmlLineStyle->set_color ( Color32 ( nA, nB, nG, nR ) );
                }
                double dfWidth = poStylePen->Width ( nullcheck );

                if ( nullcheck )
                    dfWidth = 1.0;

                poKmlLineStyle->set_width ( dfWidth );
                
                break;
            }
        case OGRSTCBrush:
            {
                GBool nullcheck;

                poKmlPolyStyle = poKmlFactory->CreatePolyStyle (  );

                OGRStyleBrush *poStyleBrush = ( OGRStyleBrush * ) poOgrST;

                /***** brush color *****/

                int nR,
                    nG,
                    nB,
                    nA;

                const char *pszcolor = poStyleBrush->ForeColor ( nullcheck );

                if ( !nullcheck
                     && poStyleBrush->GetRGBFromString ( pszcolor, nR, nG, nB, nA ) ) {
                    poKmlPolyStyle->set_color ( Color32 ( nA, nB, nG, nR ) );
                }
                

                break;
            }
        case OGRSTCSymbol:
            {
                GBool nullcheck;
                GBool nullcheck2;

                OGRStyleSymbol *poStyleSymbol = ( OGRStyleSymbol * ) poOgrST;

                /***** id (kml icon) *****/

                const char *pszId = poStyleSymbol->Id ( nullcheck );

                if ( !nullcheck ) {
                    if ( !poKmlIconStyle)
                        poKmlIconStyle = poKmlFactory->CreateIconStyle (  );

                    /***** split it at the ,'s *****/

                    char **papszTokens =
                        CSLTokenizeString2 ( pszId, ",",
                                             CSLT_HONOURSTRINGS | CSLT_STRIPLEADSPACES |
                                             CSLT_STRIPENDSPACES );

                    if ( papszTokens ) {

                        /***** for lack of a better solution just take the first one *****/
                        //todo come up with a better idea

                        if ( papszTokens[0] ) {
                            IconStyleIconPtr poKmlIcon =
                                poKmlFactory->CreateIconStyleIcon (  );
                            poKmlIcon->set_href ( papszTokens[0] );
                            poKmlIconStyle->set_icon ( poKmlIcon );
                        }

                        CSLDestroy ( papszTokens );

                    }


                }

                /***** heading *****/

                double heading = poStyleSymbol->Angle ( nullcheck );

                if ( !nullcheck ) {
                    if ( !poKmlIconStyle)
                        poKmlIconStyle = poKmlFactory->CreateIconStyle (  );
                    poKmlIconStyle->set_heading ( heading );
                }

                /***** scale *****/

                double dfScale = poStyleSymbol->Size ( nullcheck );

                if ( !nullcheck ) {
                    if ( !poKmlIconStyle)
                        poKmlIconStyle = poKmlFactory->CreateIconStyle (  );

                    poKmlIconStyle->set_scale ( dfScale );
                }

                /***** color *****/

                int nR,
                    nG,
                    nB,
                    nA;

                const char *pszcolor = poStyleSymbol->Color ( nullcheck );

                if ( !nullcheck && poOgrST->GetRGBFromString ( pszcolor, nR, nG, nB, nA ) ) {
                    poKmlIconStyle->set_color ( Color32 ( nA, nB, nG, nR ) );
                }

                /***** hotspot *****/

                double dfDx = poStyleSymbol->SpacingX ( nullcheck );
                double dfDy = poStyleSymbol->SpacingY ( nullcheck2 );

                if ( !nullcheck && !nullcheck2 ) {
                    if ( !poKmlIconStyle)
                        poKmlIconStyle = poKmlFactory->CreateIconStyle (  );

                    HotSpotPtr poKmlHotSpot = poKmlFactory->CreateHotSpot (  );

                    poKmlHotSpot->set_x ( dfDx );
                    poKmlHotSpot->set_y ( dfDy );

                    poKmlIconStyle->set_hotspot ( poKmlHotSpot );
                }
                
                break;
            }
        case OGRSTCLabel:
            {
                GBool nullcheck;
                GBool nullcheck2;
                
                poKmlLabelStyle = poKmlFactory->CreateLabelStyle (  );

                OGRStyleLabel *poStyleLabel = ( OGRStyleLabel * ) poOgrST;

                /***** color *****/

                int nR,
                    nG,
                    nB,
                    nA;

                const char *pszcolor = poStyleLabel->ForeColor ( nullcheck );

                if ( !nullcheck
                     && poStyleLabel->GetRGBFromString ( pszcolor, nR, nG, nB, nA ) ) {
                    poKmlLabelStyle->set_color ( Color32 ( nA, nB, nG, nR ) );
                }

                /***** scale *****/

                double dfScale = poStyleLabel->Stretch ( nullcheck );

                if ( !nullcheck ) {
                    dfScale /= 100.0;
                    poKmlLabelStyle->set_scale ( dfScale );
                }
                
                /***** heading *****/

                double heading = poStyleLabel->Angle ( nullcheck );

                if ( !nullcheck ) {
                    if ( !poKmlIconStyle) {
                        poKmlIconStyle = poKmlFactory->CreateIconStyle (  );
                        IconStyleIconPtr poKmlIcon = poKmlFactory->CreateIconStyleIcon (  );
                        poKmlIconStyle->set_icon ( poKmlIcon );
                    }
                    
                    poKmlIconStyle->set_heading ( heading );
                }

                /***** hotspot *****/

                double dfDx = poStyleLabel->SpacingX ( nullcheck );
                double dfDy = poStyleLabel->SpacingY ( nullcheck2 );

                if ( !nullcheck && !nullcheck2 ) {
                    if ( !poKmlIconStyle) {
                        poKmlIconStyle = poKmlFactory->CreateIconStyle (  );
                        IconStyleIconPtr poKmlIcon = poKmlFactory->CreateIconStyleIcon (  );
                        poKmlIconStyle->set_icon ( poKmlIcon );
                    }
                    
                    HotSpotPtr poKmlHotSpot = poKmlFactory->CreateHotSpot (  );

                    poKmlHotSpot->set_x ( dfDx );
                    poKmlHotSpot->set_y ( dfDy );

                    poKmlIconStyle->set_hotspot ( poKmlHotSpot );
                }

                /***** label text *****/

                const char *pszText = poStyleLabel->TextString ( nullcheck );

                if ( !nullcheck ) {
                    if ( poKmlPlacemark ) {

                        poKmlPlacemark->set_name( pszText );
                    }
                }
                    
                break;
            }
        case OGRSTCNone:
        default:
            break;
        }

        delete poOgrST;
    }

    if ( poKmlLineStyle )
        poKmlStyle->set_linestyle ( poKmlLineStyle );

    if ( poKmlPolyStyle )
        poKmlStyle->set_polystyle ( poKmlPolyStyle );

    if ( poKmlIconStyle )
        poKmlStyle->set_iconstyle ( poKmlIconStyle );

    if ( poKmlLabelStyle )
        poKmlStyle->set_labelstyle ( poKmlLabelStyle );
    
    delete poOgrSM;
}
Beispiel #16
0
void kml2stylestring (
    StylePtr poKmlStyle,
    OGRStyleMgr * poOgrSM )

{

    OGRStyleMgr * poOgrNewSM ;
    OGRStyleTool *poOgrST = NULL;
    OGRStyleTool *poOgrTmpST = NULL;
    int i;

    poOgrNewSM = new OGRStyleMgr( NULL );
    
    /***** linestyle / pen *****/

    if ( poKmlStyle->has_linestyle (  ) ) {

        poOgrNewSM->InitStyleString ( NULL );
        
        LineStylePtr poKmlLineStyle = poKmlStyle->get_linestyle (  );

        poOgrTmpST = NULL;
        for ( i = 0; i < poOgrSM->GetPartCount ( NULL ); i++ ) {
            poOgrST = poOgrSM->GetPart ( i, NULL );

            if ( !poOgrST )
                continue;
        
            if ( poOgrST->GetType ( ) == OGRSTCPen ) {
                poOgrTmpST = poOgrST;
            }
            else {
                poOgrNewSM->AddPart ( poOgrST );
                delete poOgrST;
            }
        }
        
        OGRStylePen *poOgrStylePen = kml2pen ( poKmlLineStyle,
                                               ( OGRStylePen *) poOgrTmpST);
        
        poOgrNewSM->AddPart ( poOgrStylePen );

        delete poOgrStylePen;
        poOgrSM->InitStyleString ( poOgrNewSM->GetStyleString(NULL) );
        
    }

    /***** polystyle / brush *****/

    if ( poKmlStyle->has_polystyle (  ) ) {

        poOgrNewSM->InitStyleString ( NULL );

        PolyStylePtr poKmlPolyStyle = poKmlStyle->get_polystyle (  );

        poOgrTmpST = NULL;
        for ( i = 0; i < poOgrSM->GetPartCount ( NULL ); i++ ) {
            poOgrST = poOgrSM->GetPart ( i, NULL );

            if ( !poOgrST )
                continue;
        
            if ( poOgrST->GetType ( ) == OGRSTCBrush ) {
                poOgrTmpST = poOgrST;
            }
            else {
                poOgrNewSM->AddPart ( poOgrST );
                delete poOgrST;
            }
        }

        OGRStyleBrush *poOgrStyleBrush = kml2brush ( poKmlPolyStyle,
                                                     ( OGRStyleBrush *) poOgrTmpST );

        poOgrNewSM->AddPart ( poOgrStyleBrush );

        delete poOgrStyleBrush;
        poOgrSM->InitStyleString ( poOgrNewSM->GetStyleString(NULL) );

    }

    /***** iconstyle / symbol *****/

    if ( poKmlStyle->has_iconstyle (  ) ) {
        
        poOgrNewSM->InitStyleString ( NULL );

        IconStylePtr poKmlIconStyle = poKmlStyle->get_iconstyle (  );

        poOgrTmpST = NULL;
        for ( i = 0; i < poOgrSM->GetPartCount ( NULL ); i++ ) {
            poOgrST = poOgrSM->GetPart ( i, NULL );

            if ( !poOgrST )
                continue;
        
            if ( poOgrST->GetType ( ) == OGRSTCSymbol ) {
                poOgrTmpST = poOgrST;
            }
            else {
                poOgrNewSM->AddPart ( poOgrST );
                delete poOgrST;
            }
        }

        OGRStyleSymbol *poOgrStyleSymbol = kml2symbol ( poKmlIconStyle,
                                                     ( OGRStyleSymbol *) poOgrTmpST );

        poOgrNewSM->AddPart ( poOgrStyleSymbol );

        delete poOgrStyleSymbol;
        poOgrSM->InitStyleString ( poOgrNewSM->GetStyleString(NULL) );

    }

    /***** labelstyle / label *****/

    if ( poKmlStyle->has_labelstyle (  ) ) {
        
        poOgrNewSM->InitStyleString ( NULL );

        LabelStylePtr poKmlLabelStyle = poKmlStyle->get_labelstyle (  );

        poOgrTmpST = NULL;
        for ( i = 0; i < poOgrSM->GetPartCount ( NULL ); i++ ) {
            poOgrST = poOgrSM->GetPart ( i, NULL );

            if ( !poOgrST )
                continue;
        
            if ( poOgrST->GetType ( ) == OGRSTCLabel ) {
                poOgrTmpST = poOgrST;
            }
            else {
                poOgrNewSM->AddPart ( poOgrST );
                delete poOgrST;
            }
        }

        OGRStyleLabel *poOgrStyleLabel = kml2label ( poKmlLabelStyle,
                                                     ( OGRStyleLabel *) poOgrTmpST );

        poOgrNewSM->AddPart ( poOgrStyleLabel );

        delete poOgrStyleLabel;
        poOgrSM->InitStyleString ( poOgrNewSM->GetStyleString(NULL) );

    }

    delete poOgrNewSM;

}
Beispiel #17
0
void styletable2kml (
    OGRStyleTable * poOgrStyleTable,
    KmlFactory * poKmlFactory,
    ContainerPtr poKmlContainer,
    char** papszOptions )
{

    /***** just return if the styletable is null *****/

    if ( !poOgrStyleTable )
        return;

    std::set<CPLString> aoSetNormalStyles;
    std::set<CPLString> aoSetHighlightStyles;
    poOgrStyleTable->ResetStyleStringReading (  );
    const char *pszStyleString;

    /* Collect styles that end with _normal or _highlight */
    while ( poOgrStyleTable->GetNextStyle (  ) != NULL ) {
        const char *pszStyleName = poOgrStyleTable->GetLastStyleName (  );

        if( strlen(pszStyleName) > strlen("_normal") &&
            EQUAL(pszStyleName + strlen(pszStyleName) - strlen("_normal"), "_normal") )
        {
            CPLString osName(pszStyleName);
            osName.resize(strlen(pszStyleName) - strlen("_normal"));
            aoSetNormalStyles.insert(osName);
        }
        else if( strlen(pszStyleName) > strlen("_highlight") &&
                  EQUAL(pszStyleName + strlen(pszStyleName) - strlen("_highlight"), "_highlight") )
        {
            CPLString osName(pszStyleName);
            osName.resize(strlen(pszStyleName) - strlen("_highlight"));
            aoSetHighlightStyles.insert(osName);
        }
    }

    /***** parse the style table *****/

    poOgrStyleTable->ResetStyleStringReading (  );

    while ( ( pszStyleString = poOgrStyleTable->GetNextStyle (  ) ) != NULL ) {
        const char *pszStyleName = poOgrStyleTable->GetLastStyleName (  );

        if( aoSetNormalStyles.find(pszStyleName) != aoSetNormalStyles.end() &&
            aoSetHighlightStyles.find(pszStyleName) != aoSetHighlightStyles.end() )
        {
            continue;
        }

        /***** add the style header to the kml *****/

        StylePtr poKmlStyle = poKmlFactory->CreateStyle (  );

        poKmlStyle->set_id ( pszStyleName );

        /***** parse the style string *****/

        addstylestring2kml ( pszStyleString, poKmlStyle, poKmlFactory, NULL );

        /***** add balloon style *****/
        const char* pszBalloonStyleBgColor = CSLFetchNameValue(papszOptions, CPLSPrintf("%s_balloonstyle_bgcolor", pszStyleName));
        const char* pszBalloonStyleText = CSLFetchNameValue(papszOptions, CPLSPrintf("%s_balloonstyle_text", pszStyleName));
        int nR, nG, nB, nA;
        OGRStylePen oStyleTool;
        if( (pszBalloonStyleBgColor != NULL &&
             oStyleTool.GetRGBFromString ( pszBalloonStyleBgColor, nR, nG, nB, nA )  ) ||
            pszBalloonStyleText != NULL )
        {
            BalloonStylePtr poKmlBalloonStyle = poKmlFactory->CreateBalloonStyle();
            if( pszBalloonStyleBgColor != NULL &&
                oStyleTool.GetRGBFromString ( pszBalloonStyleBgColor, nR, nG, nB, nA ) )
                poKmlBalloonStyle->set_bgcolor ( Color32 ( static_cast<GByte>(nA),
                                                           static_cast<GByte>(nB),
                                                           static_cast<GByte>(nG),
                                                           static_cast<GByte>(nR) ) );
            if( pszBalloonStyleText != NULL )
                poKmlBalloonStyle->set_text(pszBalloonStyleText);
            poKmlStyle->set_balloonstyle ( poKmlBalloonStyle );
        }

        /***** add the style to the container *****/

        DocumentPtr poKmlDocument = AsDocument ( poKmlContainer );
        poKmlDocument->add_styleselector ( poKmlStyle );

    }

    /* Find style name that end with _normal and _highlight to create */
    /* a StyleMap from both */
    std::set<CPLString>::iterator aoSetNormalStylesIter =
        aoSetNormalStyles.begin();
    for( ; aoSetNormalStylesIter != aoSetNormalStyles.end(); ++aoSetNormalStylesIter )
    {
        CPLString osStyleName(*aoSetNormalStylesIter);
        if( aoSetHighlightStyles.find(osStyleName) !=
                aoSetHighlightStyles.end() )
        {
            StyleMapPtr poKmlStyleMap = poKmlFactory->CreateStyleMap (  );
            poKmlStyleMap->set_id ( osStyleName );

            PairPtr poKmlPairNormal = poKmlFactory->CreatePair (  );
            poKmlPairNormal->set_key(STYLESTATE_NORMAL);
            poKmlPairNormal->set_styleurl(CPLSPrintf("#%s_normal", osStyleName.c_str()));
            poKmlStyleMap->add_pair(poKmlPairNormal);

            PairPtr poKmlPairHightlight = poKmlFactory->CreatePair (  );
            poKmlPairHightlight->set_key(STYLESTATE_HIGHLIGHT);
            poKmlPairHightlight->set_styleurl(CPLSPrintf("#%s_highlight", osStyleName.c_str()));
            poKmlStyleMap->add_pair(poKmlPairHightlight);

            /***** add the style to the container *****/
            DocumentPtr poKmlDocument = AsDocument ( poKmlContainer );
            poKmlDocument->add_styleselector ( poKmlStyleMap );
        }
    }

    return;
}
Beispiel #18
0
	void StyleNode::setPropertyFromString(css::Property p, const std::string& value)
	{
		StylePtr sp = nullptr;
		try {
			css::PropertyParser pp;
			css::Tokenizer toks(value);
			pp.parse(get_property_name(p), toks.getTokens().begin(), toks.getTokens().end());
			auto plist = pp.getPropertyList();
			if(!plist.empty()) {
				sp = plist.begin()->second.style;
			}
		} catch(css::ParserError& e) {
			LOG_ERROR("Unable to parse value '" << value << "' to set to property: " << get_property_name(p) << "; " << e.what());
		}
		if(sp == nullptr) {
			LOG_ERROR("Unable to parse value '" << value << "' to set to property: " << get_property_name(p));
			return;
		}

		bool force_layout = false;
		bool force_render = false;

		switch(p) {
			case Property::BACKGROUND_COLOR:
				background_color_ = std::make_shared<KRE::Color>(*sp->asType<CssColor>()->compute());
				force_render = true;
				break;
			case Property::COLOR:
				color_ = std::make_shared<KRE::Color>(*sp->asType<CssColor>()->compute());
				force_render = true;
				break;
			case Property::BORDER_TOP_COLOR:
				*border_color_[0] = *sp->asType<CssColor>()->compute();
				break;
			case Property::BORDER_LEFT_COLOR:
				*border_color_[1] = *sp->asType<CssColor>()->compute();
				break;
			case Property::BORDER_BOTTOM_COLOR:
				*border_color_[2] = *sp->asType<CssColor>()->compute();
				break;
			case Property::BORDER_RIGHT_COLOR:
				*border_color_[3] = *sp->asType<CssColor>()->compute();
				break;
			case Property::OUTLINE_COLOR:
				*outline_color_ = *sp->asType<CssColor>()->compute();
				break;
			case Property::BACKGROUND_IMAGE:
				*background_image_ = *sp->asType<ImageSource>();
				break;
			case Property::BACKGROUND_ATTACHMENT:
				background_attachment_ = sp->getEnum<BackgroundAttachment>();
				break;
			case Property::BACKGROUND_POSITION: {
				auto bp = sp->asType<BackgroundPosition>();
				background_position_[0] = bp->getTop();
				background_position_[1] = bp->getLeft();
				break;
			}
			case Property::BACKGROUND_REPEAT:
				*background_repeat_style_ = *sp;
				background_repeat_ = background_repeat_style_->getEnum<BackgroundRepeat>();
				force_render = true;
				break;
			case Property::BORDER_TOP_STYLE:
				border_style_[0] = sp->getEnum<BorderStyle>();
				break;
			case Property::BORDER_LEFT_STYLE:
				border_style_[1] = sp->getEnum<BorderStyle>();
				break;
			case Property::BORDER_BOTTOM_STYLE:
				border_style_[2] = sp->getEnum<BorderStyle>();
				break;
			case Property::BORDER_RIGHT_STYLE:
				border_style_[3] = sp->getEnum<BorderStyle>();
				break;
			case Property::OUTLINE_STYLE:
				outline_style_ = sp->getEnum<BorderStyle>();
				break;
			case Property::BORDER_TOP_WIDTH:
				*border_width_[0] = *sp->asType<Length>();
				break;
			case Property::BORDER_LEFT_WIDTH:
				*border_width_[1] = *sp->asType<Length>();
				break;
			case Property::BORDER_BOTTOM_WIDTH:
				*border_width_[2] = *sp->asType<Length>();
				break;
			case Property::BORDER_RIGHT_WIDTH:
				*border_width_[3] = *sp->asType<Length>();
				break;
			case Property::TOP:
				tlbr_[0] = sp->asType<Width>();
				break;
			case Property::LEFT:
				tlbr_[1] = sp->asType<Width>();
				break;
			case Property::BOTTOM:
				tlbr_[2] = sp->asType<Width>();
				break;
			case Property::RIGHT:
				tlbr_[3] = sp->asType<Width>();
				break;
			case Property::CLEAR:
				clear_ = sp->getEnum<Clear>();
				break;
			case Property::CLIP:
				*clip_ = *sp->asType<Clip>();
				break;
			case Property::CONTENT:
				*content_ = *sp->asType<Content>();
				break;
			case Property::WIDTH:
				*width_height_[0] = *sp->asType<Width>();
				force_render = true;
				break;
			case Property::HEIGHT:
				*width_height_[1] = *sp->asType<Width>();
				force_render = true;
				break;
			case Property::DISPLAY:
				display_ = sp->getEnum<Display>();
				break;
			case Property::POSITION:
				position_ = sp->getEnum<Position>();
				break;
			case Property::DIRECTION:
				direction_ = sp->getEnum<Direction>();
				break;
			case Property::FLOAT:
				float_ = sp->getEnum<Float>();
				break;
			case Property::CSS_OVERFLOW:
				overflow_ = sp->getEnum<Overflow>();
				break;
			case Property::LINE_HEIGHT:
				*line_height_ = *sp->asType<Length>();
				break;
			case Property::BACKGROUND_CLIP:
				background_clip_ = sp->getEnum<BackgroundClip>();
				break;
			case Property::FILTER:
				*filters_ = *sp->asType<FilterStyle>();
				break;
			case Property::COUNTER_INCREMENT:
			case Property::COUNTER_RESET:
			case Property::CURSOR:
			case Property::FONT_FAMILY:
			case Property::FONT_SIZE:
			case Property::FONT_STYLE:
			case Property::FONT_VARIANT:
			case Property::FONT_WEIGHT:
			case Property::LETTER_SPACING:
			case Property::LIST_STYLE_IMAGE:
			case Property::LIST_STYLE_POSITION:
			case Property::LIST_STYLE_TYPE:
			case Property::MARGIN_TOP:
			case Property::MARGIN_LEFT:
			case Property::MARGIN_BOTTOM:
			case Property::MARGIN_RIGHT:
			case Property::MAX_HEIGHT:
			case Property::MAX_WIDTH:
			case Property::MIN_HEIGHT:
			case Property::MIN_WIDTH:
			case Property::OUTLINE_WIDTH:
			case Property::PADDING_TOP:
			case Property::PADDING_LEFT:
			case Property::PADDING_RIGHT:
			case Property::PADDING_BOTTOM:
			case Property::QUOTES:
			case Property::TABLE_LAYOUT:
			case Property::TEXT_ALIGN:
			case Property::TEXT_DECORATION:
			case Property::TEXT_INDENT:
			case Property::TEXT_TRANSFORM:
			case Property::UNICODE_BIDI:
			case Property::VERTICAL_ALIGN:
			case Property::VISIBILITY:
			case Property::WHITE_SPACE:
			case Property::WORD_SPACING:
			case Property::Z_INDEX:
			case Property::BOX_SHADOW:
			case Property::TEXT_SHADOW:
			case Property::TRANSITION_PROPERTY:
			case Property::TRANSITION_DURATION:
			case Property::TRANSITION_TIMING_FUNCTION:
			case Property::TRANSITION_DELAY:
			case Property::BORDER_TOP_LEFT_RADIUS:
			case Property::BORDER_TOP_RIGHT_RADIUS:
			case Property::BORDER_BOTTOM_LEFT_RADIUS:
			case Property::BORDER_BOTTOM_RIGHT_RADIUS:
			case Property::BORDER_SPACING:
			case Property::OPACITY:
			case Property::BORDER_IMAGE_SOURCE:
			case Property::BORDER_IMAGE_SLICE:
			case Property::BORDER_IMAGE_WIDTH:
			case Property::BORDER_IMAGE_OUTSET:
			case Property::BORDER_IMAGE_REPEAT:
				LOG_ERROR("implement me");
				break;
			case Property::EMPTY_CELLS:
			case Property::WIDOWS:
			case Property::ORPHANS:
			case Property::CAPTION_SIDE:
			case Property::BORDER_COLLAPSE:
				break;
			default: 
				ASSERT_LOG(false, "Unrecognised property value: " << static_cast<int>(p));
				break;
		}

		NodePtr node = node_.lock();
		ASSERT_LOG(node != nullptr, "No node associated with this style node.");
		DocumentPtr doc = node->getOwnerDoc();
		ASSERT_LOG(doc != nullptr, "No owner document found.");
		if(doc!= nullptr && (sp->requiresLayout(p) || force_layout)) {
			//LOG_ERROR("Layout triggered from style.");
			doc->triggerLayout();
		} else if(doc!= nullptr && (sp->requiresRender(p) || force_render)) {
			//LOG_ERROR("Render triggered from style.");
			doc->triggerRender();
		}
	}