├── .gitignore
├── EarthSDK
├── EarthSDK.vcxproj
├── EarthSDK.vcxproj.filters
├── EarthSDK.vcxproj.user
├── GxWorld.cpp
├── GxWorld.h
└── I_GxWorld.h
├── GVAnnotations
├── Bezier.cpp
├── Bezier.h
├── ConfigControlPoints.cpp
├── ConfigControlPoints.h
├── DraggerPositionChanged.cpp
├── DraggerPositionChanged.h
├── GV00001.cpp
├── GV00001.h
├── GV00002.cpp
├── GV00002.h
├── GV00003.cpp
├── GV00003.h
├── GV00004.cpp
├── GV00004.h
├── GV00005.cpp
├── GV00005.h
├── GV00006.cpp
├── GV00006.h
├── GV00007.cpp
├── GV00007.h
├── GVAnnotation.cpp
├── GVAnnotations.h
├── GVAnnotations.vcxproj
├── GVAnnotations.vcxproj.filters
├── GVAnnotations.vcxproj.user
├── GVCoord.cpp
├── GVCoord.h
├── GVGeometry.h
├── GVLineCreator.cpp
├── GVLineCreator.h
├── KidNey.cpp
├── KidNey.h
├── LineStyle.cpp
├── LineStyle.h
├── UseEventHandler.cpp
└── UseEventHandler.h
├── MFC_OSG_MDI.sln
└── MFC_OSG_MDI
├── ChildFrm.cpp
├── ChildFrm.h
├── MFC_OSG_MDI.APS
├── MFC_OSG_MDI.cpp
├── MFC_OSG_MDI.h
├── MFC_OSG_MDI.rc
├── MFC_OSG_MDI.vcxproj
├── MFC_OSG_MDI.vcxproj.filters
├── MFC_OSG_MDI.vcxproj.user
├── MFC_OSG_MDIDoc.cpp
├── MFC_OSG_MDIDoc.h
├── MFC_OSG_MDIView.cpp
├── MFC_OSG_MDIView.h
├── MainFrm.cpp
├── MainFrm.h
├── ReadMe.txt
├── Resource.h
├── res
├── MFC_OSG_MDI.ico
├── MFC_OSG_MDI.rc2
├── MFC_OSG_MDIDoc.ico
└── Toolbar.bmp
├── stdafx.cpp
└── stdafx.h
/.gitignore:
--------------------------------------------------------------------------------
1 |
2 |
3 | ## files ##
4 | *.obj
5 | *.orig
6 | *.suo
7 | *.sdf
8 | *.opensdf
9 |
10 |
11 | ## dir ##
12 | Release/
13 | Debug/
14 | ipch/
15 |
--------------------------------------------------------------------------------
/EarthSDK/EarthSDK.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | Win32
7 |
8 |
9 | Release
10 | Win32
11 |
12 |
13 |
14 | {6CB6FC86-2658-4DB7-ACFA-9F5EA74D97E3}
15 | Win32Proj
16 | EarthSDK
17 |
18 |
19 |
20 | DynamicLibrary
21 | true
22 | Unicode
23 |
24 |
25 | DynamicLibrary
26 | false
27 | true
28 | Unicode
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 | true
42 |
43 |
44 | false
45 |
46 |
47 |
48 |
49 |
50 | Level3
51 | Disabled
52 | WIN32;_DEBUG;_WINDOWS;_USRDLL;EARTHSDK_EXPORTS;%(PreprocessorDefinitions)
53 |
54 |
55 | Windows
56 | true
57 |
58 |
59 |
60 |
61 | Level3
62 |
63 |
64 | Disabled
65 | true
66 | true
67 | WIN32;NDEBUG;_WINDOWS;_USRDLL;EARTHSDK_EXPORTS;%(PreprocessorDefinitions)
68 | E:\MFC_OSG_MDI\GVAnnotations;E:\OpenSceneGraph_x86\include;E:\OSGEARTH\include
69 |
70 |
71 | Windows
72 | true
73 | true
74 | true
75 | E:\MFC_OSG_MDI\Release;E:\3rdParty\x86\lib;E:\OSGEARTH\lib;E:\OpenSceneGraph_x86\lib
76 | d3d9.lib;freetype2311MT.lib;gdal_i.lib;geos.lib;geos_c_i.lib;giflib.lib;glut32.lib;jpeg.lib;libboost_filesystem-vc100-mt.lib;libboost_system-vc100-mt.lib;libcollada14dom21.lib;libcurl.lib;libpng.lib;libtiff_i.lib;libxml2.lib;minizip.lib;nvtt.lib;pcre.lib;pcrecpp.lib;squish.lib;OpenThreads.lib;osg.lib;osgAnimation.lib;osgDB.lib;osgFX.lib;osgGA.lib;osgManipulator.lib;osgParticle.lib;osgPresentation.lib;osgShadow.lib;osgSim.lib;osgTerrain.lib;osgText.lib;osgUI.lib;osgUtil.lib;osgViewer.lib;osgVolume.lib;osgWidget.lib;osgEarth.lib;osgEarthAnnotation.lib;osgEarthFeatures.lib;osgEarthSymbology.lib;osgEarthUtil.lib;GVAnnotations.lib;%(AdditionalDependencies)
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
--------------------------------------------------------------------------------
/EarthSDK/EarthSDK.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | Header Files
20 |
21 |
22 | Header Files
23 |
24 |
25 |
26 |
27 | Source Files
28 |
29 |
30 |
--------------------------------------------------------------------------------
/EarthSDK/EarthSDK.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/EarthSDK/GxWorld.cpp:
--------------------------------------------------------------------------------
1 | #include "GxWorld.h"
2 |
3 | struct GxWorld::Hidden
4 | {
5 | public:
6 | Hidden(HWND hWnd, GxWorld* world)
7 | {
8 | m_hWnd = hWnd;
9 | InitOSG(world);
10 | }
11 |
12 | ~Hidden()
13 | {
14 |
15 | }
16 |
17 | static void Render(void* ptr)
18 | {
19 | Hidden* osg = (Hidden*)ptr;
20 |
21 | osgViewer::Viewer* viewer = osg->getViewer();
22 | viewer->setDone(false);
23 | viewer->setDataVariance(osg::Object::DYNAMIC);
24 |
25 | while(!viewer->done())
26 | {
27 | viewer->frame();
28 | }
29 | }
30 |
31 | osg::ref_ptr getViewer()
32 | {
33 | return mViewer;
34 | }
35 |
36 | osg::ref_ptr getMapMode()
37 | {
38 | return mMapNode;
39 | }
40 |
41 | osg::ref_ptr getRoot()
42 | {
43 | return mRoot;
44 | }
45 |
46 | osg::ref_ptr getAnnoGroup()
47 | {
48 | return mAnnoGroup;
49 | }
50 |
51 | osg::ref_ptr getEditGroup()
52 | {
53 | return mEditGroup;
54 | }
55 |
56 | private:
57 | void InitOSG(GxWorld* world)
58 | {
59 | mRoot = new osg::Group();
60 | mMap = new osgEarth::Map();
61 |
62 | osgEarth::Drivers::TMSOptions imagery;
63 | imagery.url() = "E:/osg/srtmdata/base_image/tms.xml";
64 | mMap->addImageLayer(new osgEarth::ImageLayer("Imagery", imagery));
65 |
66 | osgEarth::Drivers::TMSOptions elevation;
67 | elevation.url() = "E:/osg/srtmdata/dem/tms.xml";
68 | mMap->addElevationLayer(new osgEarth::ElevationLayer("Elevation", elevation));
69 |
70 | mMapNode = new osgEarth::MapNode(mMap.get());
71 |
72 |
73 |
74 | mAnnoGroup = new osg::Group();
75 | mEditGroup = new osg::Group();
76 |
77 | mRoot->addChild(mMapNode.get());
78 | mRoot->addChild(mAnnoGroup.get());
79 | mRoot->addChild(mEditGroup.get());
80 |
81 | osgEarth::Util::SkyNode* sky = osgEarth::Util::SkyNode::create(mMapNode);
82 | sky->setMoonVisible(false);
83 | sky->setSunVisible(true);
84 | sky->setLighting(osg::StateAttribute::OFF);
85 | sky->setMinimumAmbient(osg::Vec4d(0.0f, 0.f, 0.f, 0.f));
86 | mRoot->addChild(sky);
87 |
88 | RECT rect;
89 | mViewer = new osgViewer::Viewer();
90 |
91 | mViewer->addEventHandler(new osgViewer::StatsHandler);
92 | ::GetWindowRect(m_hWnd, &rect);
93 | osg::ref_ptr traits = new osg::GraphicsContext::Traits;
94 | osg::ref_ptr windata = new osgViewer::GraphicsWindowWin32::WindowData(m_hWnd);
95 |
96 | traits->x = 0;
97 | traits->y = 0;
98 | traits->width = rect.right - rect.left;
99 | traits->height = rect.bottom - rect.top;
100 | traits->windowDecoration = false;
101 | traits->doubleBuffer = true;
102 | traits->sharedContext = 0;
103 | traits->setInheritedWindowPixelFormat = true;
104 | traits->inheritedWindowData = windata;
105 |
106 | osg::GraphicsContext* gc = osg::GraphicsContext::createGraphicsContext(traits.get());
107 | osg::ref_ptr camera = mViewer->getCamera();
108 | camera->setGraphicsContext(gc);
109 | camera->setViewport(new osg::Viewport(0, 0, traits->width, traits->height));
110 | camera->setClearMask(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
111 | camera->setClearColor(osg::Vec4f(0.0f, 0.0f, 0.0f, 1.0f));
112 | camera->setProjectionMatrixAsPerspective(
113 | 30.0f, static_cast(traits->width)/static_cast(traits->height), 1.0, 1000.0);
114 |
115 | mViewer->setCamera(camera.get());
116 | mViewer->setCameraManipulator(new osgEarth::Util::EarthManipulator);
117 | mViewer->setSceneData(mRoot.get());
118 | osgEarth::Viewpoint viewpoint = ((osgEarth::Util::EarthManipulator*)(mViewer->getCameraManipulator()))->getViewpoint();
119 | const osgEarth::Viewpoint pos = osgEarth::Viewpoint("MyCenter", 111.625, 22.5833, 0.0, viewpoint.getHeading(), viewpoint.getPitch(), viewpoint.getRange());
120 | ((osgEarth::Util::EarthManipulator*)(mViewer->getCameraManipulator()))->setViewpoint(pos, 2.0);
121 | ((osgEarth::Util::EarthManipulator*)(mViewer->getCameraManipulator()))->setHomeViewpoint(pos);
122 |
123 | mViewer->realize();
124 | }
125 |
126 | private:
127 | HWND m_hWnd;
128 |
129 | osg::ref_ptr mViewer;
130 | osg::ref_ptr mRoot;
131 | osg::ref_ptr mAnnoGroup;
132 | osg::ref_ptr mEditGroup;
133 | osg::ref_ptr mMap;
134 | osg::ref_ptr mMapNode;
135 |
136 | GVAnnotations* anno;
137 | };
138 |
139 | GxWorld::GxWorld(HWND hwnd)
140 | {
141 | h = new Hidden(hwnd, this);
142 | }
143 |
144 | GxWorld::~GxWorld()
145 | {
146 |
147 | }
148 |
149 | void GxWorld::Display()
150 | {
151 | h->getViewer()->setDone(true);
152 | HANDLE mThreadHandle = (HANDLE)_beginthread(&Hidden::Render, 0, h);
153 | }
154 |
155 | void GxWorld::InitAnno()
156 | {
157 | anno = new GVAnnotations(h->getViewer(), h->getRoot(), h->getMapMode(), h->getAnnoGroup(), h->getEditGroup());
158 | }
159 |
160 | void GxWorld::sendKey(int key)
161 | {
162 | anno->initGeom(key);
163 | }
164 |
165 | I_GxWorld* GxWorld_CreateWorldObject(HWND hwnd)
166 | {
167 | return new GxWorld(hwnd);
168 | }
--------------------------------------------------------------------------------
/EarthSDK/GxWorld.h:
--------------------------------------------------------------------------------
1 | #ifndef GXWORLD_H
2 | #define GXWORLD_H
3 |
4 | #include "I_GxWorld.h"
5 | #include "GVAnnotations.h"
6 | #include
7 |
8 | // OSG
9 | #include
10 | #include
11 | #include
12 | #include
13 | #include
14 | #include
15 | #include
16 |
17 | // EARTH
18 | #include
19 | #include
20 | #include
21 | #include
22 | #include
23 |
24 | class GxWorld : public I_GxWorld
25 | {
26 | public:
27 | GxWorld(HWND hwnd);
28 | ~GxWorld();
29 |
30 | void Display();
31 | void InitAnno();
32 | void sendKey(int key);
33 |
34 | private:
35 | struct Hidden;
36 | friend struct Hidden;
37 |
38 | Hidden* h;
39 | GVAnnotations* anno;
40 | };
41 | #endif //GXWORLD_H
--------------------------------------------------------------------------------
/EarthSDK/I_GxWorld.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | class I_GxWorld
6 | {
7 | public:
8 | virtual void Display() = 0;
9 | virtual void InitAnno() = 0;
10 | virtual void sendKey(int key) = 0;
11 | };
12 |
13 | #ifdef __cplusplus
14 | extern "C" {
15 | #endif
16 |
17 | __declspec(dllexport) I_GxWorld* GxWorld_CreateWorldObject(HWND hwnd);
18 |
19 | #ifdef __cplusplus
20 | }
21 | #endif
--------------------------------------------------------------------------------
/GVAnnotations/Bezier.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zengjunyu/osgEarth_Annotation/194a05a6aecbcebc756dfc4f144fbe699cbc1f3d/GVAnnotations/Bezier.cpp
--------------------------------------------------------------------------------
/GVAnnotations/Bezier.h:
--------------------------------------------------------------------------------
1 | #ifndef __BEZIER_H__
2 | #define __BEZIER_H__
3 |
4 | #include "GVCoord.h"
5 | #include
6 |
7 | class Bezier
8 | {
9 | public:
10 | void getBezier(const std::vector& controlPoints, std::vector* bezierPoints);
11 | };
12 | #endif
--------------------------------------------------------------------------------
/GVAnnotations/ConfigControlPoints.cpp:
--------------------------------------------------------------------------------
1 | #include "ConfigControlPoints.h"
2 |
3 | void ConfigControlPoints::configControlPoints(std::vector &_controlPoints)
4 | {
5 | int length = _controlPoints.size();
6 | std::vector lon_interpolation;;
7 |
8 | if(length >= 2)
9 | {
10 | for (int i=1, j=0; i 180)
15 | {
16 | if(lon_interpolation[j] > 0)
17 | lon_interpolation[j] = lon_interpolation[j] - 360;
18 | else
19 | lon_interpolation[j] = lon_interpolation[j] + 360;
20 | }
21 | _controlPoints[i].lon = _controlPoints[i-1].lon + lon_interpolation[j];
22 | }
23 | }
24 | }
25 |
26 | void ConfigControlPoints::configControlPoints(GVCoord &vtx, std::vector &_controlPoints)
27 | {
28 | int cpSize = _controlPoints.size();
29 | double LON = 0.0;
30 | for (int i=0; i 180)
37 | {
38 | vtx.lon -= 360;
39 | }
40 | else if(vtx.lon - LON < -180)
41 | {
42 | vtx.lon += 360;
43 | }
44 | }
45 |
46 | void ConfigControlPoints::configControlPoints(int idx, std::vector &_controlPoints)
47 | {
48 | if(_controlPoints.size() < 2)
49 | return;
50 |
51 | std::vector deltaList;
52 |
53 | if (idx > 0)
54 | {
55 | for (int i = idx; i < _controlPoints.size(); i++)
56 | {
57 | double delta = _controlPoints[i].lon - _controlPoints[i-1].lon;
58 | deltaList.push_back(delta);
59 | }
60 |
61 | for (int i=0; i < deltaList.size(); i++, idx++)
62 | {
63 | if (abs(deltaList.at(i)) > 180)
64 | {
65 | if(deltaList.at(i) > 0)
66 | deltaList.at(i) = deltaList.at(i) - 360;
67 | else
68 | deltaList.at(i) = deltaList.at(i) + 360;
69 | }
70 | _controlPoints[idx].lon = _controlPoints[idx-1].lon + deltaList.at(i);
71 | }
72 | }
73 | else
74 | {
75 | for (int i=1; i<_controlPoints.size(); i++)
76 | {
77 | double delta = _controlPoints[i].lon - _controlPoints[i-1].lon;
78 | deltaList.push_back(delta);
79 | }
80 |
81 | for (int i=0; i 180)
84 | {
85 | if(deltaList.at(i) > 0)
86 | deltaList.at(i) = deltaList.at(i) - 360;
87 | else
88 | deltaList.at(i) = deltaList.at(i) + 360;
89 | }
90 | }
91 |
92 | for (int i=deltaList.size(); i>0; i--)
93 | {
94 | _controlPoints[i-1].lon = _controlPoints[i].lon - deltaList.at(i-1);
95 | }
96 | }
97 | }
--------------------------------------------------------------------------------
/GVAnnotations/ConfigControlPoints.h:
--------------------------------------------------------------------------------
1 | #ifndef __CONFIG_CONTROL_POINTS_H__
2 | #define __CONFIG_CONTROL_POINTS_H__
3 |
4 | #include "GVCoord.h"
5 | #include
6 |
7 | class ConfigControlPoints
8 | {
9 | public:
10 | void configControlPoints(std::vector &_controlPoints);
11 | void configControlPoints(GVCoord &vtx, std::vector &_controlPoints);
12 | void configControlPoints(int idx, std::vector &_controlPoints);
13 | };
14 |
15 | #endif //__CONFIG_CONTROL_POINTS_H__
--------------------------------------------------------------------------------
/GVAnnotations/DraggerPositionChanged.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zengjunyu/osgEarth_Annotation/194a05a6aecbcebc756dfc4f144fbe699cbc1f3d/GVAnnotations/DraggerPositionChanged.cpp
--------------------------------------------------------------------------------
/GVAnnotations/DraggerPositionChanged.h:
--------------------------------------------------------------------------------
1 | #ifndef __DRAGGER_POSITION_CHANGED_H__
2 | #define __DRAGGER_POSITION_CHANGED_H__
3 |
4 | #include "GVCoord.h"
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 |
11 |
12 | class DraggerPositionChanged
13 | : public osg::Group
14 | {
15 | public:
16 | DraggerPositionChanged();
17 | ~DraggerPositionChanged();
18 | void CreatControlPonitsShow(std::vector vtxBuffer,osgEarth::MapNode* mapNode,osg::Group* editGroup);
19 | void updateDraggerPosition(int idx,const GVCoord coord,osgEarth::MapNode* mapNode,osg::Group* editGroup);
20 | bool getCenterControlPoint(const std::vector vtxBuffer,GVCoord &coord);
21 | };
22 |
23 | #endif //__DRAGGER_POSITION_CHANGED_H__
--------------------------------------------------------------------------------
/GVAnnotations/GV00001.cpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "GV00001.h"
4 |
5 | GV00001::GV00001()
6 | {
7 |
8 | }
9 |
10 | GV00001::~GV00001()
11 | {
12 |
13 | }
14 |
15 | int GV00001::getControlPointCount()
16 | {
17 | std::vector controlPoints;
18 | getControlPoints(controlPoints);
19 | return controlPoints.size();
20 | }
21 |
22 | void GV00001::getControlPoints(std::vector& vtxBuffer)
23 | {
24 | if(_controlPoints.size() <= 0)
25 | return ;
26 | vtxBuffer = _controlPoints;
27 | }
28 |
29 | GVCoord GV00001::getControlPoint(int idx)
30 | {
31 | if(idx >= 0 && idx < _controlPoints.size())
32 | return _controlPoints[idx];
33 |
34 | return GVCoord();
35 | }
36 |
37 | void GV00001::setControlPointsEx(std::vector &vtxBuffer)
38 | {
39 | _controlPoints = vtxBuffer;
40 | }
41 |
42 | void GV00001::setControlPoints(std::vector& vtxBuffer)
43 | {
44 | _controlPoints = vtxBuffer;
45 | }
46 |
47 | void GV00001::setControlPoint(int idx, const GVCoord& vtx)
48 | {
49 | int cpSize = _controlPoints.size();
50 | if(idx < 0 || idx >= cpSize)
51 | return ;
52 | _controlPoints[idx] = vtx;
53 |
54 | }
55 |
56 | bool GV00001::toVertice(std::vector& vtxBuffer, std::vector* vtxBuffer2)
57 | {
58 | Bezier bezier;
59 | std::vector bezierPoints;
60 | bezier.getBezier(_controlPoints, &bezierPoints);
61 | vtxBuffer = bezierPoints;
62 | vtxBuffer2->push_back(bezierPoints.size());
63 |
64 | return true;
65 | }
--------------------------------------------------------------------------------
/GVAnnotations/GV00001.h:
--------------------------------------------------------------------------------
1 | #ifndef __GV00001_H__
2 | #define __GV00001_H__
3 |
4 | #include "GVGeometry.h"
5 | #include "Bezier.h"
6 |
7 | class GV00001 : public GVGeometry
8 | {
9 | public:
10 | GV00001();
11 | ~GV00001();
12 |
13 | int getControlPointCount();
14 | void getControlPoints(std::vector& vtxBuffer);
15 | GVCoord getControlPoint(int idx);
16 | void setControlPointsEx(std::vector& vtxBuffer);
17 | void setControlPoints(std::vector& vtxBuffer);
18 | void setControlPoint(int idx, const GVCoord& vtx);
19 | bool toVertice(std::vector& vtxBuffer, std::vector* vtxBuffer2);
20 |
21 | private:
22 | std::vector _controlPoints;
23 | };
24 |
25 | #endif //__GV00001_H__
--------------------------------------------------------------------------------
/GVAnnotations/GV00002.cpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "GV00002.h"
4 |
5 | GV00002::GV00002()
6 | {
7 |
8 | }
9 |
10 | GV00002::~GV00002()
11 | {
12 |
13 | }
14 |
15 | int GV00002::getControlPointCount()
16 | {
17 | std::vector controlPoints;
18 | getControlPoints(controlPoints);
19 | return controlPoints.size();
20 | }
21 |
22 | void GV00002::getControlPoints(std::vector& vtxBuffer)
23 | {
24 | if(_controlPoints.size() <= 0)
25 | return ;
26 | vtxBuffer = _controlPoints;
27 | }
28 |
29 | GVCoord GV00002::getControlPoint(int idx)
30 | {
31 | if(idx >= 0 && idx < _controlPoints.size())
32 | return _controlPoints[idx];
33 |
34 | return GVCoord();
35 | }
36 |
37 | void GV00002::setControlPointsEx(std::vector &vtxBuffer)
38 | {
39 | _controlPoints = vtxBuffer;
40 | }
41 |
42 | void GV00002::setControlPoints(std::vector& vtxBuffer)
43 | {
44 | _controlPoints = vtxBuffer;
45 | }
46 |
47 | void GV00002::setControlPoint(int idx, const GVCoord& vtx)
48 | {
49 | int cpSize = _controlPoints.size();
50 | if(idx < 0 || idx >= cpSize)
51 | return ;
52 | _controlPoints[idx] = vtx;
53 |
54 | }
55 |
56 | bool GV00002::toVertice(std::vector& vtxBuffer, std::vector* vtxBuffer2)
57 | {
58 | vtxBuffer = _controlPoints;
59 | vtxBuffer2->push_back(vtxBuffer.size());
60 |
61 | return true;
62 | }
--------------------------------------------------------------------------------
/GVAnnotations/GV00002.h:
--------------------------------------------------------------------------------
1 | #ifndef __GV00002_H__
2 | #define __GV00002_H__
3 |
4 | #include "GVGeometry.h"
5 |
6 | class GV00002 : public GVGeometry
7 | {
8 | public:
9 | GV00002();
10 | ~GV00002();
11 |
12 | int getControlPointCount();
13 | void getControlPoints(std::vector& vtxBuffer);
14 | GVCoord getControlPoint(int idx);
15 | void setControlPointsEx(std::vector& vtxBuffer);
16 | void setControlPoints(std::vector& vtxBuffer);
17 | void setControlPoint(int idx, const GVCoord& vtx);
18 | bool toVertice(std::vector& vtxBuffer, std::vector* vtxBuffer2);
19 |
20 | private:
21 | std::vector _controlPoints;
22 | };
23 |
24 | #endif //__GV00002_H__
--------------------------------------------------------------------------------
/GVAnnotations/GV00003.cpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "GV00003.h"
4 |
5 | #define Distance_3(coord1, coord2) (sqrt((coord1.lat - coord2.lat) * (coord1.lat - coord2.lat) + (coord1.lon - coord2.lon) * (coord1.lon - coord2.lon)))
6 |
7 | GV00003::GV00003()
8 | {
9 | scale[0] = 0.12;
10 | scale[1] = 0.15;
11 | scale[2] = 0.4;
12 | scale[3] = 0.3;
13 | }
14 |
15 | GV00003::~GV00003()
16 | {
17 |
18 | }
19 |
20 | int GV00003::getControlPointCount()
21 | {
22 | std::vector controlPoints;
23 | getControlPoints(controlPoints);
24 | return controlPoints.size();
25 | }
26 |
27 | void GV00003::getControlPoints(std::vector& vtxBuffer)
28 | {
29 | if(_controlPoints.size() <= 0)
30 | return ;
31 |
32 | vtxBuffer = _controlPoints;
33 | }
34 |
35 | GVCoord GV00003::getControlPoint(int idx)
36 | {
37 | if(idx >= 0 && idx < _controlPoints.size())
38 | return _controlPoints[idx];
39 |
40 | return GVCoord();
41 | }
42 |
43 | void GV00003::setControlPointsEx(std::vector &vtxBuffer)
44 | {
45 | _controlPoints = vtxBuffer;
46 | }
47 |
48 | void GV00003::setControlPoints(std::vector& vtxBuffer)
49 | {
50 | _controlPoints.clear();
51 | _controlPoints = vtxBuffer;
52 |
53 | if(_controlPoints.size() > 2)
54 | {
55 | GVCoord arrowHead = _controlPoints[_controlPoints.size()-1];
56 | GVCoord arrowTailLeft = _controlPoints[0];
57 | GVCoord arrowTailRight = _controlPoints[1];
58 |
59 | double brockenLineLength = Distance_3(GVCoord((arrowTailLeft.lon + arrowTailRight.lon)/2, (arrowTailLeft.lat + arrowTailRight.lat)/2, 0), arrowHead);
60 |
61 | if(_controlPoints.size() > 3)
62 | {
63 | brockenLineLength = Distance_3(_controlPoints[_controlPoints.size()-2], _controlPoints[_controlPoints.size()-1]);
64 | }
65 |
66 | GVCoord penultimatePointOnAxis;
67 | penultimatePointOnAxis.lon = (arrowTailLeft.lon + arrowTailRight.lon)/2;
68 | penultimatePointOnAxis.lat = (arrowTailLeft.lat + arrowTailRight.lat)/2;
69 | if(_controlPoints.size() > 3)
70 | {
71 | penultimatePointOnAxis = _controlPoints[_controlPoints.size()-2];
72 | }
73 |
74 | double arrowTopLength = 2 * brockenLineLength * scale[0];
75 | double arrowNeckWidthHalf = arrowTopLength * scale[1];
76 | double arrowEarWidthHalf = arrowTopLength * scale[2];
77 | double arrowEarthLength = arrowTopLength * scale[3];
78 |
79 | GVCoord arrowNeckRight;
80 | GVCoord arrowEarLeft;
81 | GVCoord arrowEarMiddle;
82 |
83 | osg::Vec3d vecTop = osg::Vec3d(arrowHead.lon - penultimatePointOnAxis.lon, arrowHead.lat - penultimatePointOnAxis.lat, 0);
84 | vecTop.normalize();
85 | arrowEarMiddle.lon = arrowHead.lon - arrowTopLength * vecTop.x();
86 | arrowEarMiddle.lat = arrowHead.lat - arrowTopLength * vecTop.y();
87 |
88 | osg::Vec3d vecTopVertical = osg::Vec3d(-vecTop.y(), vecTop.x(), 0);
89 | arrowEarLeft.lon = arrowEarMiddle.lon + arrowEarWidthHalf * vecTopVertical.x();
90 | arrowEarLeft.lat = arrowEarMiddle.lat + arrowEarWidthHalf * vecTopVertical.y();
91 |
92 | GVCoord arrowNeckMiddle;
93 | arrowNeckMiddle.lon = arrowHead.lon - (arrowTopLength - arrowEarthLength) * vecTop.x();
94 | arrowNeckMiddle.lat = arrowHead.lat - (arrowTopLength - arrowEarthLength) * vecTop.y();
95 |
96 | arrowNeckRight.lon = arrowNeckMiddle.lon - arrowNeckWidthHalf * vecTopVertical.x();
97 | arrowNeckRight.lat = arrowNeckMiddle.lat - arrowNeckWidthHalf * vecTopVertical.y();
98 |
99 | _controlPoints.insert(_controlPoints.begin(), arrowEarMiddle);
100 | _controlPoints.insert(_controlPoints.begin(), arrowEarLeft);
101 | _controlPoints.insert(_controlPoints.begin(), arrowNeckRight);
102 | }
103 | }
104 |
105 | void GV00003::setControlPoint(int idx, const GVCoord& vtx)
106 | {
107 | int cpSize = _controlPoints.size();
108 | if(idx < 0 || idx >= cpSize)
109 | return ;
110 |
111 | GVCoord arrowHead = _controlPoints[_controlPoints.size()-1];
112 | GVCoord arrowTailLeft = _controlPoints[3];
113 | GVCoord arrowTailRight = _controlPoints[4];
114 |
115 | double brockenLineLength = Distance_3(GVCoord((arrowTailLeft.lon + arrowTailRight.lon)/2, (arrowTailLeft.lat + arrowTailRight.lat)/2, 0), arrowHead);
116 |
117 | if(_controlPoints.size() > 6)
118 | {
119 | brockenLineLength = Distance_3(_controlPoints[_controlPoints.size()-2], _controlPoints[_controlPoints.size()-1]);
120 | }
121 |
122 | GVCoord penultimatePointOnAxis;
123 | penultimatePointOnAxis.lon = (arrowTailLeft.lon + arrowTailRight.lon)/2;
124 | penultimatePointOnAxis.lat = (arrowTailLeft.lat + arrowTailRight.lat)/2;
125 | if(_controlPoints.size() > 6)
126 | {
127 | penultimatePointOnAxis = _controlPoints[_controlPoints.size()-2];
128 | }
129 |
130 | double arrowTopLength = 2 * brockenLineLength * scale[0];
131 | double arrowNeckWidthHalf = arrowTopLength * scale[1];
132 | double arrowEarWidthHalf = arrowTopLength * scale[2];
133 | double arrowEarthLength = arrowTopLength * scale[3];
134 |
135 | osg::Vec3d vecTop = osg::Vec3d(arrowHead.lon - penultimatePointOnAxis.lon, arrowHead.lat - penultimatePointOnAxis.lat, 0);
136 | vecTop.normalize();
137 | osg::Vec3d vecTopVertical = osg::Vec3d(-vecTop.y(), vecTop.x(), 0);
138 |
139 | if(idx == 0)
140 | {
141 | GVCoord arrowNeckMiddle;
142 | arrowNeckMiddle.lon = arrowHead.lon - (arrowTopLength - arrowEarthLength) * vecTop.x();
143 | arrowNeckMiddle.lat = arrowHead.lat - (arrowTopLength - arrowEarthLength) * vecTop.y();
144 |
145 | osg::Vec3d vec = osg::Vec3d(vtx.lon - arrowNeckMiddle.lon, vtx.lat - arrowNeckMiddle.lat, 0);
146 | double projectLength = vec * vecTopVertical;
147 | if(projectLength >= 0){
148 | projectLength = 0.3 * arrowNeckWidthHalf;
149 | }else{
150 | if(abs(projectLength) > 0.7 * arrowEarWidthHalf){
151 | projectLength = 0.7 * arrowEarWidthHalf;
152 | }else{
153 | projectLength = abs(projectLength);
154 | }
155 | }
156 |
157 | _controlPoints[0].lon = arrowNeckMiddle.lon - projectLength * vecTopVertical.x();
158 | _controlPoints[0].lat = arrowNeckMiddle.lat - projectLength * vecTopVertical.y();
159 |
160 | scale[1] = projectLength / arrowTopLength;
161 | }else if(idx == 1){
162 | double distanceTop = Distance_3(_controlPoints[1], arrowHead);
163 | osg::Vec3d vec = osg::Vec3d(arrowHead.lon - vtx.lon, arrowHead.lat - vtx.lat, 0);
164 | vec.normalize();
165 | _controlPoints[1].lon = arrowHead.lon - distanceTop * vec.x();
166 | _controlPoints[1].lat = arrowHead.lat - distanceTop * vec.y();
167 |
168 | vec.x() = distanceTop * vec.x();
169 | vec.y() = distanceTop * vec.y();
170 | arrowEarWidthHalf = abs(vec * vecTopVertical);
171 |
172 | _controlPoints[2].lon = _controlPoints[1].lon - arrowEarWidthHalf * vecTopVertical.x();
173 | _controlPoints[2].lat = _controlPoints[1].lat - arrowEarWidthHalf * vecTopVertical.y();
174 |
175 | double arrowTopLengthNew = Distance_3(_controlPoints[2], arrowHead);
176 |
177 | scale[0] = (arrowTopLengthNew / 2.0) / brockenLineLength;
178 | scale[1] = arrowNeckWidthHalf / arrowTopLengthNew;
179 | scale[2] = arrowEarWidthHalf / arrowTopLengthNew;
180 | scale[3] = (arrowEarthLength - (arrowTopLength - arrowTopLengthNew)) / arrowTopLengthNew;
181 | arrowTopLength = arrowTopLengthNew;
182 | }else if(idx == 2){
183 | osg::Vec3d vec = osg::Vec3d(arrowHead.lon - vtx.lon, arrowHead.lat - vtx.lat, 0);
184 | double projectLength = vec * vecTop;
185 | static double maxLength = arrowTopLength;
186 |
187 | if(projectLength > 0 && projectLength < maxLength)
188 | {
189 | _controlPoints[2].lon = arrowHead.lon - projectLength * vecTop.x();
190 | _controlPoints[2].lat = arrowHead.lat - projectLength * vecTop.y();
191 |
192 | arrowTopLength = projectLength;
193 | arrowNeckWidthHalf = arrowTopLength * scale[1];
194 | arrowEarWidthHalf = arrowTopLength * scale[2];
195 | arrowEarthLength = arrowTopLength * scale[3];
196 |
197 | scale[0] = (arrowTopLength / 2.0) / brockenLineLength;
198 |
199 | _controlPoints[1].lon = _controlPoints[2].lon + arrowEarWidthHalf * vecTopVertical.x();
200 | _controlPoints[1].lat = _controlPoints[2].lat + arrowEarWidthHalf * vecTopVertical.y();
201 |
202 | GVCoord arrowNeckMiddle;
203 | arrowNeckMiddle.lon = _controlPoints[2].lon + arrowEarthLength * vecTop.x();
204 | arrowNeckMiddle.lat = _controlPoints[2].lat + arrowEarthLength * vecTop.y();
205 |
206 | _controlPoints[0].lon = arrowNeckMiddle.lon - arrowNeckWidthHalf * vecTopVertical.x();
207 | _controlPoints[0].lat = arrowNeckMiddle.lat - arrowNeckWidthHalf * vecTopVertical.y();
208 | }
209 | }else{
210 | _controlPoints[idx] = vtx;
211 |
212 | GVCoord arrowHead = _controlPoints[_controlPoints.size()-1];
213 | GVCoord arrowTailLeft = _controlPoints[3];
214 | GVCoord arrowTailRight = _controlPoints[4];
215 |
216 | double brockenLineLength = Distance_3(GVCoord((arrowTailLeft.lon + arrowTailRight.lon)/2, (arrowTailLeft.lat + arrowTailRight.lat)/2, 0), arrowHead);
217 |
218 | if(_controlPoints.size() > 6)
219 | {
220 | brockenLineLength = Distance_3(_controlPoints[_controlPoints.size()-2], _controlPoints[_controlPoints.size()-1]);
221 | }
222 |
223 | GVCoord penultimatePointOnAxis;
224 | penultimatePointOnAxis.lon = (arrowTailLeft.lon + arrowTailRight.lon)/2;
225 | penultimatePointOnAxis.lat = (arrowTailLeft.lat + arrowTailRight.lat)/2;
226 | if(_controlPoints.size() > 6)
227 | {
228 | penultimatePointOnAxis = _controlPoints[_controlPoints.size()-2];
229 | }
230 |
231 | double arrowTopLength = 2 * brockenLineLength * scale[0];
232 | double arrowNeckWidthHalf = arrowTopLength * scale[1];
233 | double arrowEarWidthHalf = arrowTopLength * scale[2];
234 | double arrowEarthLength = arrowTopLength * scale[3];
235 |
236 | GVCoord arrowNeckRight;
237 | GVCoord arrowEarLeft;
238 | GVCoord arrowEarMiddle;
239 |
240 | osg::Vec3d vecTop = osg::Vec3d(arrowHead.lon - penultimatePointOnAxis.lon, arrowHead.lat - penultimatePointOnAxis.lat, 0);
241 | vecTop.normalize();
242 |
243 | arrowEarMiddle.lon = arrowHead.lon - arrowTopLength * vecTop.x();
244 | arrowEarMiddle.lat = arrowHead.lat - arrowTopLength * vecTop.y();
245 |
246 | osg::Vec3d vecTopVertical = osg::Vec3d(-vecTop.y(), vecTop.x(), 0);
247 | arrowEarLeft.lon = arrowEarMiddle.lon + arrowEarWidthHalf * vecTopVertical.x();
248 | arrowEarLeft.lat = arrowEarMiddle.lat + arrowEarWidthHalf * vecTopVertical.y();
249 |
250 | GVCoord arrowNeckMiddle;
251 | arrowNeckMiddle.lon = arrowHead.lon - (arrowTopLength - arrowEarthLength) * vecTop.x();
252 | arrowNeckMiddle.lat = arrowHead.lat - (arrowTopLength - arrowEarthLength) * vecTop.y();
253 |
254 | arrowNeckRight.lon = arrowNeckMiddle.lon - arrowNeckWidthHalf * vecTopVertical.x();
255 | arrowNeckRight.lat = arrowNeckMiddle.lat - arrowNeckWidthHalf * vecTopVertical.y();
256 |
257 | _controlPoints[0] = arrowNeckRight;
258 | _controlPoints[1] = arrowEarLeft;
259 | _controlPoints[2] = arrowEarMiddle;
260 | }
261 | }
262 |
263 | bool GV00003::toVertice(std::vector& vtxBuffer, std::vector* vtxBuffer2)
264 | {
265 | if(_controlPoints.size() < 6)
266 | return false;
267 |
268 | GVCoord arrowHead = _controlPoints[_controlPoints.size()-1];
269 | GVCoord arrowTailLeft = _controlPoints[3];
270 | GVCoord arrowTailRight = _controlPoints[4];
271 |
272 | double brockenLineLength = Distance_3(GVCoord((arrowTailLeft.lon + arrowTailRight.lon)/2, (arrowTailLeft.lat + arrowTailRight.lat)/2, 0), arrowHead);
273 |
274 | if(_controlPoints.size() > 6)
275 | {
276 | brockenLineLength = Distance_3(_controlPoints[_controlPoints.size()-2], _controlPoints[_controlPoints.size()-1]);
277 | }
278 |
279 | GVCoord penultimatePointOnAxis;
280 | penultimatePointOnAxis.lon = (arrowTailLeft.lon + arrowTailRight.lon)/2;
281 | penultimatePointOnAxis.lat = (arrowTailLeft.lat + arrowTailRight.lat)/2;
282 | if(_controlPoints.size() > 6)
283 | {
284 | penultimatePointOnAxis = _controlPoints[_controlPoints.size()-2];
285 | }
286 |
287 | double arrowTopLength = 2 * brockenLineLength * scale[0];
288 | double arrowNeckWidthHalf = arrowTopLength * scale[1];
289 | double arrowEarWidthHalf = arrowTopLength * scale[2];
290 | double arrowEarthLength = arrowTopLength * scale[3];
291 |
292 | GVCoord arrowNeckRight, arrowNeckLeft;
293 | GVCoord arrowEarRight, arrowEarLeft;
294 |
295 | osg::Vec3d vecTop = osg::Vec3d(arrowHead.lon - penultimatePointOnAxis.lon, arrowHead.lat - penultimatePointOnAxis.lat, 0);
296 | vecTop.normalize();
297 | osg::Vec3d vecTopVertical = osg::Vec3d(-vecTop.y(), vecTop.x(), 0);
298 |
299 | arrowEarLeft = _controlPoints[1];
300 | arrowEarRight.lon = arrowEarLeft.lon - 2 * arrowEarWidthHalf * vecTopVertical.x();
301 | arrowEarRight.lat = arrowEarLeft.lat - 2 * arrowEarWidthHalf * vecTopVertical.y();
302 |
303 | arrowNeckRight = _controlPoints[0];
304 | arrowNeckLeft.lon = arrowNeckRight.lon + 2 * arrowNeckWidthHalf * vecTopVertical.x();
305 | arrowNeckLeft.lat = arrowNeckRight.lat + 2 * arrowNeckWidthHalf * vecTopVertical.y();
306 |
307 | double arrowTailWidth = Distance_3(arrowTailLeft, arrowTailRight);
308 |
309 | GVCoord arrowTailMiddle;
310 | arrowTailMiddle.lon = (arrowTailLeft.lon + arrowTailRight.lon)/2;
311 | arrowTailMiddle.lat = (arrowTailLeft.lat + arrowTailRight.lat)/2;
312 |
313 | double offset = arrowTailWidth/2.0 - arrowNeckWidthHalf;
314 |
315 | Bezier bezier;
316 |
317 | if(_controlPoints.size() == 6)
318 | {
319 | osg::Vec3d vecTail = osg::Vec3d(arrowTailLeft.lon - arrowTailRight.lon, arrowTailLeft.lat - arrowTailRight.lat, 0);
320 | vecTail.normalize();
321 |
322 | GVCoord topTailMiddle;
323 | topTailMiddle.lon = (arrowHead.lon + arrowTailMiddle.lon) / 2;
324 | topTailMiddle.lat = (arrowHead.lat + arrowTailMiddle.lat) / 2;
325 |
326 | GVCoord arrowBodyLeft, arrowBodyRight;
327 | arrowBodyLeft.lon = topTailMiddle.lon + (arrowNeckWidthHalf + 0.25 * offset) * vecTail.x();
328 | arrowBodyLeft.lat = topTailMiddle.lat + (arrowNeckWidthHalf + 0.25 * offset) * vecTail.y();
329 | arrowBodyRight.lon = topTailMiddle.lon - (arrowNeckWidthHalf + 0.25 * offset) * vecTail.x();
330 | arrowBodyRight.lat = topTailMiddle.lat - (arrowNeckWidthHalf + 0.25 * offset) * vecTail.y();
331 |
332 | std::vector keyPoints;
333 | std::vector bezierPoints;
334 | double t = (_controlPoints[3].lon - _controlPoints[5].lon) * (_controlPoints[4].lat - _controlPoints[5].lat) - (_controlPoints[4].lon - _controlPoints[5].lon) * (_controlPoints[3].lat - _controlPoints[5].lat);
335 | keyPoints.clear();
336 | bezierPoints.clear();
337 | if(t < 0)
338 | {
339 | keyPoints.push_back(arrowTailRight);
340 | keyPoints.push_back(arrowBodyRight);
341 | }
342 | else
343 | {
344 | keyPoints.push_back(arrowTailLeft);
345 | keyPoints.push_back(arrowBodyLeft);
346 | }
347 | keyPoints.push_back(arrowNeckLeft);
348 |
349 | bezier.getBezier(keyPoints, &bezierPoints);
350 | for(int i=0; ipush_back(vtxBuffer.size());
410 | }
411 | else
412 | {
413 | double axisBrokenLineLength = Distance_3(arrowTailMiddle, _controlPoints[5]);
414 | axisBrokenLineLength += brokenLineDistance(5, _controlPoints.size()-1);
415 |
416 | double currentTopBrokenLineLength = 0;
417 | std::vector keyPointsLeft, keyPointsRight;
418 | std::vector bezierPointsLeft, bezierPointsRight;
419 |
420 | keyPointsLeft.clear();
421 | keyPointsRight.clear();
422 | keyPointsLeft.push_back(arrowNeckLeft);
423 | keyPointsRight.push_back(arrowNeckRight);
424 |
425 | for (int i=_controlPoints.size()-2; i>4; i--)
426 | {
427 | currentTopBrokenLineLength = brokenLineDistance(i, _controlPoints.size()-1);
428 | double rate = pow(currentTopBrokenLineLength / axisBrokenLineLength, 2);
429 | osg::Vec3d vecNear = osg::Vec3d(_controlPoints[i+1].lon - _controlPoints[i].lon, _controlPoints[i+1].lat - _controlPoints[i].lat, 0);
430 | vecNear.normalize();
431 | osg::Vec3d vecNearVertical = osg::Vec3d(-vecNear.y(), vecNear.x(), 0);
432 | GVCoord bodyLeft, bodyRight;
433 | bodyLeft.lon = _controlPoints[i].lon + (arrowNeckWidthHalf + rate * offset) * vecNearVertical.x();
434 | bodyLeft.lat = _controlPoints[i].lat + (arrowNeckWidthHalf + rate * offset) * vecNearVertical.y();
435 | bodyRight.lon = _controlPoints[i].lon - (arrowNeckWidthHalf + rate * offset) * vecNearVertical.x();
436 | bodyRight.lat = _controlPoints[i].lat - (arrowNeckWidthHalf + rate * offset) * vecNearVertical.y();
437 | keyPointsLeft.push_back(bodyLeft);
438 | keyPointsRight.push_back(bodyRight);
439 | }
440 | keyPointsLeft.push_back(arrowTailLeft);
441 | keyPointsRight.push_back(arrowTailRight);
442 |
443 | double t = (_controlPoints[3].lon - _controlPoints[5].lon) * (_controlPoints[4].lat - _controlPoints[5].lat) - (_controlPoints[4].lon - _controlPoints[5].lon) * (_controlPoints[3].lat - _controlPoints[5].lat);
444 | if(t < 0)
445 | {
446 | keyPointsLeft[keyPointsLeft.size()-1] = arrowTailRight;
447 | keyPointsRight[keyPointsRight.size()-1] = arrowTailLeft;
448 | }
449 |
450 | bezier.getBezier(keyPointsLeft, &bezierPointsLeft);
451 | for (int i=bezierPointsLeft.size()-1; i>=0; i--)
452 | vtxBuffer.push_back(bezierPointsLeft[i]);
453 |
454 | double t1 = 0.0;
455 | for (; t1<=1; t1+=0.02)
456 | {
457 | double x = (1-t1) * bezierPointsLeft[0].lon + t1 * arrowEarLeft.lon;
458 | double y = (1-t1) * bezierPointsLeft[0].lat + t1 * arrowEarLeft.lat;
459 | vtxBuffer.push_back(GVCoord(x, y, 0.0));
460 | }
461 |
462 | vtxBuffer.push_back(arrowEarLeft);
463 |
464 | t1 = 0;
465 | for (; t1<=1; t1+=0.02)
466 | {
467 | double x = (1-t1) * arrowEarLeft.lon + t1 * arrowHead.lon;
468 | double y = (1-t1) * arrowEarLeft.lat + t1 * arrowHead.lat;
469 | vtxBuffer.push_back(GVCoord(x, y, 0.0));
470 | }
471 |
472 | vtxBuffer.push_back(arrowHead);
473 |
474 | t1 = 0;
475 | for (; t1<=1; t1+=0.02)
476 | {
477 | double x = (1-t1) * arrowHead.lon + t1 * arrowEarRight.lon;
478 | double y = (1-t1) * arrowHead.lat + t1 * arrowEarRight.lat;
479 | vtxBuffer.push_back(GVCoord(x, y, 0.0));
480 | }
481 |
482 | vtxBuffer.push_back(arrowEarRight);
483 |
484 | bezier.getBezier(keyPointsRight, &bezierPointsRight);
485 |
486 | t1 = 0;
487 | for (; t1<=1; t1+=0.02)
488 | {
489 | double x = (1-t1) * arrowEarRight.lon + t1 * bezierPointsRight[0].lon;
490 | double y = (1-t1) * arrowEarRight.lat + t1 * bezierPointsRight[0].lat;
491 | vtxBuffer.push_back(GVCoord(x, y, 0.0));
492 | }
493 |
494 | for(int i=0; ipush_back(vtxBuffer.size());
498 | }
499 |
500 | return true;
501 | }
502 |
503 | double GV00003::brokenLineDistance(int start, int end) const
504 | {
505 | double axisBrokenlineLength = 0;
506 | for(int i=start; i& vtxBuffer);
15 | GVCoord getControlPoint(int idx);
16 | void setControlPointsEx(std::vector& vtxBuffer);
17 | void setControlPoints(std::vector& vtxBuffer);
18 | void setControlPoint(int idx, const GVCoord& vtx);
19 | bool toVertice(std::vector& vtxBuffer, std::vector* vtxBuffer2);
20 | double brokenLineDistance(int start, int end) const;
21 |
22 | private:
23 | std::vector _controlPoints;
24 | double scale[4];
25 | };
26 |
27 | #endif //__GV00003_H__
--------------------------------------------------------------------------------
/GVAnnotations/GV00004.cpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "GV00004.h"
4 |
5 | GV00004::GV00004()
6 | {
7 |
8 | }
9 |
10 | GV00004::~GV00004()
11 | {
12 |
13 | }
14 |
15 | int GV00004::getControlPointCount()
16 | {
17 | return _controlPoints.size();
18 | }
19 |
20 | void GV00004::getControlPoints(std::vector& vtxBuffer)
21 | {
22 | if(_controlPoints.size() <= 0)
23 | return ;
24 | vtxBuffer = _controlPoints;
25 | }
26 |
27 | GVCoord GV00004::getControlPoint(int idx)
28 | {
29 | if(idx >= 0 && idx < _controlPoints.size())
30 | return _controlPoints[idx];
31 |
32 | return GVCoord();
33 | }
34 |
35 | void GV00004::setControlPointsEx(std::vector &vtxBuffer)
36 | {
37 | _controlPoints = vtxBuffer;
38 | }
39 |
40 | void GV00004::setControlPoints(std::vector& vtxBuffer)
41 | {
42 | if (vtxBuffer.size() == 1)
43 | {
44 | return;
45 | }
46 |
47 | if(vtxBuffer.size() > 1)
48 | {
49 | kidney.setKidNeyConreolPoints(_controlPoints, vtxBuffer);
50 | kidney.getKidNeyScales(_s);
51 | }
52 | }
53 |
54 | void GV00004::setControlPoint(int idx, const GVCoord& vtx)
55 | {
56 | int cpSize = _controlPoints.size();
57 | if(idx < 0 || idx >= cpSize)
58 | return ;
59 |
60 | kidney.setKidNeyConreolPoint(_controlPoints, idx, vtx, _s);
61 |
62 | }
63 |
64 | bool GV00004::toVertice(std::vector& vtxBuffer, std::vector* vtxBuffer2)
65 | {
66 | if(_controlPoints.size() >= 12)
67 | {
68 | kidney.drawKidNey(_controlPoints);
69 |
70 | vtxBuffer = kidney.tmpBuffer;
71 | vtxBuffer2->push_back(kidney.tmpBuffer2[0]);
72 | }
73 |
74 | return true;
75 | }
--------------------------------------------------------------------------------
/GVAnnotations/GV00004.h:
--------------------------------------------------------------------------------
1 | #ifndef __GV00004_H__
2 | #define __GV00004_H__
3 |
4 | #include "GVGeometry.h"
5 | #include "KidNey.h"
6 |
7 | class GV00004 : public GVGeometry
8 | {
9 | public:
10 | GV00004();
11 | ~GV00004();
12 |
13 | int getControlPointCount();
14 | void getControlPoints(std::vector& vtxBuffer);
15 | GVCoord getControlPoint(int idx);
16 | void setControlPointsEx(std::vector& vtxBuffer);
17 | void setControlPoints(std::vector& vtxBuffer);
18 | void setControlPoint(int idx, const GVCoord& vtx);
19 | bool toVertice(std::vector& vtxBuffer, std::vector* vtxBuffer2);
20 |
21 | private:
22 | std::vector _controlPoints;
23 | std::vector _s;
24 |
25 | KidNey kidney;
26 | };
27 |
28 | #endif //__GV00004_H__
--------------------------------------------------------------------------------
/GVAnnotations/GV00005.cpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "GV00005.h"
4 |
5 | static double getLen(GVCoord coord0, GVCoord coord1)
6 | {
7 | return sqrt(pow(coord1.lon - coord0.lon, 2) + pow(coord1.lat - coord0.lat, 2));
8 | }
9 |
10 | static double cal_angle(const GVCoord &start_point, const GVCoord &end_point)
11 | {
12 | double PI = osg::PI;
13 | double x01 = end_point.lon - start_point.lon;
14 | double y01 = end_point.lat - start_point.lat;
15 | double alpha;
16 |
17 | if(fabs(x01) <= 0.00001)
18 | {
19 | alpha = PI / 2.0;
20 | if(y01 < 0)
21 | alpha = -alpha + PI * 2.0;
22 | }
23 | else
24 | alpha = atan(y01 / x01);
25 |
26 | if(x01 < 0)
27 | alpha += PI;
28 | else if(y01 < 0)
29 | alpha += 2.0 * PI;
30 |
31 | return alpha;
32 | }
33 |
34 | GV00005::GV00005()
35 | {
36 |
37 | }
38 |
39 | GV00005::~GV00005()
40 | {
41 |
42 | }
43 |
44 | int GV00005::getControlPointCount()
45 | {
46 | std::vector controlPoints;
47 | getControlPoints(controlPoints);
48 | return controlPoints.size();
49 | }
50 |
51 | void GV00005::getControlPoints(std::vector& vtxBuffer)
52 | {
53 | if(_controlPoints.size() <= 0)
54 | return ;
55 | vtxBuffer = _controlPoints;
56 | }
57 |
58 | GVCoord GV00005::getControlPoint(int idx)
59 | {
60 | if(idx >= 0 && idx < _controlPoints.size())
61 | return _controlPoints[idx];
62 |
63 | return GVCoord();
64 | }
65 |
66 | void GV00005::setControlPointsEx(std::vector &vtxBuffer)
67 | {
68 | _controlPoints = vtxBuffer;
69 | }
70 |
71 | void GV00005::setControlPoints(std::vector& vtxBuffer)
72 | {
73 | _controlPoints = vtxBuffer;
74 | }
75 |
76 | void GV00005::setControlPoint(int idx, const GVCoord& vtx)
77 | {
78 | int cpSize = _controlPoints.size();
79 | if(idx < 0 || idx >= cpSize)
80 | return ;
81 | _controlPoints[idx] = vtx;
82 |
83 | }
84 |
85 | bool GV00005::toVertice(std::vector& vtxBuffer, std::vector* vtxBuffer2)
86 | {
87 | if(_controlPoints.size() < 2)
88 | return true;
89 |
90 | Bezier bezier;
91 | std::vector bezierPoints;
92 | bezier.getBezier(_controlPoints, &bezierPoints);
93 |
94 | vtxBuffer = bezierPoints;
95 | vtxBuffer2->push_back(bezierPoints.size());
96 |
97 | double length = 0.0;
98 |
99 | for(int i=0; i0; i--)
108 | {
109 | if (getLen(bezierPoints[i], bezierPoints[bezierPoints.size()-1]) > r)
110 | {
111 | position = i;
112 | break;
113 | }
114 | }
115 |
116 | double angle1 = cal_angle(bezierPoints[position], _controlPoints[_controlPoints.size()-1]);
117 | GVCoord arrowP0, arrowP1, arrowP2;
118 | arrowP0.lon = bezierPoints[position].lon + r * 0.2 * cos(angle1 + osg::PI/2);
119 | arrowP0.lat = bezierPoints[position].lat + r * 0.2 * sin(angle1 + osg::PI/2);
120 | arrowP1.lon = bezierPoints[position].lon + r * 0.2 * cos(angle1 - osg::PI/2);
121 | arrowP1.lat = bezierPoints[position].lat + r * 0.2 * sin(angle1 - osg::PI/2);
122 | arrowP2 = _controlPoints[_controlPoints.size()-1];
123 |
124 | vtxBuffer.push_back(arrowP0);
125 | vtxBuffer.push_back(arrowP1);
126 | vtxBuffer.push_back(arrowP2);
127 | vtxBuffer.push_back(arrowP0);
128 | vtxBuffer2->push_back(4);
129 |
130 | return true;
131 | }
--------------------------------------------------------------------------------
/GVAnnotations/GV00005.h:
--------------------------------------------------------------------------------
1 | #ifndef __GV00005_H__
2 | #define __GV00005_H__
3 |
4 | #include "GVGeometry.h"
5 | #include "Bezier.h"
6 |
7 | class GV00005 : public GVGeometry
8 | {
9 | public:
10 | GV00005();
11 | ~GV00005();
12 |
13 | int getControlPointCount();
14 | void getControlPoints(std::vector& vtxBuffer);
15 | GVCoord getControlPoint(int idx);
16 | void setControlPointsEx(std::vector& vtxBuffer);
17 | void setControlPoints(std::vector& vtxBuffer);
18 | void setControlPoint(int idx, const GVCoord& vtx);
19 | bool toVertice(std::vector& vtxBuffer, std::vector* vtxBuffer2);
20 |
21 | private:
22 | std::vector _controlPoints;
23 | };
24 |
25 | #endif //__GV00005_H__
--------------------------------------------------------------------------------
/GVAnnotations/GV00006.cpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "GV00006.h"
4 |
5 | static double getLen(GVCoord coord0, GVCoord coord1)
6 | {
7 | return sqrt(pow(coord1.lon - coord0.lon, 2) + pow(coord1.lat - coord0.lat, 2));
8 | }
9 |
10 | static double cal_angle(const GVCoord &start_point, const GVCoord &end_point)
11 | {
12 | double PI = osg::PI;
13 | double x01 = end_point.lon - start_point.lon;
14 | double y01 = end_point.lat - start_point.lat;
15 | double alpha;
16 |
17 | if(fabs(x01) <= 0.00001)
18 | {
19 | alpha = PI / 2.0;
20 | if(y01 < 0)
21 | alpha = -alpha + PI * 2.0;
22 | }
23 | else
24 | alpha = atan(y01 / x01);
25 |
26 | if(x01 < 0)
27 | alpha += PI;
28 | else if(y01 < 0)
29 | alpha += 2.0 * PI;
30 |
31 | return alpha;
32 | }
33 |
34 | GV00006::GV00006()
35 | {
36 | s0 = 0.5;
37 | }
38 |
39 | GV00006::~GV00006()
40 | {
41 |
42 | }
43 |
44 | int GV00006::getControlPointCount()
45 | {
46 | std::vector controlPoints;
47 | getControlPoints(controlPoints);
48 | return controlPoints.size();
49 | }
50 |
51 | void GV00006::getControlPoints(std::vector& vtxBuffer)
52 | {
53 | if(_controlPoints.size() <= 0)
54 | return ;
55 | vtxBuffer = _controlPoints;
56 | }
57 |
58 | GVCoord GV00006::getControlPoint(int idx)
59 | {
60 | if(idx >= 0 && idx < _controlPoints.size())
61 | return _controlPoints[idx];
62 |
63 | return GVCoord();
64 | }
65 |
66 | void GV00006::setControlPointsEx(std::vector &vtxBuffer)
67 | {
68 | cfcp.configControlPoints(vtxBuffer);
69 | _controlPoints = vtxBuffer;
70 | }
71 |
72 | void GV00006::setControlPoints(std::vector& vtxBuffer)
73 | {
74 | cfcp.configControlPoints(vtxBuffer);
75 |
76 | if (vtxBuffer.size() < 2)
77 | {
78 | return;
79 | }
80 |
81 | _controlPoints = vtxBuffer;
82 |
83 | std::vector bezierPoints;
84 | bezier.getBezier(_controlPoints, &bezierPoints);
85 |
86 | double len1 = 0.0;
87 | for (int i=1; i= (len1 * s0))
98 | {
99 | num = i;
100 | break;
101 | }
102 | }
103 | _controlPoints.push_back(bezierPoints[num]);
104 | }
105 |
106 | void GV00006::setControlPoint(int idx, const GVCoord& vtx)
107 | {
108 | int cpSize = _controlPoints.size();
109 | if(idx < 0 || idx >= cpSize)
110 | return ;
111 |
112 | GVCoord modify = vtx;
113 | cfcp.configControlPoints(modify, _controlPoints);
114 |
115 | if (idx >= 0 && idx <= _controlPoints.size()-2)
116 | {
117 | _controlPoints[idx] = modify;
118 |
119 | std::vector myControlPoints;
120 | for (int i=0; i<_controlPoints.size()-1; i++)
121 | {
122 | myControlPoints.push_back(_controlPoints[i]);
123 | }
124 |
125 | std::vector bezierPoints;
126 | bezier.getBezier(myControlPoints, &bezierPoints);
127 |
128 | double len1 = 0.0;
129 | for (int i=1; i= (len1 * s0))
140 | {
141 | num = i;
142 | break;
143 | }
144 | }
145 | _controlPoints[cpSize-1] = bezierPoints[num];
146 | }
147 |
148 | if (idx == _controlPoints.size()-1)
149 | {
150 | std::vector myControlPoints;
151 | for (int i=0; i<_controlPoints.size()-1; i++)
152 | {
153 | myControlPoints.push_back(_controlPoints[i]);
154 | }
155 |
156 | std::vector tempBezierPoints;
157 | bezier.getBezier(myControlPoints, &tempBezierPoints);
158 |
159 | double length = 0.0;
160 | for (int k=1; k& vtxBuffer, std::vector* vtxBuffer2)
188 | {
189 | if(_controlPoints.size() < 3)
190 | return true;
191 |
192 | std::vector bezierPoints;
193 | std::vector myControlPoints;
194 |
195 | for (int i=0; i<_controlPoints.size()-1; i++)
196 | {
197 | myControlPoints.push_back(_controlPoints[i]);
198 | }
199 |
200 | bezier.getBezier(myControlPoints, &bezierPoints);
201 |
202 | double length = 0.0;
203 |
204 | for(int i=0; i r)
226 | {
227 | end = i;
228 | break;
229 | }
230 | }
231 |
232 | for (int i=0; i<=start; i++)
233 | {
234 | vtxBuffer.push_back(bezierPoints[i]);
235 | }
236 | vtxBuffer2->push_back(start+1);
237 |
238 | double angle2 = cal_angle(bezierPoints[start], bezierPoints[end]);
239 | double distance = getLen(bezierPoints[start], bezierPoints[end]);
240 | GVCoord p0, p1, p2, p3, p4;
241 | p0.lon = bezierPoints[start].lon + distance * 0.35 * cos(angle2 + osg::PI/2);
242 | p0.lat = bezierPoints[start].lat + distance * 0.35 * sin(angle2 + osg::PI/2);
243 | p1.lon = bezierPoints[start].lon + distance * 0.15 * cos(angle2 - osg::PI/2);
244 | p1.lat = bezierPoints[start].lat + distance * 0.15 * sin(angle2 - osg::PI/2);
245 | p2.lon = p1.lon + distance * cos(angle2);
246 | p2.lat = p1.lat + distance * sin(angle2);
247 | p3.lon = p2.lon + distance * 0.25 * cos(angle2 + osg::PI/2);
248 | p3.lat = p2.lat + distance * 0.25 * sin(angle2 + osg::PI/2);
249 | p4.lon = p0.lon + distance * 0.7 * cos(angle2);
250 | p4.lat = p0.lat + distance * 0.7 * sin(angle2);
251 |
252 | vtxBuffer.push_back(p0);
253 | vtxBuffer.push_back(p1);
254 | vtxBuffer.push_back(p2);
255 | vtxBuffer.push_back(p3);
256 | vtxBuffer.push_back(p4);
257 | vtxBuffer.push_back(p0);
258 | vtxBuffer2->push_back(6);
259 |
260 | int position = bezierPoints.size();
261 | for(int i=bezierPoints.size()-1; i>0; i--)
262 | {
263 | if (getLen(bezierPoints[i], bezierPoints[bezierPoints.size()-1]) > r)
264 | {
265 | position = i;
266 | break;
267 | }
268 | }
269 |
270 | double angle1 = cal_angle(bezierPoints[position], _controlPoints[_controlPoints.size()-2]);
271 | GVCoord arrowP0, arrowP1, arrowP2;
272 | arrowP0.lon = bezierPoints[position].lon + r * 0.2 * cos(angle1 + osg::PI/2);
273 | arrowP0.lat = bezierPoints[position].lat + r * 0.2 * sin(angle1 + osg::PI/2);
274 | arrowP1.lon = bezierPoints[position].lon + r * 0.2 * cos(angle1 - osg::PI/2);
275 | arrowP1.lat = bezierPoints[position].lat + r * 0.2 * sin(angle1 - osg::PI/2);
276 | arrowP2 = _controlPoints[_controlPoints.size()-2];
277 |
278 | vtxBuffer.push_back(arrowP0);
279 | vtxBuffer.push_back(arrowP1);
280 | vtxBuffer.push_back(arrowP2);
281 | vtxBuffer.push_back(arrowP0);
282 | vtxBuffer2->push_back(4);
283 |
284 | for (int i=end; i<=position; i++)
285 | {
286 | vtxBuffer.push_back(bezierPoints[i]);
287 | }
288 | vtxBuffer2->push_back(position-end+1);
289 |
290 | return true;
291 | }
--------------------------------------------------------------------------------
/GVAnnotations/GV00006.h:
--------------------------------------------------------------------------------
1 | #ifndef __GV00006_H__
2 | #define __GV00006_H__
3 |
4 | #include "GVGeometry.h"
5 | #include "Bezier.h"
6 | #include "ConfigControlPoints.h"
7 |
8 | class GV00006 : public GVGeometry
9 | {
10 | public:
11 | GV00006();
12 | ~GV00006();
13 |
14 | int getControlPointCount();
15 | void getControlPoints(std::vector& vtxBuffer);
16 | GVCoord getControlPoint(int idx);
17 | void setControlPointsEx(std::vector& vtxBuffer);
18 | void setControlPoints(std::vector& vtxBuffer);
19 | void setControlPoint(int idx, const GVCoord& vtx);
20 | bool toVertice(std::vector& vtxBuffer, std::vector* vtxBuffer2);
21 |
22 | private:
23 | std::vector _controlPoints;
24 | double s0;
25 |
26 | Bezier bezier;
27 | ConfigControlPoints cfcp;
28 | };
29 |
30 | #endif //__GV00006_H__
--------------------------------------------------------------------------------
/GVAnnotations/GV00007.cpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "GV00007.h"
4 |
5 | static double getLen(GVCoord coord0, GVCoord coord1)
6 | {
7 | return sqrt(pow(coord1.lon - coord0.lon, 2) + pow(coord1.lat - coord0.lat, 2));
8 | }
9 |
10 | GV00007::GV00007()
11 | {
12 |
13 | }
14 |
15 | GV00007::~GV00007()
16 | {
17 |
18 | }
19 |
20 | int GV00007::getControlPointCount()
21 | {
22 | std::vector controlPoints;
23 | getControlPoints(controlPoints);
24 | return controlPoints.size();
25 | }
26 |
27 | void GV00007::getControlPoints(std::vector& vtxBuffer)
28 | {
29 | if(_controlPoints.size() <= 0)
30 | return ;
31 | vtxBuffer = _controlPoints;
32 | }
33 |
34 | GVCoord GV00007::getControlPoint(int idx)
35 | {
36 | if(idx >= 0 && idx < _controlPoints.size())
37 | return _controlPoints[idx];
38 |
39 | return GVCoord();
40 | }
41 |
42 | void GV00007::setControlPointsEx(std::vector &vtxBuffer)
43 | {
44 | cfcp.configControlPoints(vtxBuffer);
45 | _controlPoints = vtxBuffer;
46 | }
47 |
48 | void GV00007::setControlPoints(std::vector& vtxBuffer)
49 | {
50 | cfcp.configControlPoints(vtxBuffer);
51 |
52 | if(vtxBuffer.size() > 1)
53 | {
54 | _controlPoints.clear();
55 | _controlPoints.push_back(vtxBuffer[0]);
56 | _controlPoints.push_back(vtxBuffer[1]);
57 |
58 | double scale1 = 0.1;
59 | double length = getLen(_controlPoints[0], _controlPoints[1]);
60 | double width = scale1 * length;
61 |
62 | double dx = (_controlPoints[0].lat - _controlPoints[1].lat) / length;
63 | double dy = (_controlPoints[1].lon - _controlPoints[0].lon) / length;
64 |
65 | GVCoord coord;
66 | coord.lon = _controlPoints[0].lon + dx * width;
67 | coord.lat = _controlPoints[0].lat + dy * width;
68 | _controlPoints.push_back(coord);
69 | }
70 | }
71 |
72 | void GV00007::setControlPoint(int idx, const GVCoord& vtx)
73 | {
74 | int cpSize = _controlPoints.size();
75 | if(idx < 0 || idx >= cpSize)
76 | return ;
77 |
78 | GVCoord vtx2 = vtx;
79 | cfcp.configControlPoints(vtx2, _controlPoints);
80 |
81 | if (idx == 0 || idx == 1)
82 | {
83 | double width = getLen(_controlPoints[0], _controlPoints[2]);
84 | _controlPoints[idx] = vtx2;
85 | double length = getLen(_controlPoints[0], _controlPoints[1]);
86 | double dx = (_controlPoints[0].lat - _controlPoints[1].lat) / length;
87 | double dy = (_controlPoints[1].lon - _controlPoints[0].lon) / length;
88 |
89 | _controlPoints[2].lon = _controlPoints[0].lon + width * dx;
90 | _controlPoints[2].lat = _controlPoints[0].lat + width * dy;
91 | }
92 |
93 | if (idx == 2)
94 | {
95 | double l = getLen(vtx2, _controlPoints[0]);
96 | double dx1 = (vtx2.lon - _controlPoints[0].lon) / l;
97 | double dy1 = (vtx2.lat - _controlPoints[0].lat) / l;
98 |
99 | double length = getLen(_controlPoints[0], _controlPoints[1]);
100 | double dx2 = (_controlPoints[0].lat - _controlPoints[1].lat) / length;
101 | double dy2 = (_controlPoints[1].lon - _controlPoints[0].lon) / length;
102 |
103 | double _cos = dx1 * dx2 + dy1 * dy2;
104 | double len = l * _cos;
105 | if (2 * len > length)
106 | {
107 | len = length / 2.0;
108 | }
109 |
110 | if (vtx2.lat > _controlPoints[0].lat)
111 | {
112 | _controlPoints[2].lon = _controlPoints[0].lon + len * dx2;
113 | _controlPoints[2].lat = _controlPoints[0].lat + len * dy2;
114 | }
115 | else
116 | {
117 | _controlPoints[2].lon = _controlPoints[0].lon - len * dx2;
118 | _controlPoints[2].lat = _controlPoints[0].lat - len * dy2;
119 | }
120 | }
121 | }
122 |
123 | bool GV00007::toVertice(std::vector& vtxBuffer, std::vector* vtxBuffer2)
124 | {
125 | if (_controlPoints.size() > 2)
126 | {
127 | double length = getLen(_controlPoints[0], _controlPoints[1]);
128 | double width = getLen(_controlPoints[0], _controlPoints[2]);
129 |
130 | double dx1 = (_controlPoints[1].lon - _controlPoints[0].lon) / length;
131 | double dy1 = (_controlPoints[1].lat - _controlPoints[0].lat) / length;
132 | double dx2 = (_controlPoints[2].lon - _controlPoints[0].lon) / width;
133 | double dy2 = (_controlPoints[2].lat - _controlPoints[0].lat) / width;
134 |
135 | double xx = _controlPoints[1].lon + (_controlPoints[2].lon - _controlPoints[0].lon);
136 | double yy = _controlPoints[1].lat + (_controlPoints[2].lat - _controlPoints[0].lat);
137 | GVCoord coord1 = GVCoord(xx, yy, 0.0);
138 | vtxBuffer.push_back(_controlPoints[2]);
139 | vtxBuffer.push_back(coord1);
140 | vtxBuffer2->push_back(2);
141 |
142 | xx = _controlPoints[0].lon * 2 - _controlPoints[2].lon;
143 | yy = _controlPoints[0].lat * 2 - _controlPoints[2].lat;
144 | GVCoord coord2 = GVCoord(xx, yy, 0.0);
145 | vtxBuffer.push_back(coord2);
146 | xx = coord1.lon + (coord2.lon - _controlPoints[2].lon);
147 | yy = coord1.lat + (coord2.lat - _controlPoints[2].lat);
148 | vtxBuffer.push_back(GVCoord(xx, yy, 0.0));
149 | vtxBuffer2->push_back(2);
150 |
151 |
152 | double scale1 = 0.2;
153 | double scale2 = 0.05;
154 | double scale3 = 2.0 / 3;
155 |
156 | GVCoord tempPoint0, tempPoint1;
157 | if (_controlPoints[0].lon <= _controlPoints[1].lon)
158 | {
159 | tempPoint0 = _controlPoints[0];
160 | tempPoint1 = _controlPoints[1];
161 | }
162 | else
163 | {
164 | tempPoint0 = _controlPoints[1];
165 | tempPoint1 = _controlPoints[0];
166 | dx1 = (tempPoint1.lon - tempPoint0.lon) / length;
167 | dy1 = (tempPoint1.lat - tempPoint0.lat) / length;
168 | dx2 = -(_controlPoints[2].lon - _controlPoints[0].lon) / width;
169 | dy2 = -(_controlPoints[2].lat - _controlPoints[0].lat) / width;
170 | }
171 |
172 | GVCoord point1, point2, point3;
173 | point2.lon = tempPoint0.lon + scale1 * length * dx1;
174 | point2.lat = tempPoint0.lat + scale1 * length * dy1;
175 | double l = scale3 * width / 2.0;
176 | point1.lon = point2.lon + l * dx1 + l * dx2;
177 | point1.lat = point2.lat + l * dy1 + l * dy2;
178 | point3.lon = point2.lon + l * dx1 - l * dx2;
179 | point3.lat = point2.lat + l * dy1 - l * dy2;
180 | vtxBuffer.push_back(point1);
181 | vtxBuffer.push_back(point2);
182 | vtxBuffer.push_back(point3);
183 | vtxBuffer2->push_back(3);
184 |
185 | point2.lon = tempPoint0.lon + (scale1 + scale2) * length * dx1;
186 | point2.lat = tempPoint0.lat + (scale1 + scale2) * length * dy1;
187 | point1.lon = point2.lon + l * dx1 + l * dx2;
188 | point1.lat = point2.lat + l * dy1 + l * dy2;
189 | point3.lon = point2.lon + l * dx1 - l * dx2;
190 | point3.lat = point2.lat + l * dy1 - l * dy2;
191 | vtxBuffer.push_back(point1);
192 | vtxBuffer.push_back(point2);
193 | vtxBuffer.push_back(point3);
194 | vtxBuffer2->push_back(3);
195 |
196 | point2.lon = tempPoint1.lon - ((scale1 + scale2) * length + l) * dx1;
197 | point2.lat = tempPoint1.lat - ((scale1 + scale2) * length + l) * dy1;
198 | point1.lon = point2.lon + l * dx1 + l * dx2;
199 | point1.lat = point2.lat + l * dy1 + l * dy2;
200 | point3.lon = point2.lon + l * dx1 - l * dx2;
201 | point3.lat = point2.lat + l * dy1 - l * dy2;
202 | vtxBuffer.push_back(point1);
203 | vtxBuffer.push_back(point2);
204 | vtxBuffer.push_back(point3);
205 | vtxBuffer2->push_back(3);
206 |
207 | point2.lon = tempPoint1.lon - (scale1 * length + l) * dx1;
208 | point2.lat = tempPoint1.lat - (scale1 * length + l) * dy1;
209 | point1.lon = point2.lon + l * dx1 + l * dx2;
210 | point1.lat = point2.lat + l * dy1 + l * dy2;
211 | point3.lon = point2.lon + l * dx1 - l * dx2;
212 | point3.lat = point2.lat + l * dy1 - l * dy2;
213 | vtxBuffer.push_back(point1);
214 | vtxBuffer.push_back(point2);
215 | vtxBuffer.push_back(point3);
216 | vtxBuffer2->push_back(3);
217 | }
218 |
219 | return true;
220 | }
--------------------------------------------------------------------------------
/GVAnnotations/GV00007.h:
--------------------------------------------------------------------------------
1 | #ifndef __GV00007_H__
2 | #define __GV00007_H__
3 |
4 | #include "GVGeometry.h"
5 | #include "ConfigControlPoints.h"
6 |
7 | class GV00007 : public GVGeometry
8 | {
9 | public:
10 | GV00007();
11 | ~GV00007();
12 |
13 | int getControlPointCount();
14 | void getControlPoints(std::vector& vtxBuffer);
15 | GVCoord getControlPoint(int idx);
16 | void setControlPointsEx(std::vector& vtxBuffer);
17 | void setControlPoints(std::vector& vtxBuffer);
18 | void setControlPoint(int idx, const GVCoord& vtx);
19 | bool toVertice(std::vector& vtxBuffer, std::vector* vtxBuffer2);
20 |
21 | private:
22 | std::vector _controlPoints;
23 |
24 | ConfigControlPoints cfcp;
25 | };
26 |
27 | #endif //__GV00007_H__
--------------------------------------------------------------------------------
/GVAnnotations/GVAnnotation.cpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "GVAnnotations.h"
4 |
5 | using namespace osgEarth;
6 | using namespace osgEarth::Annotation;
7 | using namespace osgEarth::Features;
8 | using namespace osgEarth::Util;
9 | using namespace osgEarth::Util::Controls;
10 |
11 | GVAnnotations::GVAnnotations(osgViewer::Viewer* viewer, osg::Group* root, osgEarth::MapNode* mapNode, osg::Group* annoGroup, osg::Group* editGroup)
12 | {
13 | mViewer = viewer;
14 | mRoot = root;
15 | mMapNode = mapNode;
16 | mAnnoGroup = annoGroup;
17 | mEditGroup = editGroup;
18 |
19 | ush = new UseEventHandler(mMapNode, mAnnoGroup, mEditGroup, mViewer);
20 | mViewer->addEventHandler(ush);
21 | }
22 |
23 | GVAnnotations::~GVAnnotations()
24 | {
25 |
26 | }
27 |
28 | void GVAnnotations::initGeom(int key)
29 | {
30 | switch(key)
31 | {
32 | case 1:
33 | line = new GV00001();
34 | ush->setIsStartAnno(true);
35 | ush->setIsNew(true);
36 | ush->setLineGeometry(line);
37 | break;
38 | case 2:
39 | line = new GV00002();
40 | ush->setIsStartAnno(true);
41 | ush->setIsNew(true);
42 | ush->setLineGeometry(line);
43 | break;
44 | case 3:
45 | line = new GV00003();
46 | ush->setIsStartAnno(true);
47 | ush->setIsNew(true);
48 | ush->setLineGeometry(line);
49 | break;
50 | case 4:
51 | line = new GV00004();
52 | ush->setIsStartAnno(true);
53 | ush->setIsNew(true);
54 | ush->setLineGeometry(line);
55 | break;
56 | case 5:
57 | line = new GV00005();
58 | ush->setIsStartAnno(true);
59 | ush->setIsNew(true);
60 | ush->setLineGeometry(line);
61 | break;
62 | case 6:
63 | line = new GV00006();
64 | ush->setIsStartAnno(true);
65 | ush->setIsNew(true);
66 | ush->setLineGeometry(line);
67 | break;
68 | case 7:
69 | line = new GV00007();
70 | ush->setIsStartAnno(true);
71 | ush->setIsNew(true);
72 | ush->setLineGeometry(line);
73 | break;
74 | }
75 | }
--------------------------------------------------------------------------------
/GVAnnotations/GVAnnotations.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include
11 | #include
12 | #include
13 | #include
14 | #include
15 | #include
16 | #include
17 | #include
18 | #include
19 | #include
20 | #include
21 | #include
22 | #include
23 | #include
24 | #include
25 | #include
26 | #include
27 | #include
28 | #include
29 |
30 | #include
31 | #include
32 | #include
33 | #include
34 | #include
35 | #include
36 |
37 | #include "GVCoord.h"
38 | #include "GVGeometry.h"
39 | #include "GV00001.h"
40 | #include "GV00002.h"
41 | #include "GV00003.h"
42 | #include "GV00004.h"
43 | #include "GV00005.h"
44 | #include "GV00006.h"
45 | #include "GV00007.h"
46 | #include "UseEventHandler.h"
47 |
48 | #ifdef GVANNOTATIONS_EXPORTS
49 | #define GVANNOTATIONS_API __declspec(dllexport)
50 | #else
51 | #define GVANNOTATIONS_API __declspec(dllimport)
52 | #endif
53 |
54 | class GVANNOTATIONS_API GVAnnotations
55 | {
56 | public:
57 | GVAnnotations(osgViewer::Viewer* viewer, osg::Group* root, osgEarth::MapNode* mapNode, osg::Group* annoGroup, osg::Group* editGroup);
58 | ~GVAnnotations();
59 |
60 | void initGeom(int key);
61 |
62 | private:
63 | osg::ref_ptr mRoot;
64 | osg::ref_ptr mAnnoGroup;
65 | osg::ref_ptr mEditGroup;
66 | osg::ref_ptr mMapNode;
67 | osg::ref_ptr mViewer;
68 |
69 | GVGeometry* line;
70 | UseEventHandler* ush;
71 | };
--------------------------------------------------------------------------------
/GVAnnotations/GVAnnotations.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | Win32
7 |
8 |
9 | Release
10 | Win32
11 |
12 |
13 |
14 | {1A6373C2-A376-4F35-BC3D-9634A260E5A2}
15 | Win32Proj
16 | GVAnnotations
17 |
18 |
19 |
20 | DynamicLibrary
21 | true
22 | Unicode
23 |
24 |
25 | DynamicLibrary
26 | false
27 | true
28 | Unicode
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 | true
42 |
43 |
44 | false
45 |
46 |
47 |
48 |
49 |
50 | Level3
51 | Disabled
52 | WIN32;_DEBUG;_WINDOWS;_USRDLL;GVANNOTATIONS_EXPORTS;%(PreprocessorDefinitions)
53 |
54 |
55 | Windows
56 | true
57 |
58 |
59 |
60 |
61 | Level3
62 |
63 |
64 | Disabled
65 | true
66 | true
67 | WIN32;NDEBUG;_WINDOWS;_USRDLL;GVANNOTATIONS_EXPORTS;%(PreprocessorDefinitions)
68 | E:\OpenSceneGraph_x86\include;E:\OSGEARTH\include;
69 |
70 |
71 | Windows
72 | true
73 | true
74 | true
75 | E:\3rdParty\x86\lib;E:\OSGEARTH\lib;E:\OpenSceneGraph_x86\lib;
76 | d3d9.lib;freetype2311MT.lib;gdal_i.lib;geos.lib;geos_c_i.lib;giflib.lib;glut32.lib;jpeg.lib;libboost_filesystem-vc100-mt.lib;libboost_system-vc100-mt.lib;libcollada14dom21.lib;libcurl.lib;libpng.lib;libtiff_i.lib;libxml2.lib;minizip.lib;nvtt.lib;pcre.lib;pcrecpp.lib;squish.lib;OpenThreads.lib;osg.lib;osgAnimation.lib;osgDB.lib;osgFX.lib;osgGA.lib;osgManipulator.lib;osgParticle.lib;osgPresentation.lib;osgShadow.lib;osgSim.lib;osgTerrain.lib;osgText.lib;osgUI.lib;osgUtil.lib;osgViewer.lib;osgVolume.lib;osgWidget.lib;osgEarth.lib;osgEarthAnnotation.lib;osgEarthFeatures.lib;osgEarthSymbology.lib;osgEarthUtil.lib;%(AdditionalDependencies)
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
--------------------------------------------------------------------------------
/GVAnnotations/GVAnnotations.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 | {2f44292a-30d9-4317-b93b-46c47e92c8af}
18 |
19 |
20 | {70e10b42-2bff-4a0f-8d09-41ff1a5d943b}
21 |
22 |
23 | {d71bc794-3b09-4db9-95f3-27520749f335}
24 |
25 |
26 | {4925e1d6-eeb6-4c0d-87a8-9475bc13dd6a}
27 |
28 |
29 |
30 |
31 | Header Files
32 |
33 |
34 | Header Files
35 |
36 |
37 | Header Files
38 |
39 |
40 | Header Files
41 |
42 |
43 | Header Files
44 |
45 |
46 | Header Files
47 |
48 |
49 | Header Files
50 |
51 |
52 | Header Files\Geometry
53 |
54 |
55 | Header Files\Geometry
56 |
57 |
58 | Header Files\Geometry
59 |
60 |
61 | Header Files\Geometry
62 |
63 |
64 | Header Files\Geometry
65 |
66 |
67 | Header Files\Geometry
68 |
69 |
70 | Header Files\Geometry
71 |
72 |
73 | Header Files\Geometry
74 |
75 |
76 | Header Files\Config
77 |
78 |
79 | Header Files\Geometry
80 |
81 |
82 |
83 |
84 | Source Files
85 |
86 |
87 | Source Files
88 |
89 |
90 | Source Files
91 |
92 |
93 | Source Files
94 |
95 |
96 | Source Files
97 |
98 |
99 | Source Files
100 |
101 |
102 | Source Files\Geometry
103 |
104 |
105 | Source Files\Geometry
106 |
107 |
108 | Source Files\Geometry
109 |
110 |
111 | Source Files\Geometry
112 |
113 |
114 | Source Files\Geometry
115 |
116 |
117 | Source Files\Geometry
118 |
119 |
120 | Source Files\Geometry
121 |
122 |
123 | Source Files\Geometry
124 |
125 |
126 | Source Files\Config
127 |
128 |
129 | Source Files\Geometry
130 |
131 |
132 |
--------------------------------------------------------------------------------
/GVAnnotations/GVAnnotations.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/GVAnnotations/GVCoord.cpp:
--------------------------------------------------------------------------------
1 | #include "GVCoord.h"
2 |
3 | GVCoord::GVCoord()
4 | {
5 | lat = 39.9;
6 | lon = 116.3;
7 | alt = 1000.0;
8 | }
9 |
10 | GVCoord::GVCoord(double lon, double lat, double alt)
11 | {
12 | this->lon = lon;
13 | this->lat = lat;
14 | this->alt = alt;
15 | }
16 |
17 | bool GVCoord::equal(const GVCoord &c) const
18 | {
19 | return c.lat == lat && c.lon == lon && c.alt == alt;
20 | }
21 |
22 | bool GVCoord::vaild() const
23 | {
24 | if(lat > 90.0 || lat < -90.0)
25 | return false;
26 |
27 | return true;
28 | }
29 |
30 | GVCoord GVCoord::operator+(const GVCoord &coord) const
31 | {
32 | double nlon = lon + coord.lon;
33 | double nlat = lat + coord.lat;
34 | double nalt = alt + coord.alt;
35 | while(nlon > 180.0)
36 | nlon -= 360.0;
37 | while(nlon < -180)
38 | nlon += 360.0;
39 |
40 | return GVCoord(nlon, nlat,nalt);
41 |
42 | }
--------------------------------------------------------------------------------
/GVAnnotations/GVCoord.h:
--------------------------------------------------------------------------------
1 | #ifndef __GVCOORD_H__
2 | #define __GVCOORD_H__
3 |
4 | struct GVCoord
5 | {
6 | double lon;
7 | double lat;
8 | double alt;
9 |
10 | GVCoord();
11 | GVCoord(double lon, double lat, double alt);
12 | bool equal(const GVCoord &c) const;
13 | bool vaild() const;
14 | GVCoord operator+(const GVCoord & coord) const;
15 | };
16 |
17 | #endif // __GVCOORD_H__
--------------------------------------------------------------------------------
/GVAnnotations/GVGeometry.h:
--------------------------------------------------------------------------------
1 | #ifndef __GVGEOMETRY_H__
2 | #define __GVGEOMETRY_H__
3 |
4 | #include "GVCoord.h"
5 | #include
6 | #include
7 |
8 | class GVGeometry
9 | {
10 | public:
11 | virtual int getControlPointCount() = 0;
12 | virtual void getControlPoints(std::vector& vtxBuffer) = 0;
13 | virtual GVCoord getControlPoint(int idx) = 0;
14 | virtual void setControlPointsEx(std::vector &vtxBuffer) = 0;
15 | virtual void setControlPoints(std::vector& vtxBuffer) = 0;
16 | virtual void setControlPoint(int idx, const GVCoord& vtx) = 0;
17 | virtual bool toVertice(std::vector& vtxBuffer, std::vector* vtxBuffer2) = 0;
18 | };
19 |
20 | #endif //__GVGEOMETRY_H__
--------------------------------------------------------------------------------
/GVAnnotations/GVLineCreator.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zengjunyu/osgEarth_Annotation/194a05a6aecbcebc756dfc4f144fbe699cbc1f3d/GVAnnotations/GVLineCreator.cpp
--------------------------------------------------------------------------------
/GVAnnotations/GVLineCreator.h:
--------------------------------------------------------------------------------
1 | #ifndef __GV_LINE_CREATOR_H__
2 | #define __GV_LINE_CREATOR_H__
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include "GVCoord.h"
11 |
12 | class GVLineCreator
13 | {
14 | public:
15 | GVLineCreator();
16 | ~GVLineCreator();
17 |
18 | bool getGeoPosition(const osgGA::GUIEventAdapter& ea, osgViewer::View* view, GVCoord &coord, osgEarth::MapNode* mapNode) const;
19 | bool getGeoPosition(osgViewer::View *view, double mouseX, double mouseY, GVCoord &coord, osgEarth::MapNode* mapNode)const;
20 |
21 | bool handle(const osgGA::GUIEventAdapter& ea, osgViewer::View* view, osgEarth::MapNode* mapNode);
22 | bool stepCreate(const GVCoord &coord, bool finish, osgEarth::MapNode* mapNode);
23 | bool addGeometryPoint(const GVCoord &coord, osgEarth::MapNode* mapNode);
24 | void completeCreate();
25 |
26 | std::vector _curCoords;
27 | osg::ref_ptr _controlPointShow;
28 |
29 | };
30 |
31 | #endif //__GV_LINE_CREATOR_H__
32 |
--------------------------------------------------------------------------------
/GVAnnotations/KidNey.cpp:
--------------------------------------------------------------------------------
1 | #include "KidNey.h"
2 |
3 | void KidNey::setKidNeyConreolPoints(std::vector &controlpoints, static std::vector vtxBuffer)
4 | {
5 | if(vtxBuffer.size() <= 3){
6 | controlpoints = vtxBuffer;
7 | }
8 | else
9 | {
10 | controlpoints.push_back(vtxBuffer[0]);
11 | controlpoints.push_back(vtxBuffer[1]);
12 | controlpoints.push_back(vtxBuffer[2]);
13 | }
14 |
15 | int count = controlpoints.size();
16 |
17 | if (count >= 2)
18 | {
19 | double point1x = controlpoints[0].lon;
20 | double point1y = controlpoints[0].lat;
21 | double point2x = controlpoints[1].lon;
22 | double point2y = controlpoints[1].lat;
23 | double point3x, point3y;
24 | double pointx = (point2x - point1x) / 2.0;
25 | double pointy = (point2y - point1y) / 2.0;
26 | double point4x = -pointy;
27 | double point4y = pointx;
28 | double dir_t = 1.0;
29 |
30 | if(count == 2)
31 | {
32 | point3x = point1x + pointx + point4x * 1.7;
33 | point3y = point1y + pointy + point4y * 1.7;
34 | controlpoints.push_back(GVCoord(point3x, point3y, 0));
35 | }
36 | else
37 | {
38 | point3x = controlpoints[2].lon;
39 | point3y = controlpoints[2].lat;
40 | }
41 | double allL = sqrt(pow(pointx * 2, 2) + pow(pointy * 2, 2));
42 | double allh = sqrt(pow((point3x - point1x), 2) + pow((point3y - point1y), 2) - pow(((point3x - point1x) * (point2x - point1x) + (point3y - point1y) * (point2y - point1y)) / allL, 2));
43 | double mozhi1 = ((point3x - point1x) * (point2x - point1x) + (point3y - point1y) * (point2y - point1y)) / allL;
44 |
45 | if(mozhi1 > 0.8 * allL)
46 | {
47 | mozhi1 = 0.8 * allL;
48 | }
49 | else if(mozhi1 < 0.2 * allL)
50 | {
51 | mozhi1 = 0.2 * allL;
52 | }
53 |
54 | if(allh > 1.15 * allL)
55 | {
56 | allh = 1.15 * allL;
57 | }
58 | else if(allh < 0.2 * allL)
59 | {
60 | allh = 0.2 * allL;
61 | }
62 |
63 | if((point3x - point1x) * point4x + (point3y - point1y) *point4y > 0)
64 | {
65 | point3x = point1x + mozhi1 * pointx / sqrt(pow(pointx, 2) + pow(pointy, 2)) + allh * point4x / sqrt(pow(point4x, 2) + pow(point4y, 2));
66 | point3y = point1y + mozhi1 * pointy / sqrt(pow(pointx, 2) + pow(pointy, 2)) + allh * point4y / sqrt(pow(point4x, 2) + pow(point4y, 2));
67 | }
68 | else
69 | {
70 | point3x = point1x + mozhi1 * pointx / sqrt(pow(pointx, 2) + pow(pointy, 2)) - allh * point4x / sqrt(pow(point4x, 2) + pow(point4y, 2));
71 | point3y = point1y + mozhi1 * pointy / sqrt(pow(pointx, 2) + pow(pointy, 2)) - allh * point4y / sqrt(pow(point4x, 2) + pow(point4y, 2));
72 | }
73 | controlpoints[2] = GVCoord(point3x, point3y, 0);
74 |
75 | double bx[9], by[9];
76 |
77 | double length = sqrt(pointx * pointx + pointy * pointy);
78 | pointx = pointx / length;
79 | pointy = pointy / length;
80 | point4x = point4x / length;
81 | point4y = point4y / length;
82 |
83 | if(point4x * (controlpoints[2].lon - controlpoints[0].lon) + point4y * (controlpoints[2].lat - controlpoints[0].lat) < 0)
84 | {
85 | point4x = -point4x;
86 | point4y = -point4y;
87 | dir_t = -1.0;
88 | }
89 |
90 | scaleBuffer.clear();
91 | scaleBuffer.push_back((0.15 + 0.62) / 2.0);
92 | scaleBuffer.push_back((0.022 + 0.205) / 2.0);
93 | scaleBuffer.push_back((0.59 + 0.89) / 2.0);
94 | scaleBuffer.push_back((0.06 + 0.595) / 2.0);
95 | scaleBuffer.push_back((0.055 + 0.239) / 2.0);
96 | scaleBuffer.push_back((0.111 + 0.444) / 2.0);
97 | scaleBuffer.push_back((0.044 + 0.222) / 2.0);
98 | scaleBuffer.push_back((0.094 + 0.411) / 2.0);
99 | scaleBuffer.push_back((0.15 + 0.455) / 2.0);
100 |
101 | bx[2] = controlpoints[0].lon + 0.4 * point4x * allh - (scaleBuffer[2] - 0.5) * allL * pointx;
102 | by[2] = controlpoints[0].lat + 0.4 * point4y * allh - (scaleBuffer[2] - 0.5) * allL * pointy;
103 | bx[1] = controlpoints[0].lon + scaleBuffer[1] * allL * point4x + 0.5 * allL * pointx;
104 | by[1] = controlpoints[0].lat + scaleBuffer[1] * allL * point4y + 0.5 * allL * pointy;
105 | bx[8] = bx[1] - scaleBuffer[8] * allL * pointx;
106 | by[8] = by[1] - scaleBuffer[8] * allL * pointy;
107 | bx[4] = bx[2] - scaleBuffer[4] * allL * point4x;
108 | by[4] = by[2] - scaleBuffer[4] * allL * point4y;
109 | bx[5] = bx[2] + scaleBuffer[5] * allL * point4x;
110 | by[5] = by[2] + scaleBuffer[5] * allL * point4y;
111 | bx[0] = controlpoints[2].lon - scaleBuffer[0] * allL * pointx * dir_t;
112 | by[0] = controlpoints[2].lat - scaleBuffer[0] * allL * pointy * dir_t;
113 | bx[3] = controlpoints[2].lon + scaleBuffer[3] * allL * pointx * dir_t;
114 | by[3] = controlpoints[2].lat + scaleBuffer[3] * allL * pointy * dir_t;
115 |
116 | double point5x = pointx + point4x * 0.3 * allh / allL;
117 | double point5y = pointy + point4y * 0.3 * allh / allL;
118 | double length5 = sqrt(point5x * point5x + point5y * point5y);
119 | point5x = point5x / length5;
120 | point5y = point5y / length5;
121 | bx[6] = controlpoints[1].lon + scaleBuffer[6] * allL * point5x;
122 | by[6] = controlpoints[1].lat + scaleBuffer[6] * allL * point5y;
123 | bx[7] = controlpoints[1].lon - scaleBuffer[7] * allL * point5x;
124 | by[7] = controlpoints[1].lat - scaleBuffer[7] * allL * point5y;
125 |
126 | if(controlpoints.size() == 3)
127 | {
128 | controlpoints.push_back(GVCoord(bx[0], by[0], 0));
129 | controlpoints.push_back(GVCoord(bx[1], by[1], 0));
130 | controlpoints.push_back(GVCoord(bx[2], by[2], 0));
131 | controlpoints.push_back(GVCoord(bx[3], by[3], 0));
132 | controlpoints.push_back(GVCoord(bx[4], by[4], 0));
133 | controlpoints.push_back(GVCoord(bx[5], by[5], 0));
134 | controlpoints.push_back(GVCoord(bx[6], by[6], 0));
135 | controlpoints.push_back(GVCoord(bx[7], by[7], 0));
136 | controlpoints.push_back(GVCoord(bx[8], by[8], 0));
137 | }
138 | else
139 | {
140 | controlpoints[3] = GVCoord(bx[0], by[0], 0);
141 | controlpoints[4] = GVCoord(bx[1], by[1], 0);
142 | controlpoints[5] = GVCoord(bx[2], by[2], 0);
143 | controlpoints[6] = GVCoord(bx[3], by[3], 0);
144 | controlpoints[7] = GVCoord(bx[4], by[4], 0);
145 | controlpoints[8] = GVCoord(bx[5], by[5], 0);
146 | controlpoints[9] = GVCoord(bx[6], by[6], 0);
147 | controlpoints[10] = GVCoord(bx[7], by[7], 0);
148 | controlpoints[11] = GVCoord(bx[8], by[8], 0);
149 | }
150 | }
151 | }
152 |
153 | void KidNey::drawKidNey(std::vector controlpoints)
154 | {
155 | tmpBuffer.clear();
156 | tmpBuffer2.clear();
157 | if(controlpoints.size() >= 12)
158 | {
159 | double cx[3], cy[3];
160 | cx[0] = controlpoints[0].lon;
161 | cy[0] = controlpoints[0].lat;
162 | cx[1] = controlpoints[1].lon;
163 | cy[1] = controlpoints[1].lat;
164 | cx[2] = controlpoints[2].lon;
165 | cy[2] = controlpoints[2].lat;
166 |
167 | double bx[9], by[9];
168 | bx[0] = controlpoints[3].lon;
169 | by[0] = controlpoints[3].lat;
170 | bx[1] = controlpoints[4].lon;
171 | by[1] = controlpoints[4].lat;
172 | bx[2] = controlpoints[5].lon;
173 | by[2] = controlpoints[5].lat;
174 | bx[3] = controlpoints[6].lon;
175 | by[3] = controlpoints[6].lat;
176 | bx[4] = controlpoints[7].lon;
177 | by[4] = controlpoints[7].lat;
178 | bx[5] = controlpoints[8].lon;
179 | by[5] = controlpoints[8].lat;
180 | bx[6] = controlpoints[9].lon;
181 | by[6] = controlpoints[9].lat;
182 | bx[7] = controlpoints[10].lon;
183 | by[7] = controlpoints[10].lat;
184 | bx[8] = controlpoints[11].lon;
185 | by[8] = controlpoints[11].lat;
186 |
187 | double pointx = (cx[1] - cx[0]) / 2.0;
188 | double pointy = (cy[1] - cy[0]) / 2.0;
189 | double point4x = -pointy;
190 | double point4y = pointx;
191 | double allL = sqrt(pow(pointx * 2, 2) + pow(pointy * 2, 2));
192 | double allh = sqrt(pow(cx[2] - cx[0], 2) + pow(cy[2] - cy[0], 2) - pow(((cx[2] - cx[0]) * (cx[1] - cx[0]) + (cy[2] - cy[0]) * (cy[1] - cy[0])) / allL, 2));
193 |
194 | double length = sqrt(pointx * pointx + pointy * pointy);
195 | pointx = pointx / length;
196 | pointy = pointy / length;
197 | point4x = point4x / length;
198 | point4y = point4y / length;
199 | double dir_t = 1.0;
200 |
201 | if(point4x * (cx[2] - cx[0]) + point4y * (cy[2] - cy[0]) < 0)
202 | {
203 | point4x = -point4x;
204 | point4y = -point4y;
205 | dir_t = -1.0;
206 | double temp;
207 | temp = bx[0];
208 | bx[0] = bx[3];
209 | bx[3] = temp;
210 | temp = by[0];
211 | by[0] = by[3];
212 | by[3] = temp;
213 | }
214 |
215 | double fx[6], fy[6];
216 | double projectLength = (bx[1] - bx[2]) * pointx + (by[1] - by[2]) * pointy;
217 | fx[0] = bx[2] + 2 * projectLength * pointx;
218 | fy[0] = by[2] + 2 * projectLength * pointy;
219 | fx[1] = fx[0] - sqrt(pow(bx[2] - bx[4], 2) + pow(by[2] - by[4], 2)) * point4x;
220 | fy[1] = fy[0] - sqrt(pow(bx[2] - bx[4], 2) + pow(by[2] - by[4], 2)) * point4y;
221 | fx[2] = fx[0] + sqrt(pow(bx[2] - bx[5], 2) + pow(by[2] - by[5], 2)) * point4x;
222 | fy[2] = fy[0] + sqrt(pow(bx[2] - bx[5], 2) + pow(by[2] - by[5], 2)) * point4y;
223 | fx[3] = bx[1] + sqrt(pow(bx[1] - bx[8], 2) + pow(by[1] - by[8], 2)) * pointx;
224 | fy[3] = by[1] + sqrt(pow(bx[1] - bx[8], 2) + pow(by[1] - by[8], 2)) * pointy;
225 |
226 | double point6x = pointx - point4x * 0.3 * allh / allL;
227 | double point6y = pointy - point4y * 0.3 * allh / allL;
228 | double length6 = sqrt(point6x * point6x + point6y * point6y);
229 | point6x = point6x / length6;
230 | point6y = point6y / length6;
231 |
232 | fx[4] = cx[0] + sqrt(pow(bx[7] - cx[1], 2) + pow(by[7] - cy[1], 2)) * point6x;
233 | fy[4] = cy[0] + sqrt(pow(bx[7] - cx[1], 2) + pow(by[7] - cy[1], 2)) * point6y;
234 | fx[5] = cx[0] - sqrt(pow(bx[6] - cx[1], 2) + pow(by[6] - cy[1], 2)) * point6x;
235 | fy[5] = cy[0] - sqrt(pow(bx[6] - cx[1], 2) + pow(by[6] - cy[1], 2)) * point6y;
236 |
237 | double n =30.0;
238 | int t;
239 | double bzx, bzy, bc;
240 | for (t = 0; t <= n; t++)
241 | {
242 | bc = t / n;
243 | bzx = pow((1 - bc), 3) * cx[0] + 3 * bc * pow((1 - bc), 2) * fx[4] + 3 * pow(bc, 2) * (1 - bc) * bx[8] + pow(bc, 3) * bx[1];
244 | bzy = pow((1 - bc), 3) * cy[0] + 3 * bc * pow((1 - bc), 2) * fy[4] + 3 * pow(bc, 2) * (1 - bc) * by[8] + pow(bc, 3) * by[1];
245 | tmpBuffer.push_back(GVCoord(bzx, bzy, 0));
246 | }
247 |
248 | for (t = 0; t <= n; t++)
249 | {
250 | bc = t / n;
251 | bzx = pow((1 - bc), 3) * bx[1] + 3 * bc * pow((1 - bc), 2) * fx[3] + 3 * pow(bc, 2) * (1 - bc) * bx[7] + pow(bc, 3) * cx[1];
252 | bzy = pow((1 - bc), 3) * by[1] + 3 * bc * pow((1 - bc), 2) * fy[3] + 3 * pow(bc, 2) * (1 - bc) * by[7] + pow(bc, 3) * cy[1];
253 | tmpBuffer.push_back(GVCoord(bzx, bzy, 0));
254 | }
255 |
256 | for (t = 0; t <= n; t++)
257 | {
258 | bc = t / n;
259 | bzx = pow((1 - bc), 3) * cx[1] + 3 * bc * pow((1 - bc), 2) * bx[6] + 3 * pow(bc, 2) * (1 - bc) * fx[1] + pow(bc, 3) * fx[0];
260 | bzy = pow((1 - bc), 3) * cy[1] + 3 * bc * pow((1 - bc), 2) * by[6] + 3 * pow(bc, 2) * (1 - bc) * fy[1] + pow(bc, 3) * fy[0];
261 | tmpBuffer.push_back(GVCoord(bzx, bzy, 0));
262 | }
263 |
264 | for (t = 0; t <= n; t++)
265 | {
266 | bc = t / n;
267 | bzx = pow((1 - bc), 3) * fx[0] + 3 * bc * pow((1 - bc), 2) * fx[2] + 3 * pow(bc, 2) * (1 - bc) * bx[3] + pow(bc, 3) * cx[2];
268 | bzy = pow((1 - bc), 3) * fy[0] + 3 * bc * pow((1 - bc), 2) * fy[2] + 3 * pow(bc, 2) * (1 - bc) * by[3] + pow(bc, 3) * cy[2];
269 | tmpBuffer.push_back(GVCoord(bzx, bzy, 0));
270 | }
271 |
272 | for (t = 0; t <= n; t++)
273 | {
274 | bc = t / n;
275 | bzx = pow((1 - bc), 3) * cx[2] + 3 * bc * pow((1 - bc), 2) * bx[0] + 3 * pow(bc, 2) * (1 - bc) * bx[5] + pow(bc, 3) * bx[2];
276 | bzy = pow((1 - bc), 3) * cy[2] + 3 * bc * pow((1 - bc), 2) * by[0] + 3 * pow(bc, 2) * (1 - bc) * by[5] + pow(bc, 3) * by[2];
277 | tmpBuffer.push_back(GVCoord(bzx, bzy, 0));
278 | }
279 |
280 | for (t = 0; t <= n; t++)
281 | {
282 | bc = t / n;
283 | bzx = pow((1 - bc), 3) * bx[2] + 3 * bc * pow((1 - bc), 2) * bx[4] + 3 * pow(bc, 2) * (1 - bc) * fx[5] + pow(bc, 3) * cx[0];
284 | bzy = pow((1 - bc), 3) * by[2] + 3 * bc * pow((1 - bc), 2) * by[4] + 3 * pow(bc, 2) * (1 - bc) * fy[5] + pow(bc, 3) * cy[0];
285 | tmpBuffer.push_back(GVCoord(bzx, bzy, 0));
286 | }
287 |
288 | tmpBuffer2.push_back(tmpBuffer.size());
289 | }
290 | }
291 |
292 | void KidNey::setKidNeyConreolPoint(std::vector &controlpoints, int idx, const GVCoord vtx, std::vector &s)
293 | {
294 | double pointx;
295 | double pointy;
296 | double point4x;
297 | double point4y;
298 | double allL;
299 | double allh;
300 |
301 | pointx = (controlpoints[1].lon - controlpoints[0].lon) / 2.0;
302 | pointy = (controlpoints[1].lat - controlpoints[0].lat) / 2.0;
303 | point4x = -pointy;
304 | point4y = pointx;
305 |
306 | double length = sqrt(pointx * pointx + pointy * pointy);
307 | pointx = pointx / length;
308 | pointy = pointy / length;
309 | point4x = point4x / length;
310 | point4y = point4y / length;
311 | double dir_t = 1.0;
312 |
313 | if(point4x * (controlpoints[2].lon - controlpoints[0].lon) + point4y * (controlpoints[2].lat - controlpoints[0].lat) < 0)
314 | {
315 | point4x = -point4x;
316 | point4y = -point4y;
317 | dir_t = -1.0;
318 | }
319 |
320 | allL = sqrt(pow(controlpoints[1].lon - controlpoints[0].lon, 2) + pow(controlpoints[1].lat - controlpoints[0].lat, 2));
321 | allh = sqrt(pow((controlpoints[2].lon - controlpoints[0].lon), 2) + pow((controlpoints[2].lat - controlpoints[0].lat), 2) - pow(((controlpoints[2].lon - controlpoints[0].lon) * (controlpoints[1].lon - controlpoints[0].lon) + (controlpoints[2].lat - controlpoints[0].lat) * (controlpoints[1].lat - controlpoints[0].lat)) / allL, 2));
322 |
323 | double point5x = pointx + point4x * 0.3 * allh / allL;
324 | double point5y = pointy + point4y * 0.3 * allh / allL;
325 | double length5 = sqrt(point5x * point5x + point5y * point5y);
326 | point5x = point5x / length5;
327 | point5y = point5y / length5;
328 |
329 | if(idx == 0 || idx == 1)
330 | {
331 | controlpoints[idx] = vtx;
332 | pointx = (controlpoints[1].lon - controlpoints[0].lon) / 2.0;
333 | pointy = (controlpoints[1].lat - controlpoints[0].lat) / 2.0;
334 | point4x = -pointy;
335 | point4y = pointx;
336 |
337 | double length = sqrt(pointx * pointx + pointy * pointy);
338 | pointx = pointx / length;
339 | pointy = pointy / length;
340 | point4x = point4x / length;
341 | point4y = point4y / length;
342 | dir_t = 1.0;
343 |
344 | if(point4x * (controlpoints[2].lon - controlpoints[0].lon) + point4y * (controlpoints[2].lat - controlpoints[0].lat) < 0)
345 | {
346 | point4x = -point4x;
347 | point4y = -point4y;
348 | dir_t = -1.0;
349 | }
350 |
351 | allL = sqrt(pow(controlpoints[1].lon - controlpoints[0].lon, 2) + pow(controlpoints[1].lat - controlpoints[0].lat, 2));
352 | allh = sqrt(pow((controlpoints[2].lon - controlpoints[0].lon), 2) + pow((controlpoints[2].lat - controlpoints[0].lat), 2) - pow(((controlpoints[2].lon - controlpoints[0].lon) * (controlpoints[1].lon - controlpoints[0].lon) + (controlpoints[2].lat - controlpoints[0].lat) * (controlpoints[1].lat - controlpoints[0].lat)) / allL, 2));
353 |
354 | double bx[9], by[9];
355 |
356 | bx[1] = controlpoints[0].lon + s[1] * allL * point4x + 0.5 * allL * pointx;
357 | by[1] = controlpoints[0].lat + s[1] * allL * point4y + 0.5 * allL * pointy;
358 | bx[2] = controlpoints[0].lon + 0.4 * point4x * allh - (s[2] - 0.5) * allL * pointx;
359 | by[2] = controlpoints[0].lat + 0.4 * point4y * allh - (s[2] - 0.5) * allL * pointy;
360 | bx[8] = bx[1] - s[8] * allL * pointx;
361 | by[8] = by[1] - s[8] * allL * pointy;
362 | bx[4] = bx[2] - s[4] * allL * point4x;
363 | by[4] = by[2] - s[4] * allL * point4y;
364 | bx[5] = bx[2] + s[5] * allL * point4x;
365 | by[5] = by[2] + s[5] * allL * point4y;
366 | bx[0] = controlpoints[2].lon - s[0] * allL * pointx * dir_t;
367 | by[0] = controlpoints[2].lat - s[0] * allL * pointy * dir_t;
368 | bx[3] = controlpoints[2].lon + s[3] * allL * pointx * dir_t;
369 | by[3] = controlpoints[2].lat + s[3] * allL * pointy * dir_t;
370 |
371 | point5x = pointx + point4x * 0.3 * allh / allL;
372 | point5y = pointy + point4y * 0.3 * allh / allL;
373 | length5 = sqrt(point5x * point5x + point5y * point5y);
374 | point5x = point5x / length5;
375 | point5y = point5y / length5;
376 |
377 | bx[6] = controlpoints[1].lon + s[6] * allL * point5x;
378 | by[6] = controlpoints[1].lat + s[6] * allL * point5y;
379 | bx[7] = controlpoints[1].lon - s[7] * allL * point5x;
380 | by[7] = controlpoints[1].lat - s[7] * allL * point5y;
381 |
382 | controlpoints[3] = GVCoord(bx[0], by[0], 0);
383 | controlpoints[4] = GVCoord(bx[1], by[1], 0);
384 | controlpoints[5] = GVCoord(bx[2], by[2], 0);
385 | controlpoints[6] = GVCoord(bx[3], by[3], 0);
386 | controlpoints[7] = GVCoord(bx[4], by[4], 0);
387 | controlpoints[8] = GVCoord(bx[5], by[5], 0);
388 | controlpoints[9] = GVCoord(bx[6], by[6], 0);
389 | controlpoints[10] = GVCoord(bx[7], by[7], 0);
390 | controlpoints[11] = GVCoord(bx[8], by[8], 0);
391 | }
392 |
393 | if(idx == 2)
394 | {
395 | double point3x = vtx.lon;
396 | double point3y = vtx.lat;
397 |
398 | allh = sqrt(pow((point3x - controlpoints[0].lon), 2) + pow((point3y - controlpoints[0].lat), 2) - pow(((point3x - controlpoints[0].lon) * (controlpoints[1].lon - controlpoints[0].lon) + (point3y - controlpoints[0].lat) * (controlpoints[1].lat - controlpoints[0].lat)) / allL, 2));
399 |
400 | double mozhi1 = (point3x - controlpoints[0].lon) * pointx + (point3y - controlpoints[0].lat) * pointy;
401 |
402 | if(mozhi1 > 0.8 * allL)
403 | {
404 | mozhi1 = 0.8 * allL;
405 | }
406 | else if(mozhi1 < 0.2 * allL)
407 | {
408 | mozhi1 = 0.2 * allL;
409 | }
410 |
411 | if(allh > 1.15 * allL)
412 | {
413 | allh = 1.15 * allL;
414 | }
415 | else if(allh < 0.2 * allL)
416 | {
417 | allh = 0.2 * allL;
418 | }
419 |
420 | if((point3x - controlpoints[0].lon) * point4x + (point3y - controlpoints[0].lat) *point4y > 0)
421 | {
422 | point3x = controlpoints[0].lon + mozhi1 * pointx + allh * point4x;
423 | point3y = controlpoints[0].lat + mozhi1 * pointy + allh * point4y;
424 | }
425 | else
426 | {
427 | point3x = controlpoints[0].lon + mozhi1 * pointx - allh * point4x;
428 | point3y = controlpoints[0].lat + mozhi1 * pointy - allh * point4y;
429 | }
430 | controlpoints[2] = GVCoord(point3x, point3y, 0);
431 |
432 | double bx[9], by[9];
433 |
434 | bx[2] = controlpoints[0].lon + 0.4 * point4x * allh - (s[2] - 0.5) * allL * pointx;
435 | by[2] = controlpoints[0].lat + 0.4 * point4y * allh - (s[2] - 0.5) * allL * pointy;
436 | bx[4] = bx[2] - s[4] * allL * point4x;
437 | by[4] = by[2] - s[4] * allL * point4y;
438 | bx[5] = bx[2] + s[5] * allL * point4x;
439 | by[5] = by[2] + s[5] * allL * point4y;
440 | bx[0] = controlpoints[2].lon - s[0] * allL * pointx * dir_t;
441 | by[0] = controlpoints[2].lat - s[0] * allL * pointy * dir_t;
442 | bx[3] = controlpoints[2].lon + s[3] * allL * pointx * dir_t;
443 | by[3] = controlpoints[2].lat + s[3] * allL * pointy * dir_t;
444 |
445 | controlpoints[3] = GVCoord(bx[0], by[0], 0);
446 | controlpoints[5] = GVCoord(bx[2], by[2], 0);
447 | controlpoints[6] = GVCoord(bx[3], by[3], 0);
448 | controlpoints[7] = GVCoord(bx[4], by[4], 0);
449 | controlpoints[8] = GVCoord(bx[5], by[5], 0);
450 | }
451 |
452 | if (idx == 4)
453 | {
454 | double pointMidx = (controlpoints[0].lon + controlpoints[1].lon) / 2.0;
455 | double pointMidy = (controlpoints[0].lat + controlpoints[1].lat) / 2.0;
456 |
457 | double projectLength = (vtx.lon - pointMidx) * point4x + (vtx.lat - pointMidy) * point4y;
458 |
459 | double min = allL * 0.022;
460 | double max = allL * 0.205;
461 |
462 | if(projectLength < min)
463 | {
464 | projectLength = min;
465 | }
466 | else if (projectLength > max)
467 | {
468 | projectLength = max;
469 | }
470 |
471 | controlpoints[idx] = GVCoord(pointMidx + projectLength * point4x, pointMidy + projectLength * point4y, 0);
472 | controlpoints[11] = GVCoord(controlpoints[idx].lon - s[8] * allL * pointx, controlpoints[idx].lat - s[8] * allL * pointy, 0);
473 |
474 | s[1] = projectLength / allL;
475 | }
476 |
477 | if (idx == 5)
478 | {
479 | double pointTempx = (controlpoints[0].lon + controlpoints[1].lon) / 2.0 + 0.4 * allh * point4x;
480 | double pointTempy = (controlpoints[0].lat + controlpoints[1].lat) / 2.0 + 0.4 * allh * point4y;
481 |
482 | double projectLength = (vtx.lon - pointTempx) * pointx + (vtx.lat - pointTempy) * pointy;
483 |
484 | double min = allL * 0.59;
485 | double max = allL * 0.89;
486 |
487 | if(-projectLength < min)
488 | {
489 | projectLength = -min;
490 | }
491 | else if (-projectLength > max)
492 | {
493 | projectLength = -max;
494 | }
495 |
496 | projectLength = abs(projectLength);
497 |
498 | controlpoints[idx] = GVCoord(pointTempx - projectLength * pointx, pointTempy - projectLength * pointy, 0);
499 | controlpoints[7] = GVCoord(controlpoints[idx].lon - s[4] * allL * point4x, controlpoints[idx].lat - s[4] * allL * point4y, 0);
500 | controlpoints[8] = GVCoord(controlpoints[idx].lon + s[5] * allL * point4x, controlpoints[idx].lat + s[5] * allL * point4y, 0);
501 |
502 | s[2] = projectLength / allL;
503 | }
504 |
505 | if (idx == 3)
506 | {
507 | double projectLength = (vtx.lon - controlpoints[2].lon) * pointx * dir_t + (vtx.lat - controlpoints[2].lat) * pointy * dir_t;
508 |
509 | double min = allL * 0.15;
510 | double max = allL * 0.62;
511 |
512 | if(-projectLength < min)
513 | {
514 | projectLength = -min;
515 | }
516 | else if (-projectLength > max)
517 | {
518 | projectLength = -max;
519 | }
520 |
521 | projectLength = abs(projectLength);
522 |
523 | controlpoints[idx] = GVCoord(controlpoints[2].lon - projectLength * pointx * dir_t, controlpoints[2].lat - projectLength * pointy * dir_t, 0);
524 |
525 | s[0] = projectLength / allL;
526 | }
527 |
528 | if (idx == 6)
529 | {
530 | double projectLength = (vtx.lon - controlpoints[2].lon) * pointx * dir_t + (vtx.lat - controlpoints[2].lat) * pointy * dir_t;
531 |
532 | double min = allL * 0.06;
533 | double max = allL * 0.595;
534 |
535 | if(projectLength < min)
536 | {
537 | projectLength = min;
538 | }
539 | else if (projectLength > max)
540 | {
541 | projectLength = max;
542 | }
543 |
544 | controlpoints[idx] = GVCoord(controlpoints[2].lon + projectLength * pointx * dir_t, controlpoints[2].lat + projectLength * pointy * dir_t, 0);
545 |
546 | s[3] = projectLength / allL;
547 | }
548 |
549 | if (idx == 7)
550 | {
551 | double projectLength = (vtx.lon - controlpoints[5].lon) * point4x + (vtx.lat - controlpoints[5].lat) * point4y;
552 |
553 | double min = allL * 0.055;
554 | double max = allL * 0.239;
555 |
556 | if(-projectLength < min)
557 | {
558 | projectLength = -min;
559 | }
560 | else if (-projectLength > max)
561 | {
562 | projectLength = -max;
563 | }
564 |
565 | projectLength = abs(projectLength);
566 |
567 | controlpoints[idx] = GVCoord(controlpoints[5].lon - projectLength * point4x, controlpoints[5].lat - projectLength * point4y, 0);
568 |
569 | s[4] = projectLength / allL;
570 | }
571 |
572 | if (idx == 8)
573 | {
574 | double projectLength = (vtx.lon - controlpoints[5].lon) * point4x + (vtx.lat - controlpoints[5].lat) * point4y;
575 |
576 | double min = allL * 0.111;
577 | double max = allL * 0.444;
578 |
579 | if(projectLength < min)
580 | {
581 | projectLength = min;
582 | }
583 | else if (projectLength > max)
584 | {
585 | projectLength = max;
586 | }
587 |
588 | controlpoints[idx] = GVCoord(controlpoints[5].lon + projectLength * point4x, controlpoints[5].lat + projectLength * point4y, 0);
589 |
590 | s[5] = projectLength / allL;
591 | }
592 |
593 | if (idx == 9)
594 | {
595 | double projectLength = (vtx.lon - controlpoints[1].lon) * point5x + (vtx.lat - controlpoints[1].lat) * point5y;
596 |
597 | double min = allL * 0.044;
598 | double max = allL * 0.222;
599 |
600 | if(projectLength < min)
601 | {
602 | projectLength = min;
603 | }
604 | else if (projectLength > max)
605 | {
606 | projectLength = max;
607 | }
608 |
609 | controlpoints[idx] = GVCoord(controlpoints[1].lon + projectLength * point5x, controlpoints[1].lat + projectLength * point5y, 0);
610 |
611 | s[6] = projectLength / allL;
612 | }
613 |
614 | if (idx == 10)
615 | {
616 | double projectLength = (vtx.lon - controlpoints[1].lon) * point5x + (vtx.lat - controlpoints[1].lat) * point5y;
617 |
618 | double min = allL * 0.094;
619 | double max = allL * 0.411;
620 |
621 | if(-projectLength < min)
622 | {
623 | projectLength = -min;
624 | }
625 | else if (-projectLength > max)
626 | {
627 | projectLength = -max;
628 | }
629 |
630 | projectLength = abs(projectLength);
631 |
632 | controlpoints[idx] = GVCoord(controlpoints[1].lon - projectLength * point5x, controlpoints[1].lat - projectLength * point5y, 0);
633 |
634 | s[7] = projectLength / allL;
635 | }
636 |
637 | if (idx == 11)
638 | {
639 | double projectLength = (vtx.lon - controlpoints[4].lon) * pointx + (vtx.lat - controlpoints[4].lat) * pointy;
640 |
641 | double min = allL * 0.15;
642 | double max = allL * 0.455;
643 |
644 | if(-projectLength < min)
645 | {
646 | projectLength = -min;
647 | }
648 | else if (-projectLength > max)
649 | {
650 | projectLength = -max;
651 | }
652 |
653 | projectLength = abs(projectLength);
654 |
655 | controlpoints[idx] = GVCoord(controlpoints[4].lon - projectLength * pointx, controlpoints[4].lat - projectLength * pointy, 0);
656 |
657 | s[8] = projectLength / allL;
658 | }
659 | }
660 |
661 | GVCoord KidNey::getKidNeyCenterPoint(const std::vector &controlpoints)
662 | {
663 | int count = controlpoints.size();
664 | if(count < 12)
665 | {
666 | return GVCoord(0, 0, 0);
667 | }
668 |
669 | double tempPointX = (controlpoints[1].lon + controlpoints[0].lon) / 2;
670 | double tempPointY = (controlpoints[1].lat + controlpoints[1].lat) / 2;
671 | double dir1X = controlpoints[1].lon - controlpoints[0].lon;
672 | double dir1Y = controlpoints[1].lat - controlpoints[0].lat;
673 | double dir2X = -dir1Y;
674 | double dir2Y = dir1X;
675 | double dir3X = controlpoints[2].lon - controlpoints[0].lon;
676 | double dir3Y = controlpoints[2].lat - controlpoints[0].lat;
677 | dir2X = dir2X * (dir2X * dir3X + dir2Y * dir3Y) / (pow(dir2X, 2) + pow(dir2Y, 2));
678 | dir2Y = dir2Y * (dir2X * dir3X + dir2Y * dir3Y) / (pow(dir2X, 2) + pow(dir2Y, 2));
679 | double centerPointX = tempPointX + dir2X / 2;
680 | double centerPointY = tempPointY + dir2Y / 2;
681 |
682 | return GVCoord(centerPointX, centerPointY, controlpoints[0].alt);
683 | }
684 |
685 | void KidNey::getKidNeyScales(std::vector &s)
686 | {
687 | s.clear();
688 | if(scaleBuffer.size() == 9)
689 | {
690 | for(int i=0; i<9; i++)
691 | {
692 | s.push_back(scaleBuffer[i]);
693 | }
694 | }
695 | else
696 | {
697 | for (int i=0; i<9; i++)
698 | {
699 | s.push_back(0.0);
700 | }
701 | }
702 | }
--------------------------------------------------------------------------------
/GVAnnotations/KidNey.h:
--------------------------------------------------------------------------------
1 | #ifndef __KIDNEY_H__
2 | #define __KIDNEY_H__
3 |
4 | #include "GVCoord.h"
5 | #include
6 |
7 | class KidNey
8 | {
9 | public:
10 | void setKidNeyConreolPoints(std::vector &controlpoints, std::vector vtxBuffer);
11 | void drawKidNey(std::vector controlpoints);
12 | void setKidNeyConreolPoint(std::vector &controlpoints, int idx, const GVCoord vtx, std::vector &s);
13 | GVCoord getKidNeyCenterPoint(const std::vector &controlpoints);
14 | void getKidNeyScales(std::vector &s);
15 |
16 | std::vector tmpBuffer;
17 | std::vector tmpBuffer2;
18 | std::vector bilidian;
19 | std::vector scaleBuffer;
20 | };
21 |
22 | #endif //__KIDNEY_H__
--------------------------------------------------------------------------------
/GVAnnotations/LineStyle.cpp:
--------------------------------------------------------------------------------
1 | #include "LineStyle.h"
2 |
3 | osg::Group* LineStyle::drawLine(osgEarth::MapNode* mapNode,GVGeometry* line)
4 | {
5 | osg::Group* annoGroup = new osg::Group();
6 |
7 | Style geomStyle;
8 | geomStyle.getOrCreate()->stroke()->color() = Color::Red;
9 | geomStyle.getOrCreate()->stroke()->width() = 4.0f;
10 | /*geomStyle.getOrCreate()->stroke()->widthUnits() = osgEarth::Symbology::Units::PIXELS;
11 | geomStyle.getOrCreate()->tessellation() = 200.0f;*/
12 | geomStyle.getOrCreate()->clamping() = AltitudeSymbol::CLAMP_TO_TERRAIN;
13 | //geomStyle.getOrCreate()->technique() = AltitudeSymbol::TECHNIQUE_MAP;
14 | geomStyle.getOrCreate()->technique() = AltitudeSymbol::TECHNIQUE_DRAPE;
15 | //geomStyle.getOrCreate()->fill()->color() = Color(Color::Red, 1.0);
16 | //geomStyle.getOrCreate()->height() = 250.0;
17 |
18 | const SpatialReference* geoSRS = mapNode->getMapSRS()->getGeographicSRS();
19 | std::vector vtxBuffer;
20 | std::vector vtxBuffer2;
21 | if(line->toVertice(vtxBuffer,&vtxBuffer2))
22 | {
23 | osg::ref_ptr geoms = new osgEarth::Features::MultiGeometry;
24 | unsigned int count = 0;
25 | for(int i =0; i < vtxBuffer2.size(); i++)
26 | {
27 | osg::ref_ptr geom = new osgEarth::Symbology::LineString;
28 | for(int j =0; j < vtxBuffer2[i]; j++)
29 | {
30 | geom->push_back(osg::Vec3d(vtxBuffer[count].lon,vtxBuffer[count].lat,vtxBuffer[count].alt));
31 | count++;
32 | }
33 | geoms->add(geom);
34 |
35 | osg::ref_ptr feature = new osgEarth::Features::Feature(geoms,mapNode->getMapSRS(),geomStyle);
36 | osg::ref_ptr gnode = new osgEarth::Annotation::FeatureNode(mapNode,feature);
37 | gnode->getOrCreateStateSet()->setMode(GL_DEPTH_TEST,osg::StateAttribute::OFF|osg::StateAttribute::PROTECTED);
38 | annoGroup->addChild( gnode );
39 | }
40 | }
41 |
42 | return annoGroup;
43 | }
--------------------------------------------------------------------------------
/GVAnnotations/LineStyle.h:
--------------------------------------------------------------------------------
1 | #ifndef __LINE_STYLE_H__
2 | #define __LINE_STYLE_H__
3 |
4 | #include
5 | #include
6 | #include "GVCoord.h"
7 | #include "GVGeometry.h"
8 |
9 | using namespace osgEarth::Features;
10 |
11 | class LineStyle
12 | {
13 | public:
14 | osg::Group* drawLine(osgEarth::MapNode* mapNode, GVGeometry* line);
15 | };
16 |
17 | #endif //__LINE_STYLE_H__
--------------------------------------------------------------------------------
/GVAnnotations/UseEventHandler.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zengjunyu/osgEarth_Annotation/194a05a6aecbcebc756dfc4f144fbe699cbc1f3d/GVAnnotations/UseEventHandler.cpp
--------------------------------------------------------------------------------
/GVAnnotations/UseEventHandler.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zengjunyu/osgEarth_Annotation/194a05a6aecbcebc756dfc4f144fbe699cbc1f3d/GVAnnotations/UseEventHandler.h
--------------------------------------------------------------------------------
/MFC_OSG_MDI.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 11.00
3 | # Visual Studio 2010
4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MFC_OSG_MDI", "MFC_OSG_MDI\MFC_OSG_MDI.vcxproj", "{006CCD1A-EAE9-482F-94C8-C569752730AD}"
5 | EndProject
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EarthSDK", "EarthSDK\EarthSDK.vcxproj", "{6CB6FC86-2658-4DB7-ACFA-9F5EA74D97E3}"
7 | EndProject
8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GVAnnotations", "GVAnnotations\GVAnnotations.vcxproj", "{1A6373C2-A376-4F35-BC3D-9634A260E5A2}"
9 | EndProject
10 | Global
11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
12 | Debug|Win32 = Debug|Win32
13 | Release|Win32 = Release|Win32
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {006CCD1A-EAE9-482F-94C8-C569752730AD}.Debug|Win32.ActiveCfg = Debug|Win32
17 | {006CCD1A-EAE9-482F-94C8-C569752730AD}.Debug|Win32.Build.0 = Debug|Win32
18 | {006CCD1A-EAE9-482F-94C8-C569752730AD}.Release|Win32.ActiveCfg = Release|Win32
19 | {006CCD1A-EAE9-482F-94C8-C569752730AD}.Release|Win32.Build.0 = Release|Win32
20 | {6CB6FC86-2658-4DB7-ACFA-9F5EA74D97E3}.Debug|Win32.ActiveCfg = Debug|Win32
21 | {6CB6FC86-2658-4DB7-ACFA-9F5EA74D97E3}.Debug|Win32.Build.0 = Debug|Win32
22 | {6CB6FC86-2658-4DB7-ACFA-9F5EA74D97E3}.Release|Win32.ActiveCfg = Release|Win32
23 | {6CB6FC86-2658-4DB7-ACFA-9F5EA74D97E3}.Release|Win32.Build.0 = Release|Win32
24 | {1A6373C2-A376-4F35-BC3D-9634A260E5A2}.Debug|Win32.ActiveCfg = Debug|Win32
25 | {1A6373C2-A376-4F35-BC3D-9634A260E5A2}.Debug|Win32.Build.0 = Debug|Win32
26 | {1A6373C2-A376-4F35-BC3D-9634A260E5A2}.Release|Win32.ActiveCfg = Release|Win32
27 | {1A6373C2-A376-4F35-BC3D-9634A260E5A2}.Release|Win32.Build.0 = Release|Win32
28 | EndGlobalSection
29 | GlobalSection(SolutionProperties) = preSolution
30 | HideSolutionNode = FALSE
31 | EndGlobalSection
32 | EndGlobal
33 |
--------------------------------------------------------------------------------
/MFC_OSG_MDI/ChildFrm.cpp:
--------------------------------------------------------------------------------
1 | // ChildFrm.cpp : implementation of the CChildFrame class
2 | //
3 | #include "stdafx.h"
4 | #include "MFC_OSG_MDI.h"
5 | #include "ChildFrm.h"
6 |
7 | #ifdef _DEBUG
8 | #define new DEBUG_NEW
9 | #endif
10 |
11 |
12 | // CChildFrame
13 |
14 | IMPLEMENT_DYNCREATE(CChildFrame, CMDIChildWnd)
15 |
16 | BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWnd)
17 | END_MESSAGE_MAP()
18 |
19 |
20 | // CChildFrame construction/destruction
21 |
22 | CChildFrame::CChildFrame()
23 | {
24 | // TODO: add member initialization code here
25 | }
26 |
27 | CChildFrame::~CChildFrame()
28 | {
29 | }
30 |
31 | BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
32 | {
33 | // TODO: Modify the Window class or styles here by modifying the CREATESTRUCT cs
34 | if( !CMDIChildWnd::PreCreateWindow(cs) )
35 | return FALSE;
36 |
37 | cs.style = WS_CHILD | WS_VISIBLE | WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU
38 | | FWS_ADDTOTITLE | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_MAXIMIZE;
39 |
40 | return TRUE;
41 | }
42 |
43 |
44 | // CChildFrame diagnostics
45 |
46 | #ifdef _DEBUG
47 | void CChildFrame::AssertValid() const
48 | {
49 | CMDIChildWnd::AssertValid();
50 | }
51 |
52 | void CChildFrame::Dump(CDumpContext& dc) const
53 | {
54 | CMDIChildWnd::Dump(dc);
55 | }
56 |
57 | #endif //_DEBUG
58 |
59 |
60 | // CChildFrame message handlers
61 |
--------------------------------------------------------------------------------
/MFC_OSG_MDI/ChildFrm.h:
--------------------------------------------------------------------------------
1 | // ChildFrm.h : interface of the CChildFrame class
2 | //
3 |
4 |
5 | #pragma once
6 |
7 |
8 | class CChildFrame : public CMDIChildWnd
9 | {
10 | DECLARE_DYNCREATE(CChildFrame)
11 | public:
12 | CChildFrame();
13 |
14 | public:
15 |
16 | // Operations
17 | public:
18 |
19 | // Overrides
20 | public:
21 | virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
22 |
23 | // Implementation
24 | public:
25 | virtual ~CChildFrame();
26 | #ifdef _DEBUG
27 | virtual void AssertValid() const;
28 | virtual void Dump(CDumpContext& dc) const;
29 | #endif
30 |
31 | // Generated message map functions
32 | protected:
33 | DECLARE_MESSAGE_MAP()
34 | };
35 |
--------------------------------------------------------------------------------
/MFC_OSG_MDI/MFC_OSG_MDI.APS:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zengjunyu/osgEarth_Annotation/194a05a6aecbcebc756dfc4f144fbe699cbc1f3d/MFC_OSG_MDI/MFC_OSG_MDI.APS
--------------------------------------------------------------------------------
/MFC_OSG_MDI/MFC_OSG_MDI.cpp:
--------------------------------------------------------------------------------
1 | // MFC_OSG_MDI.cpp : Defines the class behaviors for the application.
2 | //
3 |
4 | #include "stdafx.h"
5 | #include "MFC_OSG_MDI.h"
6 | #include "MainFrm.h"
7 |
8 | #include "ChildFrm.h"
9 | #include "MFC_OSG_MDIDoc.h"
10 | #include "MFC_OSG_MDIView.h"
11 |
12 |
13 | #ifdef _DEBUG
14 | #define new DEBUG_NEW
15 | #endif
16 |
17 |
18 | // CMFC_OSG_MDIApp
19 |
20 | BEGIN_MESSAGE_MAP(CMFC_OSG_MDIApp, CWinApp)
21 | ON_COMMAND(ID_APP_ABOUT, &CMFC_OSG_MDIApp::OnAppAbout)
22 | ON_COMMAND_RANGE(ID_ONE, ID_EIGHT, &CMFC_OSG_MDIApp::OnDealWithMenus)
23 | ON_COMMAND(ID_FILE_OPEN, &CWinApp::OnFileOpen)
24 | END_MESSAGE_MAP()
25 |
26 |
27 | // CMFC_OSG_MDIApp construction
28 |
29 | CMFC_OSG_MDIApp::CMFC_OSG_MDIApp()
30 | {
31 | }
32 |
33 | // The one and only CMFC_OSG_MDIApp object
34 |
35 | CMFC_OSG_MDIApp theApp;
36 |
37 |
38 | // CMFC_OSG_MDIApp initialization
39 |
40 | BOOL CMFC_OSG_MDIApp::InitInstance()
41 | {
42 | // InitCommonControlsEx() is required on Windows XP if an application
43 | // manifest specifies use of ComCtl32.dll version 6 or later to enable
44 | // visual styles. Otherwise, any window creation will fail.
45 | INITCOMMONCONTROLSEX InitCtrls;
46 | InitCtrls.dwSize = sizeof(InitCtrls);
47 | // Set this to include all the common control classes you want to use
48 | // in your application.
49 | InitCtrls.dwICC = ICC_WIN95_CLASSES;
50 | InitCommonControlsEx(&InitCtrls);
51 |
52 | CWinApp::InitInstance();
53 |
54 | // Standard initialization
55 | // If you are not using these features and wish to reduce the size
56 | // of your final executable, you should remove from the following
57 | // the specific initialization routines you do not need
58 | // Change the registry key under which our settings are stored
59 | // TODO: You should modify this string to be something appropriate
60 | // such as the name of your company or organization
61 | SetRegistryKey(_T("Local AppWizard-Generated Applications"));
62 | LoadStdProfileSettings(4); // Load standard INI file options (including MRU)
63 | // Register the application's document templates. Document templates
64 | // serve as the connection between documents, frame windows and views
65 | CMultiDocTemplate* pDocTemplate;
66 | pDocTemplate = new CMultiDocTemplate(IDR_MFC_OSG_MDITYPE,
67 | RUNTIME_CLASS(CMFC_OSG_MDIDoc),
68 | RUNTIME_CLASS(CChildFrame), // custom MDI child frame
69 | RUNTIME_CLASS(CMFC_OSG_MDIView));
70 | if (!pDocTemplate)
71 | return FALSE;
72 | AddDocTemplate(pDocTemplate);
73 |
74 | // create main MDI Frame window
75 | CMainFrame* pMainFrame = new CMainFrame;
76 | if (!pMainFrame || !pMainFrame->LoadFrame(IDR_MAINFRAME))
77 | {
78 | delete pMainFrame;
79 | return FALSE;
80 | }
81 | m_pMainWnd = pMainFrame;
82 | // call DragAcceptFiles only if there's a suffix
83 | // In an MDI app, this should occur immediately after setting m_pMainWnd
84 |
85 | // Parse command line for standard shell commands, DDE, file open
86 | CCommandLineInfo cmdInfo;
87 | ParseCommandLine(cmdInfo);
88 |
89 | //// Don't display a new MDI child window during startup
90 | //if (cmdInfo.m_nShellCommand == CCommandLineInfo::FileNew)
91 | // cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;
92 |
93 |
94 | // Dispatch commands specified on the command line. Will return FALSE if
95 | // app was launched with /RegServer, /Register, /Unregserver or /Unregister.
96 | if (!ProcessShellCommand(cmdInfo))
97 | return FALSE;
98 | // The main window has been initialized, so show and update it
99 | pMainFrame->ShowWindow(m_nCmdShow);
100 | pMainFrame->UpdateWindow();
101 |
102 | return TRUE;
103 | }
104 |
105 |
106 |
107 | // CAboutDlg dialog used for App About
108 |
109 | class CAboutDlg : public CDialog
110 | {
111 | public:
112 | CAboutDlg();
113 |
114 | // Dialog Data
115 | enum { IDD = IDD_ABOUTBOX };
116 |
117 | protected:
118 | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
119 |
120 | // Implementation
121 | protected:
122 | DECLARE_MESSAGE_MAP()
123 | };
124 |
125 | CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
126 | {
127 | }
128 |
129 | void CAboutDlg::DoDataExchange(CDataExchange* pDX)
130 | {
131 | CDialog::DoDataExchange(pDX);
132 | }
133 |
134 | BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
135 | END_MESSAGE_MAP()
136 |
137 | // App command to run the dialog
138 | void CMFC_OSG_MDIApp::OnAppAbout()
139 | {
140 | CAboutDlg aboutDlg;
141 | aboutDlg.DoModal();
142 | }
143 |
144 | void CMFC_OSG_MDIApp::OnDealWithMenus(UINT nID)
145 | {
146 | CAboutDlg aboutDlg;
147 | switch(nID)
148 | {
149 | case ID_ONE:
150 | i_GxWorld->sendKey(1);
151 | break;
152 | case ID_TWO:
153 | i_GxWorld->sendKey(2);
154 | break;
155 | case ID_THREE:
156 | i_GxWorld->sendKey(3);
157 | break;
158 | case ID_FOUR:
159 | i_GxWorld->sendKey(4);
160 | break;
161 | case ID_FIVE:
162 | i_GxWorld->sendKey(5);
163 | break;
164 | case ID_SIX:
165 | i_GxWorld->sendKey(6);
166 | break;
167 | case ID_SEVEN:
168 | i_GxWorld->sendKey(7);
169 | break;
170 | }
171 | }
172 |
173 | I_GxWorld* i_GxWorld;
174 | // CMFC_OSG_MDIApp message handlers
175 |
176 |
--------------------------------------------------------------------------------
/MFC_OSG_MDI/MFC_OSG_MDI.h:
--------------------------------------------------------------------------------
1 | // MFC_OSG_MDI.h : main header file for the MFC_OSG_MDI application
2 | //
3 | #pragma once
4 |
5 | #ifndef __AFXWIN_H__
6 | #error "include 'stdafx.h' before including this file for PCH"
7 | #endif
8 |
9 | #include "resource.h" // main symbols
10 | #include "I_GxWorld.h"
11 | #include "GVAnnotations.h"
12 |
13 |
14 | // CMFC_OSG_MDIApp:
15 | // See MFC_OSG_MDI.cpp for the implementation of this class
16 | //
17 |
18 | class CMFC_OSG_MDIApp : public CWinApp
19 | {
20 | public:
21 | CMFC_OSG_MDIApp();
22 |
23 |
24 | // Overrides
25 | public:
26 | virtual BOOL InitInstance();
27 |
28 | // Implementation
29 | afx_msg void OnAppAbout();
30 | afx_msg void OnDealWithMenus(UINT nID);
31 | DECLARE_MESSAGE_MAP()
32 | };
33 |
34 | extern I_GxWorld* i_GxWorld;
35 |
36 | extern CMFC_OSG_MDIApp theApp;
--------------------------------------------------------------------------------
/MFC_OSG_MDI/MFC_OSG_MDI.rc:
--------------------------------------------------------------------------------
1 | // Microsoft Visual C++ generated resource script.
2 | //
3 | #include "resource.h"
4 |
5 | #define APSTUDIO_READONLY_SYMBOLS
6 | /////////////////////////////////////////////////////////////////////////////
7 | //
8 | // Generated from the TEXTINCLUDE 2 resource.
9 | //
10 | #include "afxres.h"
11 |
12 | /////////////////////////////////////////////////////////////////////////////
13 | #undef APSTUDIO_READONLY_SYMBOLS
14 |
15 | /////////////////////////////////////////////////////////////////////////////
16 | // Chinese (Simplified, PRC) resources
17 |
18 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS)
19 | LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED
20 | #pragma code_page(936)
21 |
22 | #ifdef APSTUDIO_INVOKED
23 | /////////////////////////////////////////////////////////////////////////////
24 | //
25 | // TEXTINCLUDE
26 | //
27 |
28 | 1 TEXTINCLUDE
29 | BEGIN
30 | "resource.h\0"
31 | END
32 |
33 | 2 TEXTINCLUDE
34 | BEGIN
35 | "#include ""afxres.h""\r\n"
36 | "\0"
37 | END
38 |
39 | 3 TEXTINCLUDE
40 | BEGIN
41 | "#define _AFX_NO_OLE_RESOURCES\r\n"
42 | "#define _AFX_NO_TRACKER_RESOURCES\r\n"
43 | "#define _AFX_NO_PROPERTY_RESOURCES\r\n"
44 | "\r\n"
45 | "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
46 | "LANGUAGE 9, 1\r\n"
47 | "#pragma code_page(1252)\r\n"
48 | "#include ""res\\MFC_OSG_MDI.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
49 | "#include ""afxres.rc"" // Standard components\r\n"
50 | "#endif\r\n"
51 | "\0"
52 | END
53 |
54 | #endif // APSTUDIO_INVOKED
55 |
56 | #endif // Chinese (Simplified, PRC) resources
57 | /////////////////////////////////////////////////////////////////////////////
58 |
59 |
60 | /////////////////////////////////////////////////////////////////////////////
61 | // English (United States) resources
62 |
63 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
64 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
65 | #pragma code_page(1252)
66 |
67 | /////////////////////////////////////////////////////////////////////////////
68 | //
69 | // Icon
70 | //
71 |
72 | // Icon with lowest ID value placed first to ensure application icon
73 | // remains consistent on all systems.
74 | IDR_MAINFRAME ICON "res\\MFC_OSG_MDI.ico"
75 | IDR_MFC_OSG_MDITYPE ICON "res\\MFC_OSG_MDIDoc.ico"
76 |
77 | /////////////////////////////////////////////////////////////////////////////
78 | //
79 | // Bitmap
80 | //
81 |
82 | IDR_MAINFRAME BITMAP "res\\Toolbar.bmp"
83 |
84 | /////////////////////////////////////////////////////////////////////////////
85 | //
86 | // Toolbar
87 | //
88 |
89 | IDR_MAINFRAME TOOLBAR 16, 15
90 | BEGIN
91 | BUTTON ID_FILE_NEW
92 | BUTTON ID_FILE_OPEN
93 | BUTTON ID_FILE_SAVE
94 | SEPARATOR
95 | BUTTON ID_EDIT_CUT
96 | BUTTON ID_EDIT_COPY
97 | BUTTON ID_EDIT_PASTE
98 | SEPARATOR
99 | BUTTON ID_FILE_PRINT
100 | BUTTON ID_APP_ABOUT
101 | END
102 |
103 |
104 | /////////////////////////////////////////////////////////////////////////////
105 | //
106 | // Menu
107 | //
108 |
109 | IDR_MAINFRAME MENU
110 | BEGIN
111 | POPUP "&File"
112 | BEGIN
113 | MENUITEM "&New\tCtrl+N", ID_FILE_NEW
114 | MENUITEM "&Open...\tCtrl+O", ID_FILE_OPEN
115 | MENUITEM SEPARATOR
116 | MENUITEM "Recent File", ID_FILE_MRU_FILE1
117 | MENUITEM SEPARATOR
118 | MENUITEM "&Close", ID_FILE_CLOSE
119 | MENUITEM "E&xit", ID_APP_EXIT
120 | END
121 | POPUP "&View"
122 | BEGIN
123 | MENUITEM "&Toolbar", ID_VIEW_TOOLBAR
124 | MENUITEM "&Status Bar", ID_VIEW_STATUS_BAR
125 | END
126 | POPUP "&Help"
127 | BEGIN
128 | MENUITEM "&About MFC_OSG_MDI...", ID_APP_ABOUT
129 | END
130 | END
131 |
132 | IDR_MFC_OSG_MDITYPE MENU
133 | BEGIN
134 | POPUP "&File"
135 | BEGIN
136 | MENUITEM "&New\tCtrl+N", ID_FILE_NEW
137 | MENUITEM "&Open...\tCtrl+O", ID_FILE_OPEN
138 | MENUITEM "&Close", ID_FILE_CLOSE
139 | MENUITEM "&Save\tCtrl+S", ID_FILE_SAVE
140 | MENUITEM "Save &As...", ID_FILE_SAVE_AS
141 | MENUITEM SEPARATOR
142 | MENUITEM "Recent File", ID_FILE_MRU_FILE1
143 | MENUITEM SEPARATOR
144 | MENUITEM "E&xit", ID_APP_EXIT
145 | END
146 | POPUP "&Edit"
147 | BEGIN
148 | MENUITEM "&Undo\tCtrl+Z", ID_EDIT_UNDO
149 | MENUITEM SEPARATOR
150 | MENUITEM "Cu&t\tCtrl+X", ID_EDIT_CUT
151 | MENUITEM "&Copy\tCtrl+C", ID_EDIT_COPY
152 | MENUITEM "&Paste\tCtrl+V", ID_EDIT_PASTE
153 | END
154 | POPUP "&View"
155 | BEGIN
156 | MENUITEM "&Toolbar", ID_VIEW_TOOLBAR
157 | MENUITEM "&Status Bar", ID_VIEW_STATUS_BAR
158 | END
159 | POPUP "&Window"
160 | BEGIN
161 | MENUITEM "&New Window", ID_WINDOW_NEW
162 | MENUITEM "&Cascade", ID_WINDOW_CASCADE
163 | MENUITEM "&Tile", ID_WINDOW_TILE_HORZ
164 | MENUITEM "&Arrange Icons", ID_WINDOW_ARRANGE
165 | MENUITEM "S&plit", ID_WINDOW_SPLIT
166 | END
167 | POPUP "&Help"
168 | BEGIN
169 | MENUITEM "&About MFC_OSG_MDI...", ID_APP_ABOUT
170 | END
171 | POPUP "LineSymbol"
172 | BEGIN
173 | MENUITEM "GV00001 bezier", ID_ONE
174 | MENUITEM "GV00002 broken line", ID_TWO
175 | MENUITEM "GV00003 curved arrow", ID_THREE
176 | MENUITEM "GV00004 kidney", ID_FOUR
177 | MENUITEM "GV00005 bezier+arrow", ID_FIVE
178 | MENUITEM "GV00006 bezier+subsymbol", ID_SIX
179 | MENUITEM "GV00007 regular line", ID_SEVEN
180 | MENUITEM "GV00008 kidney+subsymbol", ID_EIGHT
181 | END
182 | END
183 |
184 |
185 | /////////////////////////////////////////////////////////////////////////////
186 | //
187 | // Accelerator
188 | //
189 |
190 | IDR_MAINFRAME ACCELERATORS
191 | BEGIN
192 | "N", ID_FILE_NEW, VIRTKEY, CONTROL
193 | "O", ID_FILE_OPEN, VIRTKEY, CONTROL
194 | "S", ID_FILE_SAVE, VIRTKEY, CONTROL
195 | "Z", ID_EDIT_UNDO, VIRTKEY, CONTROL
196 | "X", ID_EDIT_CUT, VIRTKEY, CONTROL
197 | "C", ID_EDIT_COPY, VIRTKEY, CONTROL
198 | "V", ID_EDIT_PASTE, VIRTKEY, CONTROL
199 | VK_BACK, ID_EDIT_UNDO, VIRTKEY, ALT
200 | VK_DELETE, ID_EDIT_CUT, VIRTKEY, SHIFT
201 | VK_INSERT, ID_EDIT_COPY, VIRTKEY, CONTROL
202 | VK_INSERT, ID_EDIT_PASTE, VIRTKEY, SHIFT
203 | VK_F6, ID_NEXT_PANE, VIRTKEY
204 | VK_F6, ID_PREV_PANE, VIRTKEY, SHIFT
205 | END
206 |
207 |
208 | /////////////////////////////////////////////////////////////////////////////
209 | //
210 | // Dialog
211 | //
212 |
213 | IDD_ABOUTBOX DIALOGEX 0, 0, 235, 55
214 | STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
215 | CAPTION "About MFC_OSG_MDI"
216 | FONT 8, "MS Shell Dlg", 0, 0, 0x1
217 | BEGIN
218 | ICON IDR_MAINFRAME,IDC_STATIC,11,17,20,20
219 | LTEXT "MFC_OSG_MDI Version 1.0",IDC_STATIC,40,10,119,8,SS_NOPREFIX
220 | LTEXT "Copyright (C) 2007",IDC_STATIC,40,25,119,8
221 | DEFPUSHBUTTON "OK",IDOK,178,7,50,16,WS_GROUP
222 | END
223 |
224 | IDR_MAINFRAME DIALOGEX 0, 0, 330, 16
225 | STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
226 | FONT 8, "MS Shell Dlg", 0, 0, 0x1
227 | BEGIN
228 | LTEXT "TODO: layout dialog bar ",IDC_STATIC,12,4,300,8
229 | END
230 |
231 |
232 | /////////////////////////////////////////////////////////////////////////////
233 | //
234 | // Version
235 | //
236 |
237 | VS_VERSION_INFO VERSIONINFO
238 | FILEVERSION 1,0,0,1
239 | PRODUCTVERSION 1,0,0,1
240 | FILEFLAGSMASK 0x3fL
241 | #ifdef _DEBUG
242 | FILEFLAGS 0x1L
243 | #else
244 | FILEFLAGS 0x0L
245 | #endif
246 | FILEOS 0x4L
247 | FILETYPE 0x1L
248 | FILESUBTYPE 0x0L
249 | BEGIN
250 | BLOCK "StringFileInfo"
251 | BEGIN
252 | BLOCK "040904e4"
253 | BEGIN
254 | VALUE "CompanyName", "TODO: "
255 | VALUE "FileDescription", "TODO: "
256 | VALUE "FileVersion", "1.0.0.1"
257 | VALUE "InternalName", "MFC_OSG_MDI.exe"
258 | VALUE "LegalCopyright", "TODO: (c) . All rights reserved."
259 | VALUE "OriginalFilename", "MFC_OSG_MDI.exe"
260 | VALUE "ProductName", "TODO: "
261 | VALUE "ProductVersion", "1.0.0.1"
262 | END
263 | END
264 | BLOCK "VarFileInfo"
265 | BEGIN
266 | VALUE "Translation", 0x409, 1252
267 | END
268 | END
269 |
270 |
271 | /////////////////////////////////////////////////////////////////////////////
272 | //
273 | // DESIGNINFO
274 | //
275 |
276 | #ifdef APSTUDIO_INVOKED
277 | GUIDELINES DESIGNINFO
278 | BEGIN
279 | IDD_ABOUTBOX, DIALOG
280 | BEGIN
281 | LEFTMARGIN, 7
282 | RIGHTMARGIN, 228
283 | TOPMARGIN, 7
284 | BOTTOMMARGIN, 48
285 | END
286 |
287 | IDR_MAINFRAME, DIALOG
288 | BEGIN
289 | END
290 | END
291 | #endif // APSTUDIO_INVOKED
292 |
293 |
294 | /////////////////////////////////////////////////////////////////////////////
295 | //
296 | // String Table
297 | //
298 |
299 | STRINGTABLE
300 | BEGIN
301 | IDR_MAINFRAME "MFC_OSG_MDI"
302 | IDR_MFC_OSG_MDITYPE "\nMFC_OSG_MDI\nMFC_OSG_MDI\n\n\nMFCOSGMDI.Document\nMFC_OSG_MDI.Document"
303 | END
304 |
305 | STRINGTABLE
306 | BEGIN
307 | AFX_IDS_APP_TITLE "MFC_OSG_MDI"
308 | AFX_IDS_IDLEMESSAGE "Ready"
309 | END
310 |
311 | STRINGTABLE
312 | BEGIN
313 | ID_INDICATOR_EXT "EXT"
314 | ID_INDICATOR_CAPS "CAP"
315 | ID_INDICATOR_NUM "NUM"
316 | ID_INDICATOR_SCRL "SCRL"
317 | ID_INDICATOR_OVR "OVR"
318 | ID_INDICATOR_REC "REC"
319 | END
320 |
321 | STRINGTABLE
322 | BEGIN
323 | ID_FILE_NEW "Create a new document\nNew"
324 | ID_FILE_OPEN "Open an existing document\nOpen"
325 | ID_FILE_CLOSE "Close the active document\nClose"
326 | ID_FILE_SAVE "Save the active document\nSave"
327 | ID_FILE_SAVE_AS "Save the active document with a new name\nSave As"
328 | END
329 |
330 | STRINGTABLE
331 | BEGIN
332 | ID_APP_ABOUT "Display program information, version number and copyright\nAbout"
333 | ID_APP_EXIT "Quit the application; prompts to save documents\nExit"
334 | END
335 |
336 | STRINGTABLE
337 | BEGIN
338 | ID_FILE_MRU_FILE1 "Open this document"
339 | ID_FILE_MRU_FILE2 "Open this document"
340 | ID_FILE_MRU_FILE3 "Open this document"
341 | ID_FILE_MRU_FILE4 "Open this document"
342 | ID_FILE_MRU_FILE5 "Open this document"
343 | ID_FILE_MRU_FILE6 "Open this document"
344 | ID_FILE_MRU_FILE7 "Open this document"
345 | ID_FILE_MRU_FILE8 "Open this document"
346 | ID_FILE_MRU_FILE9 "Open this document"
347 | ID_FILE_MRU_FILE10 "Open this document"
348 | ID_FILE_MRU_FILE11 "Open this document"
349 | ID_FILE_MRU_FILE12 "Open this document"
350 | ID_FILE_MRU_FILE13 "Open this document"
351 | ID_FILE_MRU_FILE14 "Open this document"
352 | ID_FILE_MRU_FILE15 "Open this document"
353 | ID_FILE_MRU_FILE16 "Open this document"
354 | END
355 |
356 | STRINGTABLE
357 | BEGIN
358 | ID_NEXT_PANE "Switch to the next window pane\nNext Pane"
359 | ID_PREV_PANE "Switch back to the previous window pane\nPrevious Pane"
360 | END
361 |
362 | STRINGTABLE
363 | BEGIN
364 | ID_WINDOW_NEW "Open another window for the active document\nNew Window"
365 | ID_WINDOW_ARRANGE "Arrange icons at the bottom of the window\nArrange Icons"
366 | ID_WINDOW_CASCADE "Arrange windows so they overlap\nCascade Windows"
367 | ID_WINDOW_TILE_HORZ "Arrange windows as non-overlapping tiles\nTile Windows"
368 | ID_WINDOW_TILE_VERT "Arrange windows as non-overlapping tiles\nTile Windows"
369 | ID_WINDOW_SPLIT "Split the active window into panes\nSplit"
370 | END
371 |
372 | STRINGTABLE
373 | BEGIN
374 | ID_EDIT_CLEAR "Erase the selection\nErase"
375 | ID_EDIT_CLEAR_ALL "Erase everything\nErase All"
376 | ID_EDIT_COPY "Copy the selection and put it on the Clipboard\nCopy"
377 | ID_EDIT_CUT "Cut the selection and put it on the Clipboard\nCut"
378 | ID_EDIT_FIND "Find the specified text\nFind"
379 | ID_EDIT_PASTE "Insert Clipboard contents\nPaste"
380 | ID_EDIT_REPEAT "Repeat the last action\nRepeat"
381 | ID_EDIT_REPLACE "Replace specific text with different text\nReplace"
382 | ID_EDIT_SELECT_ALL "Select the entire document\nSelect All"
383 | ID_EDIT_UNDO "Undo the last action\nUndo"
384 | ID_EDIT_REDO "Redo the previously undone action\nRedo"
385 | END
386 |
387 | STRINGTABLE
388 | BEGIN
389 | ID_VIEW_TOOLBAR "Show or hide the toolbar\nToggle ToolBar"
390 | ID_VIEW_STATUS_BAR "Show or hide the status bar\nToggle StatusBar"
391 | END
392 |
393 | STRINGTABLE
394 | BEGIN
395 | AFX_IDS_SCSIZE "Change the window size"
396 | AFX_IDS_SCMOVE "Change the window position"
397 | AFX_IDS_SCMINIMIZE "Reduce the window to an icon"
398 | AFX_IDS_SCMAXIMIZE "Enlarge the window to full size"
399 | AFX_IDS_SCNEXTWINDOW "Switch to the next document window"
400 | AFX_IDS_SCPREVWINDOW "Switch to the previous document window"
401 | AFX_IDS_SCCLOSE "Close the active window and prompts to save the documents"
402 | END
403 |
404 | STRINGTABLE
405 | BEGIN
406 | AFX_IDS_SCRESTORE "Restore the window to normal size"
407 | AFX_IDS_SCTASKLIST "Activate Task List"
408 | AFX_IDS_MDICHILD "Activate this window"
409 | END
410 |
411 | #endif // English (United States) resources
412 | /////////////////////////////////////////////////////////////////////////////
413 |
414 |
415 |
416 | #ifndef APSTUDIO_INVOKED
417 | /////////////////////////////////////////////////////////////////////////////
418 | //
419 | // Generated from the TEXTINCLUDE 3 resource.
420 | //
421 | #define _AFX_NO_OLE_RESOURCES
422 | #define _AFX_NO_TRACKER_RESOURCES
423 | #define _AFX_NO_PROPERTY_RESOURCES
424 |
425 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
426 | LANGUAGE 9, 1
427 | #pragma code_page(1252)
428 | #include "res\MFC_OSG_MDI.rc2" // non-Microsoft Visual C++ edited resources
429 | #include "afxres.rc" // Standard components
430 | #endif
431 |
432 | /////////////////////////////////////////////////////////////////////////////
433 | #endif // not APSTUDIO_INVOKED
434 |
435 |
--------------------------------------------------------------------------------
/MFC_OSG_MDI/MFC_OSG_MDI.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | Win32
7 |
8 |
9 | Release
10 | Win32
11 |
12 |
13 |
14 | {006CCD1A-EAE9-482F-94C8-C569752730AD}
15 | MFC_OSG_MDI
16 | MFCProj
17 |
18 |
19 |
20 | Application
21 | true
22 | Unicode
23 | Dynamic
24 |
25 |
26 | Application
27 | false
28 | true
29 | MultiByte
30 | Dynamic
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 | true
44 |
45 |
46 | false
47 |
48 |
49 |
50 | Use
51 | Level3
52 | Disabled
53 | WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions)
54 |
55 |
56 | Windows
57 | true
58 |
59 |
60 | false
61 | true
62 | _DEBUG;%(PreprocessorDefinitions)
63 |
64 |
65 | 0x0804
66 | _DEBUG;%(PreprocessorDefinitions)
67 | $(IntDir);%(AdditionalIncludeDirectories)
68 |
69 |
70 |
71 |
72 | Level3
73 | Use
74 | MaxSpeed
75 | true
76 | true
77 | WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions)
78 | E:\MFC_OSG_MDI\EarthSDK;E:\OpenSceneGraph_x86\include;E:\MFC_OSG_MDI\GVAnnotations;E:\OSGEARTH\include;%(AdditionalIncludeDirectories)
79 |
80 |
81 | Windows
82 | true
83 | true
84 | true
85 | E:\MFC_OSG_MDI\Release;E:\3rdParty\x86\lib;E:\OSGEARTH\lib;E:\OpenSceneGraph_x86\lib;%(AdditionalLibraryDirectories)
86 | d3d9.lib;freetype2311MT.lib;gdal_i.lib;geos.lib;geos_c_i.lib;giflib.lib;glut32.lib;jpeg.lib;libboost_filesystem-vc100-mt.lib;libboost_system-vc100-mt.lib;libcollada14dom21.lib;libcurl.lib;libpng.lib;libtiff_i.lib;libxml2.lib;minizip.lib;nvtt.lib;pcre.lib;pcrecpp.lib;squish.lib;OpenThreads.lib;osg.lib;osgAnimation.lib;osgDB.lib;osgFX.lib;osgGA.lib;osgManipulator.lib;osgParticle.lib;osgPresentation.lib;osgShadow.lib;osgSim.lib;osgTerrain.lib;osgText.lib;osgUI.lib;osgUtil.lib;osgViewer.lib;osgVolume.lib;osgWidget.lib;osgEarth.lib;osgEarthAnnotation.lib;osgEarthFeatures.lib;osgEarthSymbology.lib;osgEarthUtil.lib;EarthSDK.lib;GVAnnotations.lib
87 |
88 |
89 | false
90 | true
91 | NDEBUG;%(PreprocessorDefinitions)
92 |
93 |
94 | 0x0804
95 | NDEBUG;%(PreprocessorDefinitions)
96 | $(IntDir);%(AdditionalIncludeDirectories)
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 | Create
122 | Create
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
--------------------------------------------------------------------------------
/MFC_OSG_MDI/MFC_OSG_MDI.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | Header Files
22 |
23 |
24 | Header Files
25 |
26 |
27 | Header Files
28 |
29 |
30 | Header Files
31 |
32 |
33 | Header Files
34 |
35 |
36 | Header Files
37 |
38 |
39 | Header Files
40 |
41 |
42 |
43 |
44 | Source Files
45 |
46 |
47 | Source Files
48 |
49 |
50 | Source Files
51 |
52 |
53 | Source Files
54 |
55 |
56 | Source Files
57 |
58 |
59 | Source Files
60 |
61 |
62 |
63 |
64 | Source Files
65 |
66 |
67 |
--------------------------------------------------------------------------------
/MFC_OSG_MDI/MFC_OSG_MDI.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/MFC_OSG_MDI/MFC_OSG_MDIDoc.cpp:
--------------------------------------------------------------------------------
1 | // MFC_OSG_MDIDoc.cpp : implementation of the CMFC_OSG_MDIDoc class
2 | //
3 |
4 | #include "stdafx.h"
5 | #include "MFC_OSG_MDI.h"
6 |
7 | #include "MFC_OSG_MDIDoc.h"
8 |
9 | #ifdef _DEBUG
10 | #define new DEBUG_NEW
11 | #endif
12 |
13 |
14 | // CMFC_OSG_MDIDoc
15 |
16 | IMPLEMENT_DYNCREATE(CMFC_OSG_MDIDoc, CDocument)
17 |
18 | BEGIN_MESSAGE_MAP(CMFC_OSG_MDIDoc, CDocument)
19 | END_MESSAGE_MAP()
20 |
21 |
22 | // CMFC_OSG_MDIDoc construction/destruction
23 |
24 | CMFC_OSG_MDIDoc::CMFC_OSG_MDIDoc()
25 | {
26 | }
27 |
28 | CMFC_OSG_MDIDoc::~CMFC_OSG_MDIDoc()
29 | {
30 | }
31 |
32 | BOOL CMFC_OSG_MDIDoc::OnOpenDocument(LPCTSTR lpszPathName)
33 | {
34 | m_csFileName = lpszPathName;
35 |
36 | if (!CDocument::OnOpenDocument(lpszPathName))
37 | return FALSE;
38 |
39 | return TRUE;
40 | }
41 |
42 |
43 | // CMFC_OSG_MDIDoc serialization
44 |
45 | void CMFC_OSG_MDIDoc::Serialize(CArchive& ar)
46 | {
47 | if (ar.IsStoring())
48 | {
49 | // TODO: add storing code here
50 | }
51 | else
52 | {
53 | // TODO: add loading code here
54 | }
55 | }
56 |
57 |
58 | // CMFC_OSG_MDIDoc diagnostics
59 |
60 | #ifdef _DEBUG
61 | void CMFC_OSG_MDIDoc::AssertValid() const
62 | {
63 | CDocument::AssertValid();
64 | }
65 |
66 | void CMFC_OSG_MDIDoc::Dump(CDumpContext& dc) const
67 | {
68 | CDocument::Dump(dc);
69 | }
70 | #endif //_DEBUG
71 |
72 |
73 | // CMFC_OSG_MDIDoc commands
74 |
--------------------------------------------------------------------------------
/MFC_OSG_MDI/MFC_OSG_MDIDoc.h:
--------------------------------------------------------------------------------
1 | // MFC_OSG_MDIDoc.h : interface of the CMFC_OSG_MDIDoc class
2 | //
3 |
4 |
5 | #pragma once
6 |
7 |
8 | class CMFC_OSG_MDIDoc : public CDocument
9 | {
10 | protected: // create from serialization only
11 | CMFC_OSG_MDIDoc();
12 | DECLARE_DYNCREATE(CMFC_OSG_MDIDoc)
13 |
14 | // Attributes
15 | public:
16 |
17 | // Operations
18 | public:
19 |
20 | // Overrides
21 | public:
22 | virtual void Serialize(CArchive& ar);
23 | virtual BOOL OnOpenDocument(LPCTSTR lpszPathName);
24 | CString GetFileName() const { return m_csFileName; }
25 |
26 | // Implementation
27 | public:
28 | virtual ~CMFC_OSG_MDIDoc();
29 | #ifdef _DEBUG
30 | virtual void AssertValid() const;
31 | virtual void Dump(CDumpContext& dc) const;
32 | #endif
33 |
34 | protected:
35 | CString m_csFileName;
36 |
37 | // Generated message map functions
38 | protected:
39 | DECLARE_MESSAGE_MAP()
40 | };
41 |
42 |
43 |
--------------------------------------------------------------------------------
/MFC_OSG_MDI/MFC_OSG_MDIView.cpp:
--------------------------------------------------------------------------------
1 | // MFC_OSG_MDIView.cpp : implementation of the CMFC_OSG_MDIView class
2 | //
3 |
4 | #include "stdafx.h"
5 | #include "MFC_OSG_MDI.h"
6 | #include "MFC_OSG_MDIDoc.h"
7 | #include "MFC_OSG_MDIView.h"
8 |
9 | #ifdef _DEBUG
10 | #define new DEBUG_NEW
11 | #endif
12 |
13 |
14 | IMPLEMENT_DYNCREATE(CMFC_OSG_MDIView, CView)
15 |
16 | BEGIN_MESSAGE_MAP(CMFC_OSG_MDIView, CView)
17 | ON_WM_CREATE()
18 | ON_WM_DESTROY()
19 | ON_WM_KEYDOWN()
20 | ON_WM_ERASEBKGND()
21 | END_MESSAGE_MAP()
22 |
23 | CMFC_OSG_MDIView::CMFC_OSG_MDIView()
24 | {
25 | }
26 |
27 | CMFC_OSG_MDIView::~CMFC_OSG_MDIView()
28 | {
29 | }
30 |
31 | BOOL CMFC_OSG_MDIView::PreCreateWindow(CREATESTRUCT& cs)
32 | {
33 | return CView::PreCreateWindow(cs);
34 | }
35 |
36 | void CMFC_OSG_MDIView::OnDraw(CDC* /*pDC*/)
37 | {
38 | CMFC_OSG_MDIDoc* pDoc = GetDocument();
39 | ASSERT_VALID(pDoc);
40 | if (!pDoc)
41 | return;
42 | }
43 |
44 | #ifdef _DEBUG
45 | void CMFC_OSG_MDIView::AssertValid() const
46 | {
47 | CView::AssertValid();
48 | }
49 |
50 | void CMFC_OSG_MDIView::Dump(CDumpContext& dc) const
51 | {
52 | CView::Dump(dc);
53 | }
54 |
55 | CMFC_OSG_MDIDoc* CMFC_OSG_MDIView::GetDocument() const // non-debug version is inline
56 | {
57 | ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMFC_OSG_MDIDoc)));
58 | return (CMFC_OSG_MDIDoc*)m_pDocument;
59 | }
60 | #endif //_DEBUG
61 |
62 | void CMFC_OSG_MDIView::OnInitialUpdate()
63 | {
64 | CView::OnInitialUpdate();
65 |
66 | i_GxWorld = GxWorld_CreateWorldObject(m_hWnd);
67 | i_GxWorld->Display();
68 | i_GxWorld->InitAnno();
69 | }
--------------------------------------------------------------------------------
/MFC_OSG_MDI/MFC_OSG_MDIView.h:
--------------------------------------------------------------------------------
1 | // MFC_OSG_MDIView.h : interface of the CMFC_OSG_MDIView class
2 | //
3 | #pragma once
4 |
5 | class CMFC_OSG_MDIView : public CView
6 | {
7 | protected: // create from serialization only
8 | CMFC_OSG_MDIView();
9 | DECLARE_DYNCREATE(CMFC_OSG_MDIView)
10 |
11 | // Attributes
12 | public:
13 | CMFC_OSG_MDIDoc* GetDocument() const;
14 |
15 | // Operations
16 | public:
17 |
18 | // Overrides
19 | public:
20 | virtual void OnDraw(CDC* pDC); // overridden to draw this view
21 | virtual void OnInitialUpdate();
22 | virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
23 | protected:
24 |
25 | // Implementation
26 | public:
27 | virtual ~CMFC_OSG_MDIView();
28 | #ifdef _DEBUG
29 | virtual void AssertValid() const;
30 | virtual void Dump(CDumpContext& dc) const;
31 | #endif
32 |
33 | protected:
34 |
35 | // Generated message map functions
36 | protected:
37 | DECLARE_MESSAGE_MAP()
38 | };
39 |
40 | #ifndef _DEBUG // debug version in MFC_OSG_MDIView.cpp
41 | inline CMFC_OSG_MDIDoc* CMFC_OSG_MDIView::GetDocument() const
42 | { return reinterpret_cast(m_pDocument); }
43 | #endif
44 |
45 |
--------------------------------------------------------------------------------
/MFC_OSG_MDI/MainFrm.cpp:
--------------------------------------------------------------------------------
1 | // MainFrm.cpp : implementation of the CMainFrame class
2 | //
3 |
4 | #include "stdafx.h"
5 | #include "MFC_OSG_MDI.h"
6 |
7 | #include "MainFrm.h"
8 |
9 | #ifdef _DEBUG
10 | #define new DEBUG_NEW
11 | #endif
12 |
13 |
14 | // CMainFrame
15 |
16 | IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWnd)
17 |
18 | BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
19 | ON_WM_CREATE()
20 | END_MESSAGE_MAP()
21 |
22 | static UINT indicators[] =
23 | {
24 | ID_SEPARATOR, // status line indicator
25 | ID_INDICATOR_CAPS,
26 | ID_INDICATOR_NUM,
27 | ID_INDICATOR_SCRL,
28 | };
29 |
30 |
31 | // CMainFrame construction/destruction
32 |
33 | CMainFrame::CMainFrame()
34 | {
35 | m_bAutoMenuEnable = false;
36 | }
37 |
38 | CMainFrame::~CMainFrame()
39 | {
40 | }
41 |
42 |
43 | int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
44 | {
45 | if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
46 | return -1;
47 |
48 | if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT | TBSTYLE_TRANSPARENT) ||
49 | !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
50 | {
51 | TRACE0("Failed to create toolbar\n");
52 | return -1; // fail to create
53 | }
54 | if (!m_wndDlgBar.Create(this, IDR_MAINFRAME,
55 | CBRS_ALIGN_TOP, AFX_IDW_DIALOGBAR))
56 | {
57 | TRACE0("Failed to create dialogbar\n");
58 | return -1; // fail to create
59 | }
60 |
61 | if (!m_wndReBar.Create(this) ||
62 | !m_wndReBar.AddBar(&m_wndToolBar) ||
63 | !m_wndReBar.AddBar(&m_wndDlgBar))
64 | {
65 | TRACE0("Failed to create rebar\n");
66 | return -1; // fail to create
67 | }
68 |
69 | if (!m_wndStatusBar.Create(this) ||
70 | !m_wndStatusBar.SetIndicators(indicators,
71 | sizeof(indicators)/sizeof(UINT)))
72 | {
73 | TRACE0("Failed to create status bar\n");
74 | return -1; // fail to create
75 | }
76 |
77 | // TODO: Remove this if you don't want tool tips
78 | m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
79 | CBRS_TOOLTIPS | CBRS_FLYBY);
80 |
81 | return 0;
82 | }
83 |
84 | BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
85 | {
86 | if( !CMDIFrameWnd::PreCreateWindow(cs) )
87 | return FALSE;
88 | // TODO: Modify the Window class or styles here by modifying
89 | // the CREATESTRUCT cs
90 |
91 | return TRUE;
92 | }
93 |
94 |
95 | // CMainFrame diagnostics
96 |
97 | #ifdef _DEBUG
98 | void CMainFrame::AssertValid() const
99 | {
100 | CMDIFrameWnd::AssertValid();
101 | }
102 |
103 | void CMainFrame::Dump(CDumpContext& dc) const
104 | {
105 | CMDIFrameWnd::Dump(dc);
106 | }
107 |
108 | #endif //_DEBUG
109 |
110 |
111 | // CMainFrame message handlers
112 |
113 |
114 |
115 |
--------------------------------------------------------------------------------
/MFC_OSG_MDI/MainFrm.h:
--------------------------------------------------------------------------------
1 | // MainFrm.h : interface of the CMainFrame class
2 | //
3 |
4 |
5 | #pragma once
6 |
7 | class CMainFrame : public CMDIFrameWnd
8 | {
9 | DECLARE_DYNAMIC(CMainFrame)
10 | public:
11 | CMainFrame();
12 |
13 | // Attributes
14 | public:
15 |
16 | // Operations
17 | public:
18 |
19 | // Overrides
20 | public:
21 | virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
22 |
23 | // Implementation
24 | public:
25 | virtual ~CMainFrame();
26 | #ifdef _DEBUG
27 | virtual void AssertValid() const;
28 | virtual void Dump(CDumpContext& dc) const;
29 | #endif
30 |
31 | protected: // control bar embedded members
32 | CStatusBar m_wndStatusBar;
33 | CToolBar m_wndToolBar;
34 | CReBar m_wndReBar;
35 | CDialogBar m_wndDlgBar;
36 |
37 | // Generated message map functions
38 | protected:
39 | afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
40 | afx_msg void OnTimer(UINT nIDEvent);
41 | DECLARE_MESSAGE_MAP()
42 | };
43 |
44 |
45 |
--------------------------------------------------------------------------------
/MFC_OSG_MDI/ReadMe.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zengjunyu/osgEarth_Annotation/194a05a6aecbcebc756dfc4f144fbe699cbc1f3d/MFC_OSG_MDI/ReadMe.txt
--------------------------------------------------------------------------------
/MFC_OSG_MDI/Resource.h:
--------------------------------------------------------------------------------
1 | //{{NO_DEPENDENCIES}}
2 | // Microsoft Visual C++ generated include file.
3 | // Used by MFC_OSG_MDI.rc
4 | //
5 | #define IDD_ABOUTBOX 100
6 | #define IDR_MAINFRAME 128
7 | #define IDR_MFC_OSG_MDITYPE 129
8 | #define ID_32771 32771
9 | #define ID_32772 32772
10 | #define ID_32773 32773
11 | #define ID_ONE 32774
12 | #define ID_TWO 32775
13 | #define ID_THREE 32776
14 | #define ID_LINESYMBOL_GV00004 32777
15 | #define ID_LINESYMBOL_GV00005 32778
16 | #define ID_LINESYMBOL_GV00006 32779
17 | #define ID_FOUR 32780
18 | #define ID_FIVE 32781
19 | #define ID_SIX 32782
20 | #define ID_LINESYMBOL_GV00007 32783
21 | #define ID_LINESYMBOL_GV00008KIDNEY 32784
22 | #define ID_SEVEN 32785
23 | #define ID_EIGHT 32786
24 |
25 | // Next default values for new objects
26 | //
27 | #ifdef APSTUDIO_INVOKED
28 | #ifndef APSTUDIO_READONLY_SYMBOLS
29 | #define _APS_NEXT_RESOURCE_VALUE 130
30 | #define _APS_NEXT_COMMAND_VALUE 32787
31 | #define _APS_NEXT_CONTROL_VALUE 1000
32 | #define _APS_NEXT_SYMED_VALUE 101
33 | #endif
34 | #endif
35 |
--------------------------------------------------------------------------------
/MFC_OSG_MDI/res/MFC_OSG_MDI.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zengjunyu/osgEarth_Annotation/194a05a6aecbcebc756dfc4f144fbe699cbc1f3d/MFC_OSG_MDI/res/MFC_OSG_MDI.ico
--------------------------------------------------------------------------------
/MFC_OSG_MDI/res/MFC_OSG_MDI.rc2:
--------------------------------------------------------------------------------
1 | //
2 | // MFC_OSG_MDI.RC2 - resources Microsoft Visual C++ does not edit directly
3 | //
4 |
5 | #ifdef APSTUDIO_INVOKED
6 | #error this file is not editable by Microsoft Visual C++
7 | #endif //APSTUDIO_INVOKED
8 |
9 |
10 | /////////////////////////////////////////////////////////////////////////////
11 | // Add manually edited resources here...
12 |
13 | /////////////////////////////////////////////////////////////////////////////
14 |
--------------------------------------------------------------------------------
/MFC_OSG_MDI/res/MFC_OSG_MDIDoc.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zengjunyu/osgEarth_Annotation/194a05a6aecbcebc756dfc4f144fbe699cbc1f3d/MFC_OSG_MDI/res/MFC_OSG_MDIDoc.ico
--------------------------------------------------------------------------------
/MFC_OSG_MDI/res/Toolbar.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zengjunyu/osgEarth_Annotation/194a05a6aecbcebc756dfc4f144fbe699cbc1f3d/MFC_OSG_MDI/res/Toolbar.bmp
--------------------------------------------------------------------------------
/MFC_OSG_MDI/stdafx.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zengjunyu/osgEarth_Annotation/194a05a6aecbcebc756dfc4f144fbe699cbc1f3d/MFC_OSG_MDI/stdafx.cpp
--------------------------------------------------------------------------------
/MFC_OSG_MDI/stdafx.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zengjunyu/osgEarth_Annotation/194a05a6aecbcebc756dfc4f144fbe699cbc1f3d/MFC_OSG_MDI/stdafx.h
--------------------------------------------------------------------------------