1 // -*- c-basic-offset: 4 -*- 2 3 /** @file LensCalTypes.cpp 4 * 5 * @brief implementation of helper class for LensCal 6 * 7 * @author T. Modes 8 * 9 */ 10 11 /* 12 * This program is free software; you can redistribute it and/or 13 * modify it under the terms of the GNU General Public 14 * License as published by the Free Software Foundation; either 15 * version 2 of the License, or (at your option) any later version. 16 * 17 * This software is distributed in the hope that it will be useful, 18 * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 * General Public License for more details. 21 * 22 * You should have received a copy of the GNU General Public 23 * License along with this software. If not, see 24 * <http://www.gnu.org/licenses/>. 25 * 26 */ 27 28 #include "panoinc_WX.h" 29 #include "panoinc.h" 30 #include "LensCalTypes.h" 31 #include "base_wx/platform.h" 32 ImageLineList(wxString newFilename)33ImageLineList::ImageLineList(wxString newFilename) 34 { 35 SetFilename(newFilename); 36 m_edge=new vigra::BImage(); 37 }; 38 ~ImageLineList()39ImageLineList::~ImageLineList() 40 { 41 delete m_panoImage; 42 if(m_edge) 43 delete m_edge; 44 }; 45 GetNrOfValidLines()46const unsigned int ImageLineList::GetNrOfValidLines() 47 { 48 unsigned int count=0; 49 for(unsigned int i=0;i<m_lines.size();i++) 50 { 51 if(m_lines[i].status==HuginLines::valid_line) 52 count++; 53 }; 54 return count; 55 }; 56 SetEdgeImage(vigra::BImage * newEdgeImage)57void ImageLineList::SetEdgeImage(vigra::BImage* newEdgeImage) 58 { 59 if(m_edge) 60 delete m_edge; 61 m_edge=newEdgeImage; 62 }; 63 GetEdgeImage()64vigra::BImage* ImageLineList::GetEdgeImage() 65 { 66 return m_edge; 67 }; 68 SetFilename(wxString newFilename)69void ImageLineList::SetFilename(wxString newFilename) 70 { 71 m_filename=newFilename; 72 std::string filenamestring(newFilename.mb_str(HUGIN_CONV_FILENAME)); 73 m_panoImage=new HuginBase::SrcPanoImage; 74 m_panoImage->setFilename(filenamestring); 75 m_panoImage->readEXIF(); 76 m_panoImage->applyEXIFValues(); 77 if(m_panoImage->getCropFactor()<=0) 78 { 79 m_panoImage->readCropfactorFromDB(); 80 }; 81 m_panoImage->readProjectionFromDB(); 82 //reset roll to 0, it could be 90/-90/180 if loaded an image with Exif rotation tag 83 m_panoImage->setRoll(0); 84 //reset exposure value to prevent exposure correction when calculating corrected preview 85 m_panoImage->setExposureValue(0); 86 }; 87 GetFilename()88const wxString ImageLineList::GetFilename() 89 { 90 return m_filename; 91 }; 92 GetPanoImage()93HuginBase::SrcPanoImage* ImageLineList::GetPanoImage() 94 { 95 return m_panoImage; 96 }; 97 SetLines(HuginLines::Lines lines)98void ImageLineList::SetLines(HuginLines::Lines lines) 99 { 100 m_lines=lines; 101 }; 102 GetLines()103const HuginLines::Lines ImageLineList::GetLines() 104 { 105 return m_lines; 106 }; 107 ScaleLines(double scaleFactor)108void ImageLineList::ScaleLines(double scaleFactor) 109 { 110 HuginLines::ScaleLines(m_lines,scaleFactor); 111 }; 112 113