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