NLLIGO::CZoneRegion Class Reference

#include <zone_region.h>


Public Member Functions

void basicSet (sint32 x, sint32 y, sint32 PosX, sint32 PosY, const std::string &ZoneName)
 CZoneRegion ()
uint8 getCutEdge (sint32 x, sint32 y, uint8 pos) const
uint32 getDate (sint32 x, sint32 y, uint8 lowOrHigh) const
uint8 getFlip (sint32 x, sint32 y) const
sint32 getMaxX () const
sint32 getMaxY () const
sint32 getMinX () const
sint32 getMinY () const
const std::string & getName (sint32 x, sint32 y) const
uint8 getPosX (sint32 x, sint32 y) const
uint8 getPosY (sint32 x, sint32 y) const
uint8 getRot (sint32 x, sint32 y) const
uint8 getSharingCutEdges (sint32 x, sint32 y, uint edge)
std::string getSharingMatNames (sint32 x, sint32 y, uint edge)
void resize (sint32 newMinX, sint32 newMaxX, sint32 newMinY, sint32 newMaxY)
void serial (NLMISC::IStream &f)
bool setFlip (sint32 x, sint32 y, uint8 newValue)
void setMaxX (sint32 newValue)
void setMaxY (sint32 newValue)
void setMinX (sint32 newValue)
void setMinY (sint32 newValue)
bool setName (sint32 x, sint32 y, const std::string &newValue)
bool setPosX (sint32 x, sint32 y, uint8 newValue)
bool setPosY (sint32 x, sint32 y, uint8 newValue)
bool setRot (sint32 x, sint32 y, uint8 newValue)
bool setSharingCutEdges (sint32 x, sint32 y, uint edge, uint8 newValue)
bool setSharingMatNames (sint32 x, sint32 y, uint edge, const std::string &newValue)

Protected Attributes

sint32 _MaxX
sint32 _MaxY
sint32 _MinX
sint32 _MinY
std::vector< SZoneUnit2_Zones

Static Protected Attributes

std::string _StringOutOfBound


Constructor & Destructor Documentation

NLLIGO::CZoneRegion::CZoneRegion  ) 
 

Definition at line 151 of file zone_region.cpp.

References _MaxX, _MaxY, _MinX, _MinY, _StringOutOfBound, and STRING_OUT_OF_BOUND.

00152 {
00153         _StringOutOfBound = STRING_OUT_OF_BOUND;
00154         _MinX = _MinY = 0;
00155         _MaxX = _MaxY = -1;
00156 }


Member Function Documentation

void NLLIGO::CZoneRegion::basicSet sint32  x,
sint32  y,
sint32  PosX,
sint32  PosY,
const std::string &  ZoneName
 

Definition at line 317 of file zone_region.cpp.

References _MaxX, _MaxY, _MinX, _MinY, resize(), sint32, stride, uint8, x, and y.

00318 {
00319         // Do we need to resize ?
00320         if ((x < _MinX) || (x > _MaxX) ||
00321                 (y < _MinY) || (y > _MaxY))
00322         {
00323                 sint32 newMinX = (x<_MinX?x:_MinX), newMinY = (y<_MinY?y:_MinY);
00324                 sint32 newMaxX = (x>_MaxX?x:_MaxX), newMaxY = (y>_MaxY?y:_MaxY);
00325 
00326                 resize (newMinX, newMaxX, newMinY, newMaxY);
00327         }
00328         sint32 stride = (1+_MaxX-_MinX); // Nb to go to next line
00329 
00330         _Zones[(x-_MinX)+(y-_MinY)*stride].ZoneName = ZoneName;
00331         _Zones[(x-_MinX)+(y-_MinY)*stride].PosX = (uint8)PosX;
00332         _Zones[(x-_MinX)+(y-_MinY)*stride].PosY = (uint8)PosY;
00333 }

uint8 NLLIGO::CZoneRegion::getCutEdge sint32  x,
sint32  y,
uint8  pos
const
 

Definition at line 259 of file zone_region.cpp.

References _MaxX, _MaxY, _MinX, _MinY, sint32, uint8, x, and y.

