コード例 #1
0
        void SITSituationVisitor::visit(ASTNode *node) throw (SITSituationVisitorException) {
            if (node != NULL) {
                if (node->getParent() == NULL) {
                    m_situation.setHeader(visitSituationHeader(node->getFirstChild()));

                    vector<ASTNode*> list = node->getChildren();
                    vector<ASTNode*>::iterator it = list.begin();
                    while (it != list.end()) {
                        ASTNode *n = (*it++);
                        if ((n->getFirstChild() != NULL) && (n->getFirstChild()->getKey() == "OBJECT") ) {
                            m_situation.addObject(visitObject(n));
                        }
                    }
                }
            }
        }
コード例 #2
0
        OnEnteringPolygon* SITSituationVisitor::visitOnEnteringPolygon(ASTNode *node) {
            OnEnteringPolygon *oep = NULL;

            if (node != NULL) {
                oep = new OnEnteringPolygon();

                ASTNode *n = findByKey("OBJECTID", node->getParent(), 3);
                if (n == NULL) {
                    OPENDAVINCI_CORE_THROW_EXCEPTION(SITSituationVisitorException, "Node to get name from OBJECTID expected.");
                }
                oep->setID(n->getValue<uint32_t>());

                n = findByKey("VERTEX2", node->getParent(), 4);
                if (n == NULL) {
                    OPENDAVINCI_CORE_THROW_EXCEPTION(SITSituationVisitorException, "Node to get name from VERTEX222 expected.");
                }
                n = n->getParent()->getParent();
                vector<ASTNode*> listOfEnteringPolygon = n->getChildren();
                vector<ASTNode*>::iterator it = listOfEnteringPolygon.begin();
                while (it != listOfEnteringPolygon.end()) {
                    n = (*it++);
                    if (n->getFirstChild()->getKey() == "VERTEX2") {
                        oep->add(visitVertex3(n));
                    }
                }
            }

            return oep;
        }