Panda3D
dxfLayerMap.cxx
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file dxfLayerMap.cxx
10  * @author drose
11  * @date 2004-05-04
12  */
13 
14 #include "dxfLayerMap.h"
15 #include "dxfFile.h"
16 
17 /**
18  * Looks up the layer name in the map, and returns a pointer to the associated
19  * DXFLayer. If this is the first time this layer name has been used, creates
20  * a new DXFLayer by the given name. In this case, it calls
21  * dxffile->new_layer() to create the layer, allowing user code to override
22  * this function to create a specialized time, if desired.
23  */
25 get_layer(const std::string &name, DXFFile *dxffile) {
26  iterator lmi;
27  lmi = find(name);
28  if (lmi != end()) {
29  // The layer was already here.
30  return (*lmi).second;
31  }
32 
33  // Need a new layer.
34  DXFLayer *layer = dxffile->new_layer(name);
35  (*this)[name] = layer;
36 
37  return layer;
38 }
This represents a "layer" as read from the DXF file.
Definition: dxfLayer.h:28
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A generic DXF-reading class.
Definition: dxfFile.h:35
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
DXFLayer * get_layer(const std::string &name, DXFFile *dxffile)
Looks up the layer name in the map, and returns a pointer to the associated DXFLayer.
Definition: dxfLayerMap.cxx:25