00260 {
00261         if ((x < _MinX) || (x > _MaxX) ||
00262                 (y < _MinY) || (y > _MaxY))
00263         {
00264                 return 0;
00265         }
00266         else
00267         {
00268                 return _Zones[(x-_MinX)+(y-_MinY)*(1+_MaxX-_MinX)].SharingCutEdges[pos];
00269         }
00270 }

uint32 NLLIGO::CZoneRegion::getDate sint32  x,
sint32  y,
uint8  lowOrHigh
const
 

Definition at line 273 of file zone_region.cpp.

References sint32, uint32, uint8, x, and y.

00274 {
00275         if ((x < _MinX) || (x > _MaxX) ||
00276                 (y < _MinY) || (y > _MaxY))
00277         {
00278                 return 0;
00279         }
00280         else
00281         {
00282                 if (lowOrHigh == 0)
00283                         return _Zones[(x-_MinX)+(y-_MinY)*(1+_MaxX-_MinX)].DateLow;
00284                 else
00285                         return _Zones[(x-_MinX)+(y-_MinY)*(1+_MaxX-_MinX)].DateHigh;
00286         }
00287 }

uint8 NLLIGO::CZoneRegion::getFlip sint32  x,
sint32  y
const
 

Definition at line 245 of file zone_region.cpp.

References _MaxX, _MaxY, _MinX, _MinY, sint32, uint8, x, and y.

00246 {
00247         if ((x < _MinX) || (x > _MaxX) ||
00248                 (y < _MinY) || (y > _MaxY))
00249         {
00250                 return 0;
00251         }
00252         else
00253         {
00254                 return _Zones[(x-_MinX)+(y-_MinY)*(1+_MaxX-_MinX)].Flip;
00255         }
00256 }

sint32 NLLIGO::CZoneRegion::getMaxX  )  const [inline]
 

Definition at line 88 of file zone_region.h.

References _MaxX, and sint32.

00088 { return _MaxX; };

sint32 NLLIGO::CZoneRegion::getMaxY  )  const [inline]
 

Definition at line 90 of file zone_region.h.

References _MaxY, and sint32.

00090 { return _MaxY; };

sint32 NLLIGO::CZoneRegion::getMinX  )  const [inline]
 

Definition at line 87 of file zone_region.h.

References _MinX, and sint32.

00087 { return _MinX; };

sint32 NLLIGO::CZoneRegion::getMinY  )  const [inline]
 

Definition at line 89 of file zone_region.h.

References _MinY, and sint32.

00089 { return _MinY; };

const string & NLLIGO::CZoneRegion::getName sint32  x,
sint32  y
const
 

Definition at line 189 of file zone_region.cpp.

References _MaxX, _MaxY, _MinX, _MinY, _StringOutOfBound, sint32, x, and y.

00190 {
00191         if ((x < _MinX) || (x > _MaxX) ||
00192                 (y < _MinY) || (y > _MaxY))
00193         {
00194                 return _StringOutOfBound;
00195         }
00196         else
00197         {
00198                 return _Zones[(x-_MinX)+(y-_MinY)*(1+_MaxX-_MinX)].ZoneName;
00199         }
00200 }

uint8 NLLIGO::CZoneRegion::getPosX sint32  x,
sint32  y
const
 

Definition at line 203 of file zone_region.cpp.

References _MaxX, _MaxY, _MinX, _MinY, sint32, uint8, x, and y.

00204 {
00205         if ((x < _MinX) || (x > _MaxX) ||
00206                 (y < _MinY) || (y > _MaxY))
00207         {
00208                 return 0;
00209         }
00210         else
00211         {
00212                 return _Zones[(x-_MinX)+(y-_MinY)*(1+_MaxX-_MinX)].PosX;
00213         }
00214 }

uint8 NLLIGO::CZoneRegion::getPosY sint32  x,
sint32  y
const
 

Definition at line 217 of file zone_region.cpp.

References _MaxX, _MaxY, _MinX, _MinY, sint32, uint8, x, and y.

00218 {
00219         if ((x < _MinX) || (x > _MaxX) ||
00220                 (y < _MinY) || (y > _MaxY))
00221         {
00222                 return 0;
00223         }
00224         else
00225         {
00226                 return _Zones[(x-_MinX)+(y-_MinY)*(1+_MaxX-_MinX)].PosY;
00227         }
00228 }

