#include <OSGBaseFieldDataType.h>
Inheritance diagram for osg::FieldDataTraits< DynamicVolume >:

Public Types | |
| enum | { StringConvertable } |
| typedef osgIF< uiTest==1, const DynamicVolume, const DynamicVolume & >::_IRet | ArgumentType |
| enum | { ToStringConvertable = 0x01, FromStringConvertable = 0x02 } |
Static Public Member Functions | |
| static DataType & | getType (void) |
| static const Char8 * | getSName (void) |
| static const Char8 * | getMName (void) |
| static const DynamicVolume | getDefault (void) |
| static bool | getFromString (DynamicVolume &outVal, const Char8 *&inVal) |
| static void | putToString (const DynamicVolume &inVal, std::string &outStr) |
| static UInt32 | getBinSize (const DynamicVolume &oObject) |
| static UInt32 | getBinSize (const DynamicVolume *pObjectStore, UInt32 uiNumObjects) |
| static void | copyToBin (BinaryDataHandler &pMem, const DynamicVolume &oObject) |
| static void | copyToBin (BinaryDataHandler &pMem, const DynamicVolume *pObjectStore, UInt32 uiNumObjects) |
| static void | copyFromBin (BinaryDataHandler &pMem, DynamicVolume &oObject) |
| static void | copyFromBin (BinaryDataHandler &pMem, DynamicVolume *pObjectStore, UInt32 uiNumObjects) |
| static bool | getFromString (DynamicVolume &outVal, const Char8 *inVal) |
| static const Char8 * | getPName (void) |
Static Public Attributes | |
| static DataType | _type |
| static const UInt32 | uiTest |
Definition at line 615 of file OSGBaseFieldDataType.h.
|
|
Definition at line 122 of file OSGFieldDataType.h. |
|
|
Definition at line 620 of file OSGBaseFieldDataType.h. 00620 { StringConvertable = ToStringConvertable | 00621 FromStringConvertable };
|
|
|
Definition at line 69 of file OSGFieldDataType.h. 00070 { 00071 ToStringConvertable = 0x01, 00072 FromStringConvertable = 0x02 00073 };
|
|
|
Definition at line 623 of file OSGBaseFieldDataType.h. 00623 { return _type; }
|
|
|
Definition at line 625 of file OSGBaseFieldDataType.h.
|
|
|
Definition at line 627 of file OSGBaseFieldDataType.h.
|
|
|
Definition at line 629 of file OSGBaseFieldDataType.h.
|
|
||||||||||||
|
Definition at line 631 of file OSGBaseFieldDataType.h. References osg::DynamicVolume::getInstance(), osg::DynamicVolume::instanceChanged(), osg::BoxVolume::setBounds(), osg::SphereVolume::setCenter(), osg::SphereVolume::setRadius(), and osg::DynamicVolume::setVolumeType(). 00633 { 00634 Real32 valStore[ 6]; 00635 Char8 str [256]; 00636 00637 UInt32 length = strlen(inVal); 00638 Char8 *c = str; 00639 00640 if(length > 256) 00641 { 00642 std::cerr << "FieldDataTraits<DynamicVolume>::getFromString(): " 00643 << "Input too long" << std::endl; 00644 00645 return false; 00646 } 00647 00648 strncpy(str, inVal, length); 00649 00650 while(*c != '\0') 00651 { 00652 if(*c == '[') 00653 *c = ' '; 00654 if(*c == ']') 00655 *c = ' '; 00656 if(*c == ',') 00657 *c = ' '; 00658 00659 c++; 00660 } 00661 00662 Int16 count = sscanf(str, "%f %f %f %f %f %f", 00663 &valStore[0], &valStore[1], &valStore[2], 00664 &valStore[3], &valStore[4], &valStore[5]); 00665 00666 if(count == 4) 00667 { 00668 outVal.setVolumeType(DynamicVolume::SPHERE_VOLUME); 00669 00670 SphereVolume *pSVol = 00671 dynamic_cast<SphereVolume *>(&(outVal.getInstance())); 00672 00673 pSVol->setCenter(Pnt3f(valStore[0], valStore[1], valStore[2])); 00674 pSVol->setRadius(valStore[3]); 00675 00676 outVal.instanceChanged(); 00677 00678 return true; 00679 } 00680 else if(count == 6) 00681 { 00682 outVal.setVolumeType(DynamicVolume::BOX_VOLUME); 00683 00684 BoxVolume *pBVol = 00685 dynamic_cast<BoxVolume *>(&(outVal.getInstance())); 00686 00687 pBVol->setBounds(valStore[0], valStore[1], valStore[2], 00688 valStore[3], valStore[4], valStore[5]); 00689 00690 outVal.instanceChanged(); 00691 00692 return true; 00693 } 00694 else 00695 { 00696 outVal.setVolumeType(DynamicVolume::BOX_VOLUME); 00697 00698 BoxVolume *pBVol = 00699 dynamic_cast<BoxVolume *>(&(outVal.getInstance())); 00700 00701 pBVol->setBounds(0.,0.,0., 0.,0.,0.); 00702 00703 outVal.instanceChanged(); 00704 00705 return false; 00706 } 00707 }
|
|
||||||||||||
|
Reimplemented from osg::FieldTraitsRecurseBase< DynamicVolume >. Definition at line 709 of file OSGBaseFieldDataType.h. References osg::DynamicVolume::getBounds(), osg::SphereVolume::getCenter(), osg::DynamicVolume::getInstance(), osg::SphereVolume::getRadius(), osg::DynamicVolume::getType(), osg::PointInterface< ValueTypeT, StorageInterfaceT >::getValues(), and osg::FieldTraitsRecurseBase< FieldTypeT >::putToString(). 00711 { 00712 Pnt3f min, max; 00713 outStr.erase(); 00714 00715 switch(inVal.getType()) 00716 { 00717 00718 case DynamicVolume::BOX_VOLUME: 00719 00720 typedef TypeTraits<Pnt3f::ValueType> TypeTrait; 00721 00722 inVal.getBounds(min, max); 00723 outStr.append(TypeTrait::putToString(min.getValues()[0])); 00724 outStr.append(" "); 00725 outStr.append(TypeTrait::putToString(min.getValues()[1])); 00726 outStr.append(" "); 00727 outStr.append(TypeTrait::putToString(min.getValues()[2])); 00728 outStr.append(" "); 00729 outStr.append(TypeTrait::putToString(max.getValues()[0])); 00730 outStr.append(" "); 00731 outStr.append(TypeTrait::putToString(max.getValues()[1])); 00732 outStr.append(" "); 00733 outStr.append(TypeTrait::putToString(max.getValues()[2])); 00734 break; 00735 00736 00737 case DynamicVolume::SPHERE_VOLUME: 00738 00739 typedef TypeTraits<Pnt3f::ValueType> TypeTrait; 00740 00741 const SphereVolume &sVol = 00742 dynamic_cast<const SphereVolume&>(inVal.getInstance()); 00743 00744 outStr.append(TypeTrait::putToString(sVol.getCenter()[0])); 00745 outStr.append(" "); 00746 outStr.append(TypeTrait::putToString(sVol.getCenter()[1])); 00747 outStr.append(" "); 00748 outStr.append(TypeTrait::putToString(sVol.getCenter()[1])); 00749 outStr.append(" "); 00750 outStr.append(TypeTraits< 00751 Real32>::putToString(sVol.getRadius())); 00752 break; 00753 } 00754 }
|
|
|
Reimplemented from osg::FieldTraitsRecurseBase< DynamicVolume >. Definition at line 756 of file OSGBaseFieldDataType.h. References osg::DynamicVolume::getType(), and SWARNING. 00757 { 00758 UInt32 type = oObject.getType(); 00759 UInt32 size = sizeof(DynamicVolume::Type) + sizeof(UInt16); 00760 00761 switch(type) 00762 { 00763 case DynamicVolume::BOX_VOLUME : 00764 size += sizeof(Pnt3f) + sizeof(Pnt3f); 00765 break; 00766 00767 case DynamicVolume::SPHERE_VOLUME : 00768 size += sizeof(Pnt3f) + sizeof(Real32); 00769 break; 00770 00771 default : 00772 SWARNING << "Unknown volume type in getBinSize" << std::endl; 00773 } 00774 00775 return size; 00776 }
|
|
||||||||||||
|
Reimplemented from osg::FieldTraitsRecurseBase< DynamicVolume >. Definition at line 778 of file OSGBaseFieldDataType.h. References osg::FieldTraitsRecurseBase< FieldTypeT >::getBinSize(). 00780 { 00781 UInt32 size = 0; 00782 00783 for(UInt32 i = 0; i < uiNumObjects; ++i) 00784 { 00785 size += getBinSize(pObjectStore[i]); 00786 } 00787 00788 return size; 00789 }
|
|
||||||||||||
|
Reimplemented from osg::FieldTraitsRecurseBase< DynamicVolume >. Definition at line 791 of file OSGBaseFieldDataType.h. References osg::SphereVolume::getCenter(), osg::DynamicVolume::getInstance(), osg::BoxVolume::getMax(), osg::BoxVolume::getMin(), osg::SphereVolume::getRadius(), osg::Volume::getState(), osg::DynamicVolume::getType(), osg::BinaryDataHandler::putValue(), osg::BinaryDataHandler::putValues(), and SWARNING. 00793 { 00794 UInt32 type = (UInt32)(oObject.getType()); 00795 00796 pMem.putValue(type); 00797 00798 switch(type) 00799 { 00800 case DynamicVolume::BOX_VOLUME : 00801 { 00802 const BoxVolume *pBVol = 00803 dynamic_cast<const BoxVolume *>( 00804 &(oObject.getInstance())); 00805 00806 UInt16 state = pBVol->getState(); 00807 00808 pMem.putValue(state); 00809 00810 pMem.putValues(&(pBVol->getMin()[0]), 3); 00811 pMem.putValues(&(pBVol->getMax()[0]), 3); 00812 00813 break; 00814 } 00815 case DynamicVolume::SPHERE_VOLUME : 00816 { 00817 const SphereVolume *pSVol = 00818 dynamic_cast<const SphereVolume *>( 00819 &(oObject.getInstance())); 00820 00821 Real32 radius = pSVol->getRadius(); 00822 00823 UInt16 state = pSVol->getState(); 00824 00825 pMem.putValue(state); 00826 00827 pMem.putValues(&(pSVol->getCenter()[0]), 3); 00828 pMem.putValue (radius); 00829 00830 break; 00831 } 00832 00833 default: 00834 SWARNING << "Unknown volume type in copyToBin" << std::endl; 00835 } 00836 }
|
|
||||||||||||||||
|
Reimplemented from osg::FieldTraitsRecurseBase< DynamicVolume >. Definition at line 838 of file OSGBaseFieldDataType.h. References osg::FieldTraitsRecurseBase< FieldTypeT >::copyToBin(). 00841 { 00842 for(UInt32 i = 0; i < uiNumObjects; ++i) 00843 { 00844 copyToBin(pMem, pObjectStore[i]); 00845 } 00846 }
|
|
||||||||||||
|
Reimplemented from osg::FieldTraitsRecurseBase< DynamicVolume >. Definition at line 848 of file OSGBaseFieldDataType.h. References osg::DynamicVolume::getInstance(), osg::BinaryDataHandler::getValue(), osg::BinaryDataHandler::getValues(), osg::BoxVolume::setBounds(), osg::SphereVolume::setCenter(), osg::SphereVolume::setRadius(), osg::Volume::setState(), osg::DynamicVolume::setVolumeType(), and SWARNING. 00850 { 00851 UInt32 type; 00852 00853 pMem.getValue(type); 00854 DynamicVolume::Type volumeType= 00855 static_cast<DynamicVolume::Type>(type); 00856 oObject.setVolumeType(volumeType); 00857 00858 switch(type) 00859 { 00860 case DynamicVolume::BOX_VOLUME : 00861 { 00862 BoxVolume *pBVol = 00863 dynamic_cast<BoxVolume *>(&(oObject.getInstance())); 00864 00865 Pnt3f min,max; 00866 UInt16 state; 00867 00868 pMem.getValue (state ); 00869 pMem.getValues(&(min[0]), 3); 00870 pMem.getValues(&(max[0]), 3); 00871 00872 pBVol->setState (state ); 00873 pBVol->setBounds(min, max); 00874 00875 break; 00876 } 00877 case DynamicVolume::SPHERE_VOLUME : 00878 { 00879 SphereVolume *pSVol = 00880 dynamic_cast<SphereVolume *>(&(oObject.getInstance())); 00881 00882 Pnt3f center; 00883 Real32 radius; 00884 UInt16 state; 00885 00886 pMem.getValue(state); 00887 pMem.getValues(&(center[0]), 3); 00888 pMem.getValue (radius); 00889 00890 pSVol->setState (state ); 00891 pSVol->setCenter(center); 00892 pSVol->setRadius(radius); 00893 00894 break; 00895 } 00896 00897 default: 00898 SWARNING << "Unknown volume type in copyFronBin" << std::endl; 00899 } 00900 }
|
|
||||||||||||||||
|
Reimplemented from osg::FieldTraitsRecurseBase< DynamicVolume >. Definition at line 902 of file OSGBaseFieldDataType.h. References osg::FieldTraitsRecurseBase< FieldTypeT >::copyFromBin(). 00905 { 00906 for(UInt32 i = 0; i < uiNumObjects; ++i) 00907 { 00908 copyFromBin(pMem, pObjectStore[i]); 00909 } 00910 }
|
|
||||||||||||
|
Definition at line 209 of file OSGFieldDataType.h. 00211 { 00212 typedef FieldDataTraits<FieldTypeT> MappedTrait; 00213 00214 return MappedTrait::getFromString(outVal, inVal); 00215 }
|
|
|
Definition at line 75 of file OSGFieldDataType.h.
|
|
|
|
|
|
Definition at line 117 of file OSGFieldDataType.h. |
1.4.3