![]() |
【转帖】determine oddbentity type
determine oddbentity type
determine oddbentity type following code: oddbobjectiteratorptr it = pblock->newiterator(); for (it->start(); !it->done(); it->step()) { oddbentityptr pent = it->objectid().safeopenobject(); if( pent->iskindof( oddbline::desc() ) ) { } } so this works! but i would prefer another way like: switch( pent->getentitytype() ) { case oddbentity::kline: case oddbentity::kcircle: } couldn't find anything! any suggestions? thanx robert you can eighter initialize a map<odrxclass*,somefunctionpointer> and to maintain it by your self, or to use the extension classes functionality provided by dwgdirect. or just the if,else,if,else structure. but the extension classes would be the reccommended solution in this case. hope this helps. regards chudomir >but the extension classes would be the reccommended solution in this case. hi thanx, but what do you mean by extension classes how to use them? an example would be nice! thanx rob protocol extensions is a method to add your own interface to rxobjects. using protocol extesions is illustrated in odreadex sample. sergey slezkin oh so now i understand but it seems like this works also with the desc() is this right? greets and thanx again rob desc() returns pointer. it will work with if() else if()... but not with switch-case. sergey slezkin |
所有的时间均为北京时间。 现在的时间是 11:56 PM. |