uint8 NLLIGO::CZoneRegion::getRot sint32  x,
sint32  y
const
 

Definition at line 231 of file zone_region.cpp.

References _MaxX, _MaxY, _MinX, _MinY, sint32, uint8, x, and y.

00232 {
00233         if ((x < _MinX) || (x > _MaxX) ||
00234                 (y < _MinY) || (y > _MaxY))
00235         {
00236                 return 0;
00237         }
00238         else
00239         {
00240                 return _Zones[(x-_MinX)+(y-_MinY)*(1+_MaxX-_MinX)].Rot;
00241         }
00242 }

uint8 NLLIGO::CZoneRegion::getSharingCutEdges sint32  x,
sint32  y,
uint  edge
 

Definition at line 417 of file zone_region.cpp.

References _MaxX, _MaxY, _MinX, _MinY, sint32, uint, uint8, x, and y.

00418 {
00419         if ((x < _MinX) || (x > _MaxX) ||
00420                 (y < _MinY) || (y > _MaxY))
00421         {
00422                 return 0xff;
00423         }
00424         else
00425         {
00426                 return _Zones[(x-_MinX)+(y-_MinY)*(1+_MaxX-_MinX)].SharingCutEdges[edge];
00427         }
00428 }

std::string NLLIGO::CZoneRegion::getSharingMatNames sint32  x,
sint32  y,
uint  edge
 

Definition at line 402 of file zone_region.cpp.

References _MaxX, _MaxY, _MinX, _MinY, _StringOutOfBound, sint32, uint, x, and y.

00403 {
00404         if ((x < _MinX) || (x > _MaxX) ||
00405                 (y < _MinY) || (y > _MaxY))
00406         {
00407                 return _StringOutOfBound;
00408         }
00409         else
00410         {
00411                 return _Zones[(x-_MinX)+(y-_MinY)*(1+_MaxX-_MinX)].SharingMatNames[edge];
00412         }
00413 }

void NLLIGO::CZoneRegion::resize sint32  newMinX,
sint32  newMaxX,
sint32  newMinY,
sint32  newMaxY
 

Definition at line 290 of file zone_region.cpp.

References _MaxX, _MaxY, _MinX, _MinY, and sint32.

Referenced by basicSet().

00291 {
00292         sint32 i, j;
00293         vector<SZoneUnit2> newZones;
00294         SZoneUnit2 zuTmp;
00295 
00296         newZones.resize ((1+newMaxX-newMinX)*(1+newMaxY-newMinY));
00297         sint32 newStride = 1+newMaxX-newMinX;
00298         sint32 Stride = 1+_MaxX-_MinX;
00299         for (j = newMinY; j <= newMaxY; ++j)
00300         for (i = newMinX; i <= newMaxX; ++i)
00301         {
00302                 if ((i >= _MinX)&&(i <= _MaxX)&&(j >= _MinY)&&(j <= _MaxY))
00303                 {
00304                         newZones[(i-newMinX)+(j-newMinY)*newStride] = _Zones[(i-_MinX)+(j-_MinY)*Stride];
00305                 }
00306                 else
00307                 {
00308                         newZones[(i-newMinX)+(j-newMinY)*newStride] = zuTmp;
00309                 }
00310         }
00311         _MinX = newMinX; _MaxX = newMaxX;
00312         _MinY = newMinY; _MaxY = newMaxY;
00313         _Zones = newZones;
00314 }

void NLLIGO::CZoneRegion::serial NLMISC::IStream f  ) 
 

Definition at line 159 of file zone_region.cpp.

References _MaxX, _MaxY, _MinX, _MinY, NLMISC::IStream::serialCheck(), NLMISC::IStream::serialCont(), NLMISC::IStream::serialVersion(), sint32, uint32, NLMISC::IStream::xmlPop(), NLMISC::IStream::xmlPush(), and NLMISC::IStream::xmlSerial().

00160 {
00161         f.xmlPush ("LAND");
00162                 
00163                 sint32 version = f.serialVersion (1);
00164                 f.serialCheck ((uint32)'DNAL');
00165                 
00166                 f.xmlSerial (_MinX, "MIN_X");
00167                 f.xmlSerial (_MinY, "MIN_Y");
00168                 f.xmlSerial (_MaxX, "MAX_X");
00169                 f.xmlSerial (_MaxY, "MAX_Y");
00170 
00171                 if (version == 1)
00172                 {
00173                         f.serialCont (_Zones);
00174                 }
00175 
00176                 if (version == 0)
00177                 {
00178                         std::vector<SZoneUnit> vZonesTmp;
00179                         f.serialCont (vZonesTmp);
00180                         _Zones.resize (vZonesTmp.size());
00181                         for (uint32 i = 0; i < vZonesTmp.size(); ++i)
00182                                 _Zones[i] = vZonesTmp[i];
00183                 }
00184 
00185         f.xmlPop ();
00186 }

bool NLLIGO::CZoneRegion::setFlip sint32  x,
sint32  y,
uint8  newValue
 

Definition at line 496 of file zone_region.cpp.

References _MaxX, _MaxY, _MinX, _MinY, sint32, uint8, x, and y.

00497 {
00498         if ((x < _MinX) || (x > _MaxX) ||
00499                 (y < _MinY) || (y > _MaxY))
00500         {
00501                 return false;
00502         }
00503         else
00504         {
00505                 _Zones[(x-_MinX)+(y-_MinY)*(1+_MaxX-_MinX)].Flip = newValue;
00506                 return true;
00507         }
00508 }

void NLLIGO::CZoneRegion::setMaxX sint32  newValue  )  [inline]
 

Definition at line 93 of file zone_region.h.

References _MaxX, and sint32.

00093 { _MaxX = newValue; };

void NLLIGO::CZoneRegion::setMaxY sint32  newValue  )  [inline]
 

Definition at line 95 of file zone_region.h.

References _MaxY, and sint32.

00095 { _MaxY = newValue; };

void NLLIGO::CZoneRegion::setMinX sint32  newValue  )  [inline]
 

Definition at line 92 of file zone_region.h.

References _MinX, and sint32.

00092 { _MinX = newValue; };

void NLLIGO::CZoneRegion::setMinY sint32  newValue  )  [inline]
 

Definition at line 94 of file zone_region.h.

References _MinY, and sint32.

00094 { _MinY = newValue; };

bool NLLIGO::CZoneRegion::setName sint32  x,
sint32  y,
const std::string &  newValue
 

Definition at line 432 of file zone_region.cpp.

References _MaxX, _MaxY, _MinX, _MinY, sint32, x, and y.

00433 {
00434         if ((x < _MinX) || (x > _MaxX) ||
00435                 (y < _MinY) || (y > _MaxY))
00436         {
00437                 return false;
00438         }
00439         else
00440         {
00441                 _Zones[(x-_MinX)+(y-_MinY)*(1+_MaxX-_MinX)].ZoneName = newValue;
00442                 return true;
00443         }
00444 }

bool NLLIGO::CZoneRegion::setPosX sint32  x,
sint32  y,
uint8  newValue
 

Definition at line 448 of file zone_region.cpp.

References _MaxX, _MaxY, _MinX, _MinY, sint32, uint8, x, and y.

00449 {
00450         if ((x < _MinX) || (x > _MaxX) ||
00451                 (y < _MinY) || (y > _MaxY))
00452         {
00453                 return false;
00454         }
00455         else
00456         {
00457                 _Zones[(x-_MinX)+(y-_MinY)*(1+_MaxX-_MinX)].PosX = newValue;
00458                 return true;
00459         }
00460 }

bool NLLIGO::CZoneRegion::setPosY sint32  x,
sint32  y,
uint8  newValue
 

Definition at line 464 of file zone_region.cpp.

References _MaxX, _MaxY, _MinX, _MinY, sint32, uint8, x, and y.

00465 {
00466         if ((x < _MinX) || (x > _MaxX) ||
00467                 (y < _MinY) || (y > _MaxY))
00468         {
00469                 return false;
00470         }
00471         else
00472         {
00473                 _Zones[(x-_MinX)+(y-_MinY)*(1+_MaxX-_MinX)].PosY = newValue;
00474                 return true;
00475         }
00476 }

bool NLLIGO::CZoneRegion::setRot sint32  x,
sint32  y,
uint8  newValue
 

Definition at line 480 of file zone_region.cpp.

References _MaxX, _MaxY, _MinX, _MinY, sint32, uint8, x, and y.

00481 {
00482         if ((x < _MinX) || (x > _MaxX) ||
00483                 (y < _MinY) || (y > _MaxY))
00484         {
00485                 return false;
00486         }
00487         else
00488         {
00489                 _Zones[(x-_MinX)+(y-_MinY)*(1+_MaxX-_MinX)].Rot = newValue;
00490                 return true;
00491         }
00492 }

bool NLLIGO::CZoneRegion::setSharingCutEdges sint32  x,
sint32  y,
uint  edge,
uint8  newValue
 

Definition at line 528 of file zone_region.cpp.

References _MaxX, _MaxY, _MinX, _MinY, sint32, uint, uint8, x, and y.

00529 {
00530         if ((x < _MinX) || (x > _MaxX) ||
00531                 (y < _MinY) || (y > _MaxY))
00532         {
00533                 return false;
00534         }
00535         else
00536         {
00537                 _Zones[(x-_MinX)+(y-_MinY)*(1+_MaxX-_MinX)].SharingCutEdges[edge] = newValue;
00538                 return true;
00539         }
00540 }

bool NLLIGO::CZoneRegion::setSharingMatNames sint32  x,
sint32  y,
uint  edge,
const std::string &  newValue
 

Definition at line 512 of file zone_region.cpp.

References _MaxX, _MaxY, _MinX, _MinY, sint32, uint, x, and y.

00513 {
00514         if ((x < _MinX) || (x > _MaxX) ||
00515                 (y < _MinY) || (y > _MaxY))
00516         {
00517                 return false;
00518         }
00519         else
00520         {
00521                 _Zones[(x-_MinX)+(y-_MinY)*(1+_MaxX-_MinX)].SharingMatNames[edge] = newValue;
00522                 return true;
00523         }
00524 }


Field Documentation

sint32 NLLIGO::CZoneRegion::_MaxX [protected]
 

Definition at line 132 of file zone_region.h.

Referenced by basicSet(), CZoneRegion(), getCutEdge(), getFlip(), getMaxX(), getName(), getPosX(), getPosY(), getRot(), getSharingCutEdges(), getSharingMatNames(), resize(), serial(), setFlip(), setMaxX(), setName(), setPosX(), setPosY(), setRot(), setSharingCutEdges(), and setSharingMatNames().

sint32 NLLIGO::CZoneRegion::_MaxY [protected]
 

Definition at line 132 of file zone_region.h.

Referenced by basicSet(), CZoneRegion(), getCutEdge(), getFlip(), getMaxY(), getName(), getPosX(), getPosY(), getRot(), getSharingCutEdges(), getSharingMatNames(), resize(), serial(), setFlip(), setMaxY(), setName(), setPosX(), setPosY(), setRot(), setSharingCutEdges(), and setSharingMatNames().

sint32 NLLIGO::CZoneRegion::_MinX [protected]
 

Definition at line 131 of file zone_region.h.

Referenced by basicSet(), CZoneRegion(), getCutEdge(), getFlip(), getMinX(), getName(), getPosX(), getPosY(), getRot(), getSharingCutEdges(), getSharingMatNames(), resize(), serial(), setFlip(), setMinX(), setName(), setPosX(), setPosY(), setRot(), setSharingCutEdges(), and setSharingMatNames().

sint32 NLLIGO::CZoneRegion::_MinY [protected]
 

Definition at line 131 of file zone_region.h.

Referenced by basicSet(), CZoneRegion(), getCutEdge(), getFlip(), getMinY(), getName(), getPosX(), getPosY(), getRot(), getSharingCutEdges(), getSharingMatNames(), resize(), serial(), setFlip(), setMinY(), setName(), setPosX(), setPosY(), setRot(), setSharingCutEdges(), and setSharingMatNames().

string NLLIGO::CZoneRegion::_StringOutOfBound [static, protected]
 

Definition at line 34 of file zone_region.cpp.

Referenced by CZoneRegion(), getName(), and getSharingMatNames().

std::vector<SZoneUnit2> NLLIGO::CZoneRegion::_Zones [protected]
 

Definition at line 130 of file zone_region.h.


The documentation for this class was generated from the following files:
Generated on Tue Mar 16 12:51:51 2004 for NeL by doxygen 1.3.6