ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-2.0/src/visitors/OtherVisitor.cpp
(Generate patch)

Comparing trunk/OOPSE-2.0/src/visitors/OtherVisitor.cpp (file contents):
Revision 1930 by gezelter, Wed Jan 12 22:41:40 2005 UTC vs.
Revision 2091 by gezelter, Tue Mar 8 21:07:49 2005 UTC

# Line 1 | Line 1
1 < /*
1 > /*
2   * Copyright (c) 2005 The University of Notre Dame. All Rights Reserved.
3   *
4   * The University of Notre Dame grants you ("Licensee") a
# Line 38 | Line 38
38   * University of Notre Dame has been advised of the possibility of
39   * such damages.
40   */
41 <
41 > #include "selection/SelectionManager.hpp"
42   #include "visitors/OtherVisitor.hpp"
43   #include "primitives/DirectionalAtom.hpp"
44   #include "primitives/RigidBody.hpp"
# Line 77 | Line 77 | void IgnoreVisitor::internalVisit(StuntDouble *sd) {
77   }
78  
79   void IgnoreVisitor::internalVisit(StuntDouble *sd) {
80 <    GenericData *data;
81 <    data = sd->getPropertyByName("IGNORE");
82 <
83 <    //if this stuntdoulbe is already marked as ignore just skip it
84 <    if (data == NULL) {
85 <        data = new GenericData;
86 <        data->setID("IGNORE");
87 <        sd->addProperty(data);
88 <    }
80 >    info->getSelectionManager()->clearSelection(sd);
81 >    //GenericData *data;
82 >    //data = sd->getPropertyByName("IGNORE");
83 >    //
84 >    ////if this stuntdoulbe is already marked as ignore just skip it
85 >    //if (data == NULL) {
86 >    //    data = new GenericData;
87 >    //    data->setID("IGNORE");
88 >    //    sd->addProperty(data);
89 >    //}
90   }
91  
92   const std::string IgnoreVisitor::toString() {
# Line 303 | Line 304 | void XYZVisitor::visit(Atom *atom) {
304   }
305  
306   void XYZVisitor::visit(Atom *atom) {
307 <    if (!isIgnore(atom))
307 >    if (isSelected(atom))
308          internalVisit(atom);
309   }
310  
311   void XYZVisitor::visit(DirectionalAtom *datom) {
312 <    if (!isIgnore(datom))
312 >    if (isSelected(datom))
313          internalVisit(datom);
314   }
315  
316   void XYZVisitor::visit(RigidBody *rb) {
317 <    if (!isIgnore(rb))
317 >    if (isSelected(rb))
318          internalVisit(rb);
319   }
320  
# Line 337 | Line 338 | void XYZVisitor::internalVisit(StuntDouble *sd) {
338  
339      for( atomInfo = atomData->beginAtomInfo(i); atomInfo;
340          atomInfo = atomData->nextAtomInfo(i) ) {
341 <        if (printDipole)
342 <            sprintf(buffer,
343 <                    "%s%15.8f%15.8f%15.8f%15.8f%15.8f%15.8f",
344 <                    atomInfo->AtomType.c_str(),
345 <                    atomInfo->pos[0],
346 <                    atomInfo->pos[1],
347 <                    atomInfo->pos[2],
348 <                    atomInfo->dipole[0],
349 <                    atomInfo->dipole[1],
350 <                    atomInfo->dipole[2]); else
351 <            sprintf(buffer,                     "%s%15.8f%15.8f%15.8f",
352 <                    atomInfo->AtomType.c_str(), atomInfo->pos[0],
353 <                    atomInfo->pos[1],           atomInfo->pos[2]);
354 <
341 >      printf("SD type is %s\n", sd->getType().c_str());
342 >      printf("XYZVisitor thinks %s\n", atomInfo->atomTypeName.c_str());
343 >      if (printDipole) {
344 >        sprintf(buffer,
345 >                "%s%15.8f%15.8f%15.8f%15.8f%15.8f%15.8f",
346 >                atomInfo->atomTypeName.c_str(),
347 >                atomInfo->pos[0],
348 >                atomInfo->pos[1],
349 >                atomInfo->pos[2],
350 >                atomInfo->dipole[0],
351 >                atomInfo->dipole[1],
352 >                atomInfo->dipole[2]);
353 >      } else {
354 >        sprintf(buffer,                     "%s%15.8f%15.8f%15.8f",
355 >                atomInfo->atomTypeName.c_str(), atomInfo->pos[0],
356 >                atomInfo->pos[1],           atomInfo->pos[2]);
357 >      }
358 >        
359          frame.push_back(buffer);
360      }
361   }
362  
363 < bool XYZVisitor::isIgnore(StuntDouble *sd) {
364 <    GenericData *data;
360 <
361 <    data = sd->getPropertyByName("IGNORE");
362 <    return data == NULL ? false : true;
363 > bool XYZVisitor::isSelected(StuntDouble *sd) {
364 >    return info->getSelectionManager()->isSelected(sd);
365   }
366  
367   void XYZVisitor::writeFrame(std::ostream &outStream) {
# Line 465 | Line 467 | const std::string PrepareVisitor::toString() {
467   }
468  
469   const std::string PrepareVisitor::toString() {
470 <    char buffer[65535];
471 <    std::string result;
472 <
473 <    sprintf(buffer,
474 <            "------------------------------------------------------------------\n");
475 <    result += buffer;
476 <
477 <    sprintf(buffer, "Visitor name: %s", visitorName.c_str());
478 <    result += buffer;
479 <
480 <    sprintf(buffer,
481 <            "Visitor Description: prepare for operation of other vistors\n");
482 <    result += buffer;
483 <
484 <    sprintf(buffer,
485 <            "------------------------------------------------------------------\n");
486 <    result += buffer;
487 <
488 <    return result;
470 >     char buffer[65535];
471 >     std::string result;
472 >
473 >     sprintf(buffer,
474 >             "------------------------------------------------------------------\n");
475 >     result += buffer;
476 >
477 >     sprintf(buffer, "Visitor name: %s", visitorName.c_str());
478 >     result += buffer;
479 >
480 >     sprintf(buffer,
481 >             "Visitor Description: prepare for operation of other vistors\n");
482 >     result += buffer;
483 >
484 >     sprintf(buffer,
485 >             "------------------------------------------------------------------\n");
486 >     result += buffer;
487 >
488 >     return result;
489   }
490  
491   //----------------------------------------------------------------------------//
# Line 523 | Line 525 | void WaterTypeVisitor::visit(RigidBody *rb) {
525                  continue;
526  
527              for( atomInfo = atomData->beginAtomInfo(i); atomInfo;
528 <                atomInfo = atomData->nextAtomInfo(i) ) {
529 <            replaceType(atomInfo->AtomType);
528 >                 atomInfo = atomData->nextAtomInfo(i) ) {
529 >              atomInfo->atomTypeName = trimmedName(atomInfo->atomTypeName);
530              } //end for(atomInfo)
531          }     //end for(atomIter)
532      }         //end if (waterTypeList.find(rbName) != waterTypeList.end())
533   }
534  
535 < void WaterTypeVisitor::replaceType(std::string&atomType) {
536 < atomType = atomType.substr(0, atomType.find('_'));
537 < }
535 >  std::string WaterTypeVisitor::trimmedName(const std::string&atomTypeName) {
536 >    return atomTypeName.substr(0, atomTypeName.find('_'));
537 >  }
538  
539   const std::string WaterTypeVisitor::toString() {
540      char buffer[65535];

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines