bool FilterThreeWordsPhase::Filter(vector<NameProfile>& nameprofiles) { bool isok = false; vector<NameProfile> Outnameprofiles; try{ vector<NameProfile>::iterator iter = nameprofiles.begin(); for(iter = nameprofiles.begin(); iter != nameprofiles.end() ; ++iter){ bool bNeedAdd = false; int nsky = 1 + iter->Get_lastname_num(); int npeople = iter->Get_lastname_num() + iter->Get_name1_num(); int nearth = iter->Get_name1_num() + iter->Get_name2_num(); int phasesky = GetPhase((nsky%10)); int phasepeople = GetPhase((npeople%10)); int phaseearth = GetPhase((nearth%10)); bool bsky_people = IsAdjacent(phasesky,phasepeople); bool bpeople_earth = IsAdjacent(phasepeople,phaseearth); if(true==bsky_people && true==bpeople_earth){ // Add to new vector Outnameprofiles.push_back(*iter); } } nameprofiles.clear(); nameprofiles = Outnameprofiles; isok = true; } catch(...){ } return isok; }
void CQDM_Edit::FillHighlighted(bool CtrlDown) //fill the CurHighlighted array based on current drawing tool and coordinates { switch (CurDrawTool){ case DT_PEN:{ int ToAdd = V2DFindVoxelUnder(CurCoord); if (!IsInHighlighted(ToAdd) && ToAdd != -1) CurHighlighted.push_back(ToAdd); break; } case DT_BOX: { //could be shortened a little... Vec3D<> Loc; int x, y, z; Vec3D<> BB = Vec3D<>(Lattice.GetXDimAdj(), Lattice.GetYDimAdj(), Lattice.GetZDimAdj())*GetLatticeDim()/2; Vec3D<> V1 = CurCoord.Min(DownCoord); Vec3D<> V2 = CurCoord.Max(DownCoord); CurHighlighted.clear(); for (int i=0; i<Structure.GetArraySize(); i++){ //go through all voxels... GetXYZNom(&x, &y, &z, i); Loc = GetXYZ(i); //float LatDim = GetLatticeDim(); switch(CurSecAxis){ case ZAXIS: if (CurSecLayer != z) continue; //don't care if its not in this layer... if (Loc.x>V1.x-BB.x && Loc.x<V2.x+BB.x && Loc.y>V1.y-BB.y && Loc.y<V2.y+BB.y) CurHighlighted.push_back(i); break; case YAXIS: if (CurSecLayer != y) continue; //don't care if its not in this layer... if (Loc.x>V1.x-BB.x && Loc.x<V2.x+BB.x && Loc.z>V1.z-BB.z && Loc.z<V2.z+BB.z) CurHighlighted.push_back(i); break; case XAXIS: if (CurSecLayer != x) continue; //don't care if its not in this layer... if (Loc.y>V1.y-BB.y && Loc.y<V2.y+BB.y && Loc.z>V1.z-BB.z && Loc.z<V2.z+BB.z) CurHighlighted.push_back(i); break; } } break; } case DT_ELLIPSE: { Vec3D<> Offset, Off2, Size2; int x, y, z; Vec3D<> V1 = CurCoord.Min(DownCoord); Vec3D<> V2 = CurCoord.Max(DownCoord); int VoxN = V2DFindVoxelUnder(V1); //rounds to outside corners of voxels we've selected int VoxP = V2DFindVoxelUnder(V2); Vec3D<> LocN = GetXYZ(VoxN)-GetLatDimEnv()/2.0; Vec3D<> LocP = GetXYZ(VoxP)+GetLatDimEnv()/2.0; Vec3D<> Cen = (LocN+LocP)/2.0; Vec3D<> Size = (LocP-LocN)/2.0; CurHighlighted.clear(); for (int i=0; i<Structure.GetArraySize(); i++){ //go through all voxels... GetXYZNom(&x, &y, &z, i); Offset = GetXYZ(i)-Cen; Off2 = Offset.Scale(Offset); Size2 = Size.Scale(Size); double LatDim = GetLatticeDim(); switch(CurSecAxis){ case ZAXIS: if (CurSecLayer != z) continue; //don't care if its not in this layer... if (Off2.x/Size2.x + Off2.y/Size2.y<1.0001) CurHighlighted.push_back(i); break; case YAXIS: if (CurSecLayer != y) continue; //don't care if its not in this layer... if (Off2.x/Size2.x + Off2.z/Size2.z<1.0001) CurHighlighted.push_back(i); break; case XAXIS: if (CurSecLayer != x) continue; //don't care if its not in this layer... if (Off2.y/Size2.y + Off2.z/Size2.z<1.0001) CurHighlighted.push_back(i); break; } } break; } case DT_BUCKET: { int CVox = V2DFindVoxelUnder(CurCoord); int ThisMat = GetMat(CVox); CurHighlighted.clear(); CurHighlighted.push_back(CVox); //put the first index on the buffer... // if (ViewSection) int Iter = 0; int Xi, Yi, Zi, curInd, tmpInd; while (Iter != (int)CurHighlighted.size()){ curInd = CurHighlighted[Iter]; GetXYZNom(&Xi, &Yi, &Zi, curInd); //this location... for (int i=-1; i<=1; i++){for (int j=-1; j<=1; j++){for (int k=-1; k<=1; k++){ if (i!=0 && !CtrlDown && (ViewSection && CurSecAxis == XAXIS)) continue; //if we are out of plane of current viewing section if (j!=0 && !CtrlDown&& (ViewSection && CurSecAxis == YAXIS)) continue; if (k!=0 && !CtrlDown && (ViewSection && CurSecAxis == ZAXIS)) continue; tmpInd = GetIndex(Xi+i, Yi+j, Zi+k); if (IsAdjacent(curInd, tmpInd, true) && GetMat(tmpInd) == ThisMat && !IsInHighlighted(tmpInd)) CurHighlighted.push_back(tmpInd); }}} Iter++; } } } }