1 | #include "ellipsoidTechnique.h" |
---|
2 | |
---|
3 | |
---|
4 | ellipsoidTechnique::ellipsoidTechnique() |
---|
5 | { |
---|
6 | _height = 0.0; |
---|
7 | } |
---|
8 | |
---|
9 | ellipsoidTechnique::~ellipsoidTechnique() |
---|
10 | { |
---|
11 | } |
---|
12 | |
---|
13 | void ellipsoidTechnique::modifyHeightfield(osg::Vec4d& modificationROI, osg::HeightField* h, osg::Vec4d tileExtends) |
---|
14 | { |
---|
15 | //OSG_NOTIFY( osg::ALWAYS ) << "ellipsoidTechnique::modifyHeightfield()" << std::endl; |
---|
16 | //OSG_NOTIFY( osg::ALWAYS ) << "LAT: " << tileExtends[0] << " | " << tileExtends[1] << std::endl; |
---|
17 | //OSG_NOTIFY( osg::ALWAYS ) << "LON: " << tileExtends[2] << " | " << tileExtends[3] << std::endl; |
---|
18 | |
---|
19 | // calculate colum start/end and row start/end of affected vertices |
---|
20 | int startX=0, startY=0, endX=h->getNumColumns(), endY=h->getNumRows(); |
---|
21 | |
---|
22 | |
---|
23 | // Determine loop variables.. |
---|
24 | if(tileExtends[0]<modificationROI[0]) |
---|
25 | startY = (modificationROI[0] - tileExtends[0]) / h->getYInterval(); |
---|
26 | if(tileExtends[1]>modificationROI[1]) |
---|
27 | endY = (modificationROI[1] - tileExtends[0]) / h->getYInterval(); |
---|
28 | |
---|
29 | if(tileExtends[2]<modificationROI[2]) |
---|
30 | startX = (modificationROI[2] - tileExtends[2]) / h->getXInterval(); |
---|
31 | if(tileExtends[3]>modificationROI[3]) |
---|
32 | endX = (modificationROI[3] - tileExtends[2]) / h->getXInterval(); |
---|
33 | |
---|
34 | |
---|
35 | // Modify height value of affected vertices |
---|
36 | for(int x=startX;x<endX;x++) |
---|
37 | { |
---|
38 | for(int y=startY;y<endY;y++) |
---|
39 | { |
---|
40 | h->setHeight( x, y, _height); |
---|
41 | } |
---|
42 | } |
---|
43 | } |
---|
44 | |
---|