Changeset 13041 for OpenSceneGraph/trunk/src/osgPlugins/ive/Layer.cpp
- Timestamp:
- 03/21/12 18:36:20 (14 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/src/osgPlugins/ive/Layer.cpp
r12292 r13041 1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield 1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield 2 2 * 3 * This library is open source and may be redistributed and/or modified under 4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or 3 * This library is open source and may be redistributed and/or modified under 4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or 5 5 * (at your option) any later version. The full license is in LICENSE file 6 6 * included with this distribution, and on the openscenegraph.org website. 7 * 7 * 8 8 * This library is distributed in the hope that it will be useful, 9 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 11 * OpenSceneGraph Public License for more details. 12 12 */ … … 38 38 out_THROW_EXCEPTION("Layer::write(): Could not cast this osgLayer::Layer to an osg::Object."); 39 39 40 40 41 41 if (out->getVersion() >= VERSION_0023) 42 42 { … … 58 58 helper.writeLocator(out, getLocator()); 59 59 } 60 61 60 61 62 62 63 63 out->writeUInt(getMinLevel()); … … 76 76 if (id != IVELAYER) 77 77 in_THROW_EXCEPTION("Layer::read(): Expected Layer identification."); 78 78 79 79 // Read Layer's identification. 80 80 id = in->readInt(); … … 118 118 void LayerHelper::writeLayer(DataOutputStream* out, osgTerrain::Layer* layer) 119 119 { 120 if (layer) 120 if (layer) 121 121 { 122 122 out->writeBool(true); … … 193 193 osg::ref_ptr<osg::Object> object = osgDB::readObjectFile(filename+".gdal"); 194 194 osgTerrain::ProxyLayer* proxyLayer = dynamic_cast<osgTerrain::ProxyLayer*>(object.get()); 195 195 196 196 osg::ref_ptr<osgTerrain::Locator> locator = readLocator(in); 197 197 unsigned int minLevel = in->readUInt(); 198 198 unsigned int maxLevel = in->readUInt(); 199 199 200 200 if (proxyLayer) 201 201 { 202 202 if (locator.valid()) proxyLayer->setLocator(locator.get()); 203 203 204 204 proxyLayer->setMinLevel(minLevel); 205 205 proxyLayer->setMaxLevel(maxLevel); 206 206 } 207 207 208 208 return proxyLayer; 209 209 } 210 210 211 211 return new osgTerrain::ImageLayer; 212 212 } … … 214 214 void LayerHelper::writeLocator(DataOutputStream* out, osgTerrain::Locator* locator) 215 215 { 216 if (locator) 216 if (locator) 217 217 { 218 218 out->writeBool(true); 219 219 220 220 ((ive::Locator*)(locator))->write(out); 221 221 } … … 230 230 bool locatorExist = in->readBool(); 231 231 if (!locatorExist) return 0; 232 232 233 233 osgTerrain::Locator* locator = new osgTerrain::Locator; 234 234 235 235 ((ive::Locator*)(locator))->read(in); 236 236 237 237 return locator; 238 238 } … … 250 250 out->writeFloat(validRange->getMaxValue()); 251 251 } 252 else 253 { 252 else 253 { 254 254 osgTerrain::NoDataValue* noDataValue = dynamic_cast<osgTerrain::NoDataValue*>(validDataOperator); 255 255 if (noDataValue) … … 270 270 bool hasOperator = in->readBool(); 271 271 if (!hasOperator) return 0; 272 272 273 273 int id = in->peekInt(); 274 274 if (id==IVEVALIDRANGE) … … 277 277 float minValue = in->readFloat(); 278 278 float maxValue = in->readFloat(); 279 return new osgTerrain::ValidRange(minValue,maxValue); 279 return new osgTerrain::ValidRange(minValue,maxValue); 280 280 } 281 281 else if (id==IVENODATAVALUE)
