FreeChemicalFeature.h

Go to the documentation of this file.
00001 //
00002 //  Copyright (C) 2004-2008 Greg Landrum and Rational Discovery LLC
00003 //
00004 //  @@ All Rights Reserved @@
00005 //  This file is part of the RDKit.
00006 //  The contents are covered by the terms of the BSD license
00007 //  which is included in the file license.txt, found at the root
00008 //  of the RDKit source tree.
00009 //
00010 #ifndef __FREECHEMICALFEATURE_H_13012005_1023__
00011 #define __FREECHEMICALFEATURE_H_13012005_1023__
00012 
00013 #include <Geometry/point.h>
00014 #include <ChemicalFeatures/ChemicalFeature.h>
00015 
00016 namespace ChemicalFeatures {
00017 
00018   //------------------------------------------------------
00019   //! Class for chemical features that do not orignate from molecules
00020   //  e.g. pharamcophores, site-maps etc.
00021   class FreeChemicalFeature : public ChemicalFeature {
00022     public:
00023     //! start with everything specified
00024     FreeChemicalFeature(std::string family, std::string type,
00025                         const RDGeom::Point3D &loc) :
00026       d_family(family), d_type(type), d_position(loc) {
00027     }
00028 
00029     //! start with family and location specified, leave the type blank
00030     FreeChemicalFeature(std::string family, const RDGeom::Point3D &loc) :
00031       d_family(family), d_type(""), d_position(loc) {
00032     }
00033 
00034     //! start with everything blank
00035     FreeChemicalFeature() :
00036       d_family(""), d_type(""), d_position(RDGeom::Point3D(0.0, 0.0, 0.0)) {
00037     }
00038 
00039     explicit FreeChemicalFeature(const std::string &pickle) {
00040       this->initFromString(pickle);
00041     }
00042 
00043     FreeChemicalFeature(const FreeChemicalFeature &other) : 
00044       d_family(other.getFamily()), d_type(other.getType()), d_position(other.getPos())  {
00045     }
00046 
00047     ~FreeChemicalFeature() {}
00048 
00049     //! return our family
00050     const std::string& getFamily() const {
00051       return d_family;
00052     }
00053 
00054     //! return our type
00055     const std::string& getType() const {
00056       return d_type;
00057     }
00058 
00059     //! return our position
00060     RDGeom::Point3D getPos() const {
00061       return d_position;
00062     }
00063 
00064     //! set our family
00065     void setFamily(const std::string &family) {
00066       d_family = family;
00067     }
00068     
00069     //! set our type
00070     void setType(const std::string &type) {
00071       d_type = type;
00072     }
00073 
00074     //! set our position
00075     void setPos(const RDGeom::Point3D &loc) {
00076       //std::cout << loc.x << " " << loc.y << " " << loc.z << "\n";
00077       d_position = loc;
00078       //std::cout << d_position.x << " " << d_position.y << " " << d_position.z << "\n";
00079     }
00080 
00081     //! returns a serialized form of the feature (a pickle)
00082     std::string toString() const; 
00083     //! initialize from a pickle string
00084     void initFromString(const std::string &pickle);
00085     
00086   private:
00087     std::string d_family;
00088     std::string d_type;
00089     RDGeom::Point3D d_position;
00090   };
00091 }
00092   
00093 
00094 #endif
00095