Attached you will find a patch, which will show which images are connected with 
control points.

It's inspired by 
http://sourceforge.net/tracker/index.php?func=detail&aid=1871631&group_id=77506&atid=550444
 by Yuv.

The images in the combo box on the control point tab appear green or red, when 
there are connections with the image marked in the other combo box - green when 
all CP distance below 5, red when at least one CP has an error >5.

Tested under Windows and it works. Under Linux or MacOS it needs testing.

Thomas
-- 
Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: 
http://www.gmx.net/de/go/multimessenger01

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"hugin and other free panoramic software" group.
A list of frequently asked questions is available at: 
http://wiki.panotools.org/Hugin_FAQ
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at http://groups.google.com/group/hugin-ptx
-~----------~----~----~----~------~----~------~--~---

Index: src/hugin1/hugin/CMakeLists.txt
===================================================================
--- src/hugin1/hugin/CMakeLists.txt     (Revision 3630)
+++ src/hugin1/hugin/CMakeLists.txt     (Arbeitskopie)
@@ -23,7 +23,7 @@
 # sources
 set(hugin_SOURCES
 huginApp.cpp ImagesList.cpp AutoCtrlPointCreator.cpp
-MainFrame.cpp CPImageCtrl.cpp CPEditorPanel.cpp LensPanel.cpp 
+MainFrame.cpp CPImageCtrl.cpp CPImagesComboBox.cpp CPEditorPanel.cpp 
LensPanel.cpp 
 ImagesPanel.cpp CommandHistory.cpp PanoPanel.cpp NonaOptionsDialog.cpp
 PreviewFrame.cpp PreviewPanel.cpp GLPreviewFrame.cpp GLViewer.cpp 
GLRenderer.cpp
 CropPanel.cpp OptimizePhotometricPanel.cpp OptimizePanel.cpp CPListFrame.cpp
Index: src/hugin1/hugin/CPEditorPanel.cpp
===================================================================
--- src/hugin1/hugin/CPEditorPanel.cpp  (Revision 3630)
+++ src/hugin1/hugin/CPEditorPanel.cpp  (Arbeitskopie)
@@ -94,8 +94,8 @@
 BEGIN_EVENT_TABLE(CPEditorPanel, wxPanel)
     EVT_CPEVENT(CPEditorPanel::OnCPEvent)
 #ifdef HUGIN_CP_IMG_CHOICE
-    EVT_CHOICE(XRCID("cp_editor_left_choice"), 
CPEditorPanel::OnLeftChoiceChange )
-    EVT_CHOICE(XRCID("cp_editor_right_choice"), 
CPEditorPanel::OnRightChoiceChange )
+    EVT_COMBOBOX(XRCID("cp_editor_left_choice"), 
CPEditorPanel::OnLeftChoiceChange )
+    EVT_COMBOBOX(XRCID("cp_editor_right_choice"), 
CPEditorPanel::OnRightChoiceChange )
 #endif
 #ifdef HUGIN_CP_IMG_TAB
     EVT_NOTEBOOK_PAGE_CHANGED ( 
XRCID("cp_editor_left_tab"),CPEditorPanel::OnLeftImgChange )
@@ -168,7 +168,7 @@
     m_leftTabs->SetSizeHints(1,tabH,1000,tabH,-1,-1);
 #endif
 #ifdef HUGIN_CP_IMG_CHOICE
-    m_leftChoice = XRCCTRL(*this, "cp_editor_left_choice", wxChoice);          
             
+    m_leftChoice = XRCCTRL(*this, "cp_editor_left_choice", CPImagesComboBox); 
 #endif
 
 #if 0
@@ -187,7 +187,7 @@
     m_rightTabs->SetSizeHints(1,tabH,1000,tabH,-1,-1);
 #endif
 #ifdef HUGIN_CP_IMG_CHOICE
-    m_rightChoice = XRCCTRL(*this, "cp_editor_right_choice", wxChoice);        
             
+    m_rightChoice = XRCCTRL(*this, "cp_editor_right_choice", CPImagesComboBox);
 #endif
 
 #if 0
@@ -360,6 +360,8 @@
         if (m_leftChoice->GetSelection() != (int) imgNr) {
             m_leftChoice->SetSelection(imgNr);
         }
+               m_rightChoice->SetRefImage(m_pano,m_leftImageNr);
+               m_rightChoice->Refresh();
 #endif
 #ifdef HUGIN_CP_IMG_TAB
         if (m_leftTabs->GetSelection() != (int) imgNr) {
@@ -400,17 +402,19 @@
         m_rightRot = GetRot(yaw, pitch, roll);
         m_rightImg->setImage(m_pano->getImage(imgNr).getFilename(), 
m_rightRot);
         // select tab
+        m_rightImageNr = imgNr;
 #ifdef HUGIN_CP_IMG_CHOICE
         if (m_rightChoice->GetSelection() != (int) imgNr) {
             m_rightChoice->SetSelection(imgNr);
         }
+               m_leftChoice->SetRefImage(m_pano,m_rightImageNr);
+               m_leftChoice->Refresh();
 #endif
 #ifdef HUGIN_CP_IMG_TAB
         if (m_rightTabs->GetSelection() != (int) imgNr) {
             m_rightTabs->SetSelection(imgNr);
         }
 #endif
-        m_rightImageNr = imgNr;
         m_rightFile = m_pano->getImage(imgNr).getFilename();
         // update the rest of the display (new control points etc)
         changeState(NO_POINT);
@@ -628,6 +632,10 @@
     SelectGlobalPoint(lPoint);
     changeState(NO_POINT);
     MainFrame::Get()->SetStatusText(_("new control point added"));
+#ifdef HUGIN_CP_IMG_CHOICE
+       m_leftChoice->CalcCPDistance(m_pano);
+       m_rightChoice->CalcCPDistance(m_pano);
+#endif
 }
 
 
@@ -1467,6 +1475,10 @@
     wxLogError(wxString::Format(wxT("panoramaImagesChanged. After 
update\nleft: %d, right: %d, count: %d %d"), ls, rs, nrTabsNew));
 #endif
     */
+#ifdef HUGIN_CP_IMG_CHOICE
+       m_leftChoice->CalcCPDistance(m_pano);
+       m_rightChoice->CalcCPDistance(m_pano);
+#endif
 }
 
 void CPEditorPanel::UpdateDisplay(bool newPair)
@@ -1956,6 +1968,10 @@
         GlobalCmdHist::getInstance().addCommand(
             new PT::RemoveCtrlPointCmd(*m_pano,pNr )
             );
+#ifdef HUGIN_CP_IMG_CHOICE
+               m_leftChoice->CalcCPDistance(m_pano);
+               m_rightChoice->CalcCPDistance(m_pano);
+#endif
     }
 }
 
Index: src/hugin1/hugin/CPEditorPanel.h
===================================================================
--- src/hugin1/hugin/CPEditorPanel.h    (Revision 3630)
+++ src/hugin1/hugin/CPEditorPanel.h    (Arbeitskopie)
@@ -42,6 +42,7 @@
 
 #include <PT/Panorama.h>
 
+#include "CPImagesComboBox.h"
 
 // Always use wxChoice, the tabs behave badly with many images on GTK as well.
 #define HUGIN_CP_IMG_CHOICE
@@ -265,8 +266,8 @@
 
     // GUI controls
 #ifdef HUGIN_CP_IMG_CHOICE
-    wxChoice *m_leftChoice;
-    wxChoice *m_rightChoice;
+    CPImagesComboBox *m_leftChoice;
+    CPImagesComboBox *m_rightChoice;
 #endif
 #ifdef HUGIN_CP_IMG_TAB
     wxNotebook *m_leftTabs, *m_rightTabs;
Index: src/hugin1/hugin/CPImagesComboBox.cpp
===================================================================
--- src/hugin1/hugin/CPImagesComboBox.cpp       (Revision 0)
+++ src/hugin1/hugin/CPImagesComboBox.cpp       (Revision 0)
@@ -0,0 +1,85 @@
+#include "hugin/CPImagesComboBox.h"
+
+void CPImagesComboBox::Init()
+{
+       CPConnection.resize(0);
+       refImage=0;
+};
+
+void CPImagesComboBox::OnDrawItem(wxDC& dc,
+                                                                 const wxRect& 
rect,
+                                                                 int item,
+                                                                 int 
WXUNUSED(flags)) const
+    {
+        if ( item == wxNOT_FOUND )
+            return;
+
+               if(CPConnection[item]==1)
+                       dc.SetTextForeground(*wxGREEN);
+               else if(CPConnection[item]==2)
+                       dc.SetTextForeground(*wxRED);
+
+        dc.DrawText(GetString(item),
+                    rect.x + 3,
+                    rect.y + ((rect.height - dc.GetCharHeight())/2)
+                   );
+    }
+
+void CPImagesComboBox::CalcCPDistance(Panorama * pano)
+{
+    CPConnection.clear();
+       //CPConnection.insert(0,this->GetCount(),0);
+       CPConnection.resize(this->GetCount(),0);
+       unsigned int noPts = pano->getNrOfCtrlPoints();
+    // loop over all points to calculate the error
+    for (unsigned int ptIdx = 0 ; ptIdx < noPts ; ptIdx++)
+    {
+        const ControlPoint & cp = pano->getCtrlPoint(ptIdx);
+               if(cp.image1Nr==refImage)
+               {
+                       if(cp.error>5.0)
+                CPConnection[cp.image2Nr]=2;
+                       else
+                               if(CPConnection[cp.image2Nr]==0)
+                                       CPConnection[cp.image2Nr]=1;
+               }
+               else if(cp.image2Nr==refImage)
+               {
+                       if(cp.error>5.0)
+                CPConnection[cp.image1Nr]=2;
+                       else
+                               if(CPConnection[cp.image1Nr]==0)
+                                       CPConnection[cp.image1Nr]=1;
+               };
+       }
+};
+
+IMPLEMENT_DYNAMIC_CLASS(CPImagesComboBox, wxOwnerDrawnComboBox)
+
+IMPLEMENT_DYNAMIC_CLASS(CPImagesComboBoxXmlHandler, 
wxOwnerDrawnComboBoxXmlHandler)
+
+CPImagesComboBoxXmlHandler::CPImagesComboBoxXmlHandler()
+                : wxOwnerDrawnComboBoxXmlHandler()
+{
+    AddWindowStyles();
+}
+
+wxObject *CPImagesComboBoxXmlHandler::DoCreateResource()
+{
+    XRC_MAKE_INSTANCE(cp, CPImagesComboBox)
+
+    cp->Create(m_parentAsWindow,
+                   GetID(), wxEmptyString,
+                   GetPosition(), GetSize(),
+                   GetStyle(wxT("style")), wxDefaultValidator,
+                   GetName());
+
+    SetupWindow( cp);
+
+    return cp;
+}
+
+bool CPImagesComboBoxXmlHandler::CanHandle(wxXmlNode *node)
+{
+    return IsOfClass(node, wxT("CPImagesComboBox"));
+}
Index: src/hugin1/hugin/CPImagesComboBox.h
===================================================================
--- src/hugin1/hugin/CPImagesComboBox.h (Revision 0)
+++ src/hugin1/hugin/CPImagesComboBox.h (Revision 0)
@@ -0,0 +1,71 @@
+// -*- c-basic-offset: 4 -*-
+/** @file CPImagesComboBox.h
+ *
+ *
+ *  This 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 software 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
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public
+ *  License along with this software; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+
+#ifndef _CPIMAGESCOMBOBOX_H
+#define _CPIMAGESCOMBOBOX_H
+
+// standard wx include
+//#include <config.h>
+#include "panoinc.h"
+#include "panoinc_WX.h"
+#include "wx/odcombo.h"
+#include "wx/xrc/xh_odcombo.h"
+
+
+using namespace std;
+using namespace PT;
+
+class CPImagesComboBox : public wxOwnerDrawnComboBox
+{
+public:
+    virtual void OnDrawItem(wxDC& dc,
+                            const wxRect& rect,
+                            int item,
+                            int WXUNUSED(flags)) const;
+       void CalcCPDistance(Panorama * pano);
+       void SetRefImage(Panorama * pano, unsigned int newRefImg)
+       {
+               refImage=newRefImg;
+               CalcCPDistance(pano);
+       };
+       const unsigned int GetRefImage()
+       {
+               return refImage;
+       };
+private:
+    unsigned int refImage;
+       std::vector<unsigned int> CPConnection;
+    void Init();
+
+       DECLARE_DYNAMIC_CLASS(CPImagesComboBox)
+};
+
+/** xrc handler */
+class CPImagesComboBoxXmlHandler : public wxOwnerDrawnComboBoxXmlHandler
+{
+    DECLARE_DYNAMIC_CLASS(CPImagesComboBoxXmlHandler)
+
+public:
+    CPImagesComboBoxXmlHandler();
+    virtual wxObject *DoCreateResource();
+    virtual bool CanHandle(wxXmlNode *node);
+};
+
+#endif
Index: src/hugin1/hugin/huginApp.cpp
===================================================================
--- src/hugin1/hugin/huginApp.cpp       (Revision 3630)
+++ src/hugin1/hugin/huginApp.cpp       (Arbeitskopie)
@@ -216,6 +216,7 @@
     wxXmlResource::Get()->AddHandler(new CenterCanvasXmlHandler());
     wxXmlResource::Get()->AddHandler(new CPEditorPanelXmlHandler());
     wxXmlResource::Get()->AddHandler(new CPImageCtrlXmlHandler());
+       wxXmlResource::Get()->AddHandler(new CPImagesComboBoxXmlHandler());
     wxXmlResource::Get()->AddHandler(new OptimizePanelXmlHandler());
     wxXmlResource::Get()->AddHandler(new OptimizePhotometricPanelXmlHandler());
     wxXmlResource::Get()->AddHandler(new PanoPanelXmlHandler());
Index: src/hugin1/hugin/PanoPanel.cpp
===================================================================
--- src/hugin1/hugin/PanoPanel.cpp      (Revision 3630)
+++ src/hugin1/hugin/PanoPanel.cpp      (Arbeitskopie)
@@ -53,6 +53,7 @@
 //#include "hugin/LensPanel.h"
 //#include "hugin/ImagesPanel.h"
 #include "hugin/CPImageCtrl.h"
+#include "hugin/CPImagesComboBox.h"
 #include "hugin/PanoPanel.h"
 #include "hugin/MainFrame.h"
 #include "hugin/huginApp.h"
Index: src/hugin1/hugin/xrc/cp_editor_panel.xrc
===================================================================
--- src/hugin1/hugin/xrc/cp_editor_panel.xrc    (Revision 3630)
+++ src/hugin1/hugin/xrc/cp_editor_panel.xrc    (Arbeitskopie)
@@ -26,8 +26,9 @@
                             <border>3</border>
                           </object>
                           <object class="sizeritem">
-                            <object class="wxChoice" 
name="cp_editor_left_choice">
+                            <object class="CPImagesComboBox" 
name="cp_editor_left_choice">
                               <content/>
+                              <style>wxCB_READONLY</style>
                             </object>
                             <option>1</option>
                             <flag>wxALL|wxADJUST_MINSIZE</flag>
@@ -58,8 +59,9 @@
                         <object class="wxBoxSizer">
                           <orient>wxHORIZONTAL</orient>
                           <object class="sizeritem">
-                            <object class="wxChoice" 
name="cp_editor_right_choice">
+                            <object class="CPImagesComboBox" 
name="cp_editor_right_choice">
                               <content/>
+                              <style>wxCB_READONLY</style>
                             </object>
                             <option>1</option>
                             <flag>wxALL|wxADJUST_MINSIZE</flag>
@@ -249,11 +251,11 @@
                              </object>
                              <flag>wxALL|wxALIGN_CENTRE_VERTICAL</flag>
                              <border>3</border>
-                          </object>    
+                          </object>    
                       </object>            
                       <flag>wxALL|wxEXPAND</flag>
                       <border>5</border>
-                    </object>                    
+                    </object>                    
                     <object class="sizeritem">
                       <object class="wxBoxSizer">
                         <orient>wxVERTICAL</orient>

Reply via email to