Panda3D

Loading...
Searching...
No Matches
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 */
24 DXFLayer *DXFLayerMap::
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}
DXFFile
A generic DXF-reading class.
Definition dxfFile.h:35
DXFLayerMap::get_layer
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
DXFLayer
This represents a "layer" as read from the DXF file.
Definition dxfLayer.h:28
dxfFile.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
dxfLayerMap.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.