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