NCBI C++ ToolKit
coord_set.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: coord_set.cpp 33815 2007-05-04 17:18:18Z kazimird $
2 * ===========================================================================
3 *
4 * PUBLIC DOMAIN NOTICE
5 * National Center for Biotechnology Information
6 *
7 * This software/database is a "United States Government Work" under the
8 * terms of the United States Copyright Act. It was written as part of
9 * the author's official duties as a United States Government employee and
10 * thus cannot be copyrighted. This software/database is freely available
11 * to the public for use. The National Library of Medicine and the U.S.
12 * Government have not placed any restriction on its use or reproduction.
13 *
14 * Although all reasonable efforts have been taken to ensure the accuracy
15 * and reliability of the software and data, the NLM and the U.S.
16 * Government do not and cannot warrant the performance or results that
17 * may be obtained by using this software or data. The NLM and the U.S.
18 * Government disclaim all warranties, express or implied, including
19 * warranties of performance, merchantability or fitness for any particular
20 * purpose.
21 *
22 * Please cite the author in any work or product based on this material.
23 *
24 * ===========================================================================
25 *
26 * Authors: Paul Thiessen
27 *
28 * File Description:
29 * Classes to hold sets of coordinates for atoms and features
30 *
31 * ===========================================================================
32 */
33 
34 #include <ncbi_pch.hpp>
35 #include <corelib/ncbistd.hpp>
36 
43 
45 
46 #include "coord_set.hpp"
47 #include "atom_set.hpp"
48 #include "object_3d.hpp"
49 #include "cn3d_tools.hpp"
50 
53 
54 
55 BEGIN_SCOPE(Cn3D)
56 
58  const CBiostruc_model::TModel_coordinates& modelCoords) :
59  StructureBase(parent), atomSet(NULL)
60 {
61  // iterate SEQUENCE OF Model-coordinate-set
62  CBiostruc_model::TModel_coordinates::const_iterator j, je=modelCoords.end();
63  for (j=modelCoords.begin(); j!=je; ++j) {
65  coordSet = j->GetObject().GetCoordinates();
66  if (coordSet.IsLiteral()) {
67  const CCoordinates& coords = coordSet.GetLiteral();
68 
69  // coordinates of atoms
70  if (coords.IsAtomic()) {
71  if (!atomSet)
72  atomSet = new AtomSet(this, coords.GetAtomic());
73  else
74  ERRORMSG("confused by multiple atomic coords");
75  }
76 
77  // coordinates of 3d-objects
78  else if (coords.IsSurface() && j->GetObject().IsSetDescr() &&
79  j->GetObject().GetDescr().front().GetObject().IsOther_comment() &&
80  coords.GetSurface().GetContents().IsResidues()) {
81 
82  const string& descr =
83  j->GetObject().GetDescr().front().GetObject().GetOther_comment();
84 
85  // helix cylinder
86  if (descr == "helix" && coords.GetSurface().GetSurface().IsCylinder()) {
87  Helix3D *helix =
88  new Helix3D(this, coords.GetSurface().GetSurface().GetCylinder(),
89  coords.GetSurface().GetContents().GetResidues());
90  if (helix->moleculeID == Object3D::VALUE_NOT_SET) {
91  delete helix;
92  WARNINGMSG("bad helix");
93  } else
94  objectMap[helix->moleculeID].push_back(helix);
95 
96  // strand brick
97  } else if (descr == "strand" && coords.GetSurface().GetSurface().IsBrick()) {
98  Strand3D *strand =
99  new Strand3D(this, coords.GetSurface().GetSurface().GetBrick(),
100  coords.GetSurface().GetContents().GetResidues());
101  if (strand->moleculeID == Object3D::VALUE_NOT_SET) {
102  delete strand;
103  WARNINGMSG("bad strand");
104  } else
105  objectMap[strand->moleculeID].push_back(strand);
106  }
107  }
108  }
109  }
110 }
111 
112 END_SCOPE(Cn3D)
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
CBiostruc_model –.
CCoordinates –.
Definition: Coordinates.hpp:66
int moleculeID
Definition: object_3d.hpp:53
static const int VALUE_NOT_SET
Definition: object_3d.hpp:51
#define WARNINGMSG(stream)
Definition: cn3d_tools.hpp:85
#define ERRORMSG(stream)
Definition: cn3d_tools.hpp:86
USING_SCOPE(objects)
USING_NCBI_SCOPE
Definition: coord_set.cpp:51
Include a standard set of the NCBI C++ Toolkit most basic headers.
#define NULL
Definition: ncbistd.hpp:225
#define END_SCOPE(ns)
End the previously defined scope.
Definition: ncbistl.hpp:75
#define BEGIN_SCOPE(ns)
Define a new scope.
Definition: ncbistl.hpp:72
const TResidues & GetResidues(void) const
Get the variant data.
bool IsResidues(void) const
Check if variant Residues is selected.
const TContents & GetContents(void) const
Get the Contents member data.
const TSurface & GetSurface(void) const
Get the Surface member data.
const TAtomic & GetAtomic(void) const
Get the variant data.
const TCylinder & GetCylinder(void) const
Get the variant data.
bool IsCylinder(void) const
Check if variant Cylinder is selected.
const TSurface & GetSurface(void) const
Get the variant data.
const TLiteral & GetLiteral(void) const
Get the variant data.
const TBrick & GetBrick(void) const
Get the variant data.
bool IsSurface(void) const
Check if variant Surface is selected.
bool IsBrick(void) const
Check if variant Brick is selected.
bool IsLiteral(void) const
Check if variant Literal is selected.
bool IsAtomic(void) const
Check if variant Atomic is selected.
#define const
Definition: zconf.h:232
Modified on Mon May 06 04:52:45 2024 by modify_doxy.py rev. 669887