From: Carsten Niehaus Date: Wed, 7 Jun 2006 10:56:19 +0000 (+0000) Subject: * Adding a very first version of the CML-classes X-Git-Tag: v3.80.2~82 X-Git-Url: https://git.rmz.fi/?a=commitdiff_plain;h=4b8669758d474dfb81aeab646aba1dd664e6ddb7;p=libqmvoc.git * Adding a very first version of the CML-classes svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=549072 --- diff --git a/libscience/CMakeLists.txt b/libscience/CMakeLists.txt index e22377a..3aa77f9 100644 --- a/libscience/CMakeLists.txt +++ b/libscience/CMakeLists.txt @@ -1,6 +1,7 @@ add_subdirectory(data) add_subdirectory(tests) +add_subdirectory(cml) ########### next target ############### diff --git a/libscience/cml/CMakeLists.txt b/libscience/cml/CMakeLists.txt new file mode 100644 index 0000000..d9c4257 --- /dev/null +++ b/libscience/cml/CMakeLists.txt @@ -0,0 +1,15 @@ +include_directories( ${CMAKE_SOURCE_DIR}/libkdeedu/libscience ) + +set(cml_LIB_SRCS + cmlclasses.cpp +# xml_cml.cpp +) + +kde4_automoc(${cml_LIB_SRCS}) + +kde4_add_library(cml SHARED ${cml_LIB_SRCS}) + +target_link_libraries(cml ${QT_QTXML_LIBRARY} ${QT_QTCORE_LIBRARY} ) + +install_targets(${LIB_INSTALL_DIR} cml ) + diff --git a/libscience/cml/cmlclasses.cpp b/libscience/cml/cmlclasses.cpp new file mode 100644 index 0000000..1476713 --- /dev/null +++ b/libscience/cml/cmlclasses.cpp @@ -0,0 +1,34 @@ +/*************************************************************************** + * Copyright (C) 2006 by Carsten Niehaus * + * cniehaus@kde.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ +#include "cmlclasses.h" +#include +using namespace CML; + +Molecule::Molecule() +{ +} + +Atom::Atom() +{ +} + +Bond::Bond() +{ +} diff --git a/libscience/cml/cmlclasses.h b/libscience/cml/cmlclasses.h new file mode 100644 index 0000000..e1f0603 --- /dev/null +++ b/libscience/cml/cmlclasses.h @@ -0,0 +1,104 @@ +#ifndef CMLCLASSES_H +#define CMLCLASSES_H +/*************************************************************************** + * Copyright (C) 2006 by Carsten Niehaus * + * cniehaus@kde.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ + +#include +#include + +namespace CML +{ + +class Molecule +{ + public: + Molecule(); + +}; + +class Atom +{ + public: + Atom( ); + + void setID( const QString& id ){ + m_id = id; + } + + void setElementType( const QString& et ){ + m_elementType = et; + } + + void setiX2( int i ){ + coord_x2 = i; + } + + void setiX3( int i ){ + coord_x3 = i; + } + + void setiY2( int i ){ + coord_y2 = i; + } + + void setiY3( int i ){ + coord_y3 = i; + } + + void setiZ3( int i ){ + coord_z3 = i; + } + + private: + QString m_elementType; + QString m_id; + + //we need to store five possible coordinates, 2 for 2d, 3 for 3d + double coord_x2, coord_x3, + coord_y2, coord_y3, + coord_z3; +}; + +class Bond +{ + public: + Bond(); + + /** + * defines the two Atoms which start and stop the bond + */ + void setAtoms( CML::Atom* a1, CML::Atom* a2 ){ + m_start = a1; + m_end = a2; + } + + void setOrder( int o ){ + m_order = o; + } + + private: + Atom* m_start; + Atom* m_end; + + int m_order; +}; + +} +#endif // CMLCLASSES_H diff --git a/libscience/cml/test.cml b/libscience/cml/test.cml new file mode 100644 index 0000000..de138bb --- /dev/null +++ b/libscience/cml/test.cml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + +