• 大小: 221KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-06-13
  • 语言: 其他
  • 标签: citygml  

资源简介

三维数字城市citygml库源代码,标准。数字城市,GIS,数字城市

资源截图

代码片段和文件信息

#include 
#include 
#include 
#include 
#include 

#include 
#include 
#include 
#include 
#include 
#include 

#include 
#include 

#include 

class PickingHandler : public osgGA::GUIEventHandler {
public:

    PickingHandler() {
        m_xMouseCoordAtLastPress = -1;
        m_yMouseCoordAtLastPress = -1;
    }

    // EventHandler interface
    virtual bool handle(const osgGA::GUIEventAdapter& ea osgGA::GUIActionAdapter& aa osg::object* osg::NodeVisitor*) {
        if (ea.getEventType() == osgGA::GUIEventAdapter::RELEASE && ea.getButton() == osgGA::GUIEventAdapter::LEFT_MOUSE_BUTTON) {

            if (m_xMouseCoordAtLastPress != ea.getX() || m_yMouseCoordAtLastPress != ea.getY()) {
                return false;
            }

            return printDescriptionOfIntersectedDrawable(ea aa);


        } else if (ea.getEventType() == osgGA::GUIEventAdapter::PUSH && ea.getButton() == osgGA::GUIEventAdapter::LEFT_MOUSE_BUTTON) {
            m_xMouseCoordAtLastPress = ea.getX();
            m_yMouseCoordAtLastPress = ea.getY();
        }

        return false;
    }

private:

    bool printDescriptionOfIntersectedDrawable(const osgGA::GUIEventAdapter& ea osgGA::GUIActionAdapter& aa) {

        osgUtil::LineSegmentIntersector::Intersections intersections;
#if OSG_VERSION_GREATER_OR_EQUAL(332)

            if (!aa.computeIntersections(ea intersections)) {
                return false;
            }
#else
           return false;
#endif


        osgUtil::LineSegmentIntersector::Intersection firstIntersection = *intersections.begin();

        if (firstIntersection.drawable == nullptr) {
            return false;
        }

#if OSG_VERSION_GREATER_OR_EQUAL(332)

        if (firstIntersection.drawable->getNumDescriptions() == 0) {
            std::cout << “Intersected drawable has no description:“ << std::endl;
            return true;
        }

        std::cout << “Description of intersected drawable:“ << std::endl;
        for (const std::string& desc : firstIntersection.drawable->getDescriptions()) {
            std::cout << “  “ << desc << std::endl;
        }
#else
        std::cout << firstIntersection.drawable->getName()<< std::endl;
#endif
        std::cout << std::endl;

        return true;
    }

    int m_xMouseCoordAtLastPress;
    int m_yMouseCoordAtLastPress;
};


int main(int argc char *argv[])
{
    osg::setNotifyLevel(osg::WARN);

    std::cout << “Using plugin directory: “ << PLUGIN_BIN_DIR << std::endl;
    osgDB::Registry::instance()->getLibraryFilePathList().push_front(PLUGIN_BIN_DIR);

    osgDB::Registry::instance()->addFileExtensionAlias(“gml“ “citygml“);

    if (argc < 2) {
        std::cerr << “No citygml file specified...“ <

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2017-11-16 16:36  libcitygml-2.0.7\
     文件         206  2017-11-16 16:36  libcitygml-2.0.7\.gitignore
     文件         631  2017-11-16 16:36  libcitygml-2.0.7\.travis.yml
     文件       10319  2017-11-16 16:36  libcitygml-2.0.7\CMakeLists.txt
     目录           0  2017-11-16 16:36  libcitygml-2.0.7\CMakeModules\
     文件        3002  2017-11-16 16:36  libcitygml-2.0.7\CMakeModules\FindCityGML.cmake
     文件        3422  2017-11-16 16:36  libcitygml-2.0.7\CMakeModules\FindXerces.cmake
     文件         896  2017-11-16 16:36  libcitygml-2.0.7\CMakeModules\citygml_api.h.in
     文件         899  2017-11-16 16:36  libcitygml-2.0.7\CMakeModules\cmake_uninstall.cmake.in
     文件       26521  2017-11-16 16:36  libcitygml-2.0.7\LICENSE
     文件        2977  2017-11-16 16:36  libcitygml-2.0.7\README.md
     文件        2172  2017-11-16 16:36  libcitygml-2.0.7\SpecsToCheck.md
     文件        3435  2017-11-16 16:36  libcitygml-2.0.7\TODO.md
     文件       84505  2017-11-16 16:36  libcitygml-2.0.7\citygml_to_libcitygml_mapping.graphml
     目录           0  2017-11-16 16:36  libcitygml-2.0.7\data\
     文件       10725  2017-11-16 16:36  libcitygml-2.0.7\data\b1_lod2_cs_w_sem.gml
     文件        6517  2017-11-16 16:36  libcitygml-2.0.7\data\b1_lod2_s.gml
     文件      932125  2017-11-16 16:36  libcitygml-2.0.7\data\berlin_open_data_sample_data.citygml
     目录           0  2017-11-16 16:36  libcitygml-2.0.7\debian_scripts\
     文件          10  2017-11-16 16:36  libcitygml-2.0.7\debian_scripts\postinst
     文件       49837  2017-11-16 16:36  libcitygml-2.0.7\libcitygml_classdiagram.graphml
     目录           0  2017-11-16 16:36  libcitygml-2.0.7\osgplugin\
     文件        1447  2017-11-16 16:36  libcitygml-2.0.7\osgplugin\CMakeLists.txt
     文件        4258  2017-11-16 16:36  libcitygml-2.0.7\osgplugin\CitygmlOsgViewer.cpp
     文件       19084  2017-11-16 16:36  libcitygml-2.0.7\osgplugin\ReaderWriterCityGML.cpp
     目录           0  2017-11-16 16:36  libcitygml-2.0.7\sources\
     文件          63  2017-11-16 16:36  libcitygml-2.0.7\sources\.gitignore
     文件        7392  2017-11-16 16:36  libcitygml-2.0.7\sources\CMakeLists.txt
     文件         299  2017-11-16 16:36  libcitygml-2.0.7\sources\citygml.pc.cmake
     目录           0  2017-11-16 16:36  libcitygml-2.0.7\sources\include\
     目录           0  2017-11-16 16:36  libcitygml-2.0.7\sources\include\citygml\
............此处省略114个文件信息

评论

共有 条评论

相关资源