Exemplo n.º 1
0
void setNodeText(MSXML2::IXMLDOMNodePtr& node, const String& text) {
  _bstr_t nodeText(text.c_str());
  const HRESULT putTextRes = node->put_text(nodeText);
  if (FAILED(putTextRes)) {
    _com_raise_error(putTextRes);
  }
}
Exemplo n.º 2
0
void ChartSymbols::ProcessLookups( TiXmlElement* lookupNodes )
{
    Lookup lookup;
    wxString propVal;
    long numVal;

    for( TiXmlNode *childNode = lookupNodes->FirstChild(); childNode;
            childNode = childNode->NextSibling() ) {
        TiXmlElement *child = childNode->ToElement();

        TGET_INT_PROPERTY_VALUE( child, "id", lookup.id )
        TGET_INT_PROPERTY_VALUE( child, "RCID", lookup.RCID )
        lookup.name = wxString( child->Attribute( "name" ), wxConvUTF8 );
        lookup.attributeCodeArray = NULL;

        TiXmlElement* subNode = child->FirstChild()->ToElement();

        while( subNode ) {
            wxString nodeType( subNode->Value(), wxConvUTF8 );
            wxString nodeText( subNode->GetText(), wxConvUTF8 );

            if( nodeType == _T("type") ) {

                if( nodeText == _T("Area") ) lookup.type = AREAS_T;
                else
                    if( nodeText == _T("Line") ) lookup.type = LINES_T;
                    else
                        lookup.type = POINT_T;

                goto nextNode;
            }

            if( nodeType == _T("disp-prio") ) {
                lookup.displayPrio = PRIO_NODATA;
                if( nodeText == _T("Group 1") ) lookup.displayPrio = PRIO_GROUP1;
                else
                if( nodeText == _T("Area 1") ) lookup.displayPrio = PRIO_AREA_1;
                else
                if( nodeText == _T("Area 2") ) lookup.displayPrio = PRIO_AREA_2;
                else
                if( nodeText == _T("Point Symbol") ) lookup.displayPrio = PRIO_SYMB_POINT;
                else
                if( nodeText == _T("Line Symbol") ) lookup.displayPrio = PRIO_SYMB_LINE;
                else
                if( nodeText == _T("Area Symbol") ) lookup.displayPrio = PRIO_SYMB_AREA;
                else
                if( nodeText == _T("Routing") ) lookup.displayPrio = PRIO_ROUTEING;
                else
                if( nodeText == _T("Hazards") ) lookup.displayPrio = PRIO_HAZARDS;
                else
                if( nodeText == _T("Mariners") ) lookup.displayPrio = PRIO_MARINERS;
                goto nextNode;
            }
            if( nodeType == _T("radar-prio") ) {
                if( nodeText == _T("On Top") ) lookup.radarPrio = RAD_OVER;
                else
                    lookup.radarPrio = RAD_SUPP;
                goto nextNode;
            }
            if( nodeType == _T("table-name") ) {
                if( nodeText == _T("Simplified") ) lookup.tableName = SIMPLIFIED;
                else
                if( nodeText == _T("Lines") ) lookup.tableName = LINES;
                else
                if( nodeText == _T("Plain") ) lookup.tableName = PLAIN_BOUNDARIES;
                else
                if( nodeText == _T("Symbolized") ) lookup.tableName = SYMBOLIZED_BOUNDARIES;
                else
                lookup.tableName = PAPER_CHART;
                goto nextNode;
            }
            if( nodeType == _T("display-cat") ) {
                if( nodeText == _T("Displaybase") ) lookup.displayCat = DISPLAYBASE;
                else
                if( nodeText == _T("Standard") ) lookup.displayCat = STANDARD;
                else
                if( nodeText == _T("Other") ) lookup.displayCat = OTHER;
                else
                if( nodeText == _T("Mariners") ) lookup.displayCat = MARINERS_STANDARD;
                else
                lookup.displayCat = OTHER;
                goto nextNode;
            }
            if( nodeType == _T("comment") ) {
                wxString comment( subNode->GetText(), wxConvUTF8 );
                long value;
                comment.ToLong( &value, 0 );
                lookup.comment = value;
                goto nextNode;
            }

            if( nodeType == _T("instruction") ) {
                lookup.instruction = nodeText;
                lookup.instruction.Append( '\037' );
                goto nextNode;
            }
            if( nodeType == _T("attrib-code") ) {
                if( !lookup.attributeCodeArray )
                    lookup.attributeCodeArray = new wxArrayString();
                wxString value = wxString( subNode->GetText(), wxConvUTF8 );
                if( value.length() == 6 )
                    value << _T(" ");
                lookup.attributeCodeArray->Add( value );
                goto nextNode;
            }

            nextNode: subNode = subNode->NextSiblingElement();
        }

        BuildLookup( lookup );
    }
}