Commit 9e0e602c authored by Robert Lancaster's avatar Robert Lancaster Committed by Jasem Mutlaq

Adding context menu to FITSViewer just like SkyMap. Label fixes. New center telescope icon

parent 09e751f6
......@@ -93,6 +93,7 @@ ColorScheme::ColorScheme() : FileName() {
appendItem("RAGuideError", i18n("RA Guide Error"), "#00FF00");
appendItem("DEGuideError", i18n("DEC Guide Error"), "#00A5FF");
appendItem("SolverFOVColor", i18n("Solver FOV"), "#FFFFFF");
appendItem("FITSObjectLabelColor", i18n("FITS Image Object Label"), "#00FF00");
//Load colors from config object
loadFromConfig();
......
......@@ -33,3 +33,4 @@
#00FF00 :RAGuideError
#00A5FF :DEGuideError
#FFFF00 :SolverFOV
#00FF00 :FITSObjectLabelColor
......@@ -33,3 +33,4 @@
#00FF00 :RAGuideError
#00A5FF :DEGuideError
#FFFF00 :SolverFOV
#00FF00 :FITSObjectLabelColor
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://web.resource.org/cc/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" width="100" height="100" id="svg2" version="1.0">
<g id="layer" >
<path style="stroke: #ff0000; stroke-width:10;" d="M 50,1 L 50,35 z " id="up"/>
<path style="stroke: #ff0000; stroke-width:10;" d="M 50,65 L 50,100 z " id="down"/>
<path style="stroke: #ff0000; stroke-width:10;" d="M 35,50 L 0,50 z " id="left"/>
<path style="stroke: #ff0000; stroke-width:10;" d="M 100,50 L 65,50 z " id="right"/>
<circle style="stroke:#ff0000; stroke-width:10;" cx="50" cy="50" r="33" fill="none"/>
</g>
</svg>
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M24 11h-2.051c-.469-4.725-4.224-8.48-8.949-8.95v-2.05h-2v2.05c-4.725.47-8.48 4.225-8.949 8.95h-2.051v2h2.051c.469 4.725 4.224 8.48 8.949 8.95v2.05h2v-2.05c4.725-.469 8.48-4.225 8.949-8.95h2.051v-2zm-11 8.931v-3.931h-2v3.931c-3.611-.454-6.478-3.32-6.931-6.931h3.931v-2h-3.931c.453-3.611 3.32-6.477 6.931-6.931v3.931h2v-3.931c3.611.454 6.478 3.319 6.931 6.931h-3.931v2h3.931c-.453 3.611-3.32 6.477-6.931 6.931zm1-7.931c0 1.104-.896 2-2 2s-2-.896-2-2 .896-2 2-2 2 .896 2 2z"/></svg>
\ No newline at end of file
......@@ -33,3 +33,4 @@
#00FF00 :RAGuideError
#00A5FF :DEGuideError
#FFFF00 :SolverFOV
#00FF00 :FITSObjectLabelColor
......@@ -33,3 +33,4 @@
#00FF00 :RAGuideError
#00A5FF :DEGuideError
#FFFF00 :SolverFOV
#950000 :FITSObjectLabelColor
......@@ -18,7 +18,6 @@
***************************************************************************/
#include <config-kstars.h>
#include "fitsview.h"
#include "kspopupmenu.h"
#include "skymap.h"
......@@ -154,6 +153,7 @@ Then it stores the current point so next time it can do it again.
*/
void FITSLabel::mouseMoveEvent(QMouseEvent *e)
{
float scale=(image->getCurrentZoom() / ZOOM_DEFAULT);
if(image->getMouseMode()==FITSView::dragMouse&&mouseButtonDown){
QPoint newPoint=e->globalPos();
......@@ -173,8 +173,8 @@ void FITSLabel::mouseMoveEvent(QMouseEvent *e)
if (buffer == NULL)
return;
x = round(e->x() / (image->getCurrentZoom() / ZOOM_DEFAULT));
y = round(e->y() / (image->getCurrentZoom() / ZOOM_DEFAULT));
x = round(e->x() / scale);
y = round(e->y() / scale);
x = KSUtils::clamp(x, 1.0, width);
y = KSUtils::clamp(y, 1.0, height);
......@@ -210,8 +210,8 @@ void FITSLabel::mouseMoveEvent(QMouseEvent *e)
bool objFound=false;
foreach(FITSSkyObject *listObject, image_data->objList){
if((abs(listObject->x()-x)<20)&&(abs(listObject->y()-y)<20)){
QToolTip::showText(e->globalPos(), listObject->skyObject()->name(), this);
if((abs(listObject->x()-x)<5/scale)&&(abs(listObject->y()-y)<5/scale)){
QToolTip::showText(e->globalPos(), listObject->skyObject()->name() +"\n"+listObject->skyObject()->longname() , this);
objFound=true;
break;
}
......@@ -235,6 +235,8 @@ do want to slew to the WCS coordinates associated with the click location. If s
void FITSLabel::mousePressEvent(QMouseEvent *e)
{
float scale=(image->getCurrentZoom() / ZOOM_DEFAULT);
if(image->getMouseMode()==FITSView::dragMouse)
{
mouseButtonDown=true;
......@@ -249,8 +251,8 @@ void FITSLabel::mousePressEvent(QMouseEvent *e)
wcs_point * wcs_coord = image_data->getWCSCoord();
double x,y;
x = round(e->x() / (image->getCurrentZoom() / ZOOM_DEFAULT));
y = round(e->y() / (image->getCurrentZoom() / ZOOM_DEFAULT));
x = round(e->x() / scale);
y = round(e->y() / scale);
x = KSUtils::clamp(x, 1.0, width);
y = KSUtils::clamp(y, 1.0, height);
......@@ -265,8 +267,8 @@ void FITSLabel::mousePressEvent(QMouseEvent *e)
double x,y;
x = round(e->x() / (image->getCurrentZoom() / ZOOM_DEFAULT));
y = round(e->y() / (image->getCurrentZoom() / ZOOM_DEFAULT));
x = round(e->x() / scale);
y = round(e->y() / scale);
x = KSUtils::clamp(x, 1.0, width);
y = KSUtils::clamp(y, 1.0, height);
......@@ -280,11 +282,22 @@ void FITSLabel::mousePressEvent(QMouseEvent *e)
if (image_data->hasWCS())
{
foreach(FITSSkyObject *listObject, image_data->objList){
if((abs(listObject->x()-x)<20)&&(abs(listObject->y()-y)<20)){
if((abs(listObject->x()-x)<5/scale)&&(abs(listObject->y()-y)<5/scale)){
SkyObject *object=listObject->skyObject();
KSPopupMenu *pmenu;
pmenu=new KSPopupMenu();
object->showPopupMenu(pmenu,e->globalPos());
QList<QAction *> actions= pmenu->actions();
foreach(QAction *action,actions){
if(action->text().left(7)=="Starhop")
pmenu->removeAction(action);
if(action->text().left(7)=="Angular")
pmenu->removeAction(action);
if(action->text().left(8)=="Add flag")
pmenu->removeAction(action);
if(action->text().left(12)=="Attach Label")
pmenu->removeAction(action);
}
KStars::Instance()->map()->setClickedObject(object);
break;
}
......@@ -1011,11 +1024,12 @@ bool FITSView::imageHasWCS(){
void FITSView::drawObjectNames(QPainter *painter)
{
painter->setPen( QPen( Qt::green) );
painter->setPen( QPen( QColor( KStarsData::Instance()->colorScheme()->colorNamed("FITSObjectLabelColor" ) ) ) );
float scale=(currentZoom / ZOOM_DEFAULT);
foreach(FITSSkyObject *listObject, image_data->getSkyObjects())
{
painter->drawText(listObject->x()*scale+10,listObject->y()*scale+10,listObject->skyObject()->name());
painter->drawRect(listObject->x()*scale-5,listObject->y()*scale-5,10,10);
painter->drawText(listObject->x()*scale+10,listObject->y()*scale+10,listObject->skyObject()->name());
}
}
......
......@@ -864,7 +864,7 @@ void FITSViewer::updateWCSFunctions()
actionCollection()->action("view_eq_grid")->setText( i18n( "Show Equatorial Gridlines\n*No WCS Info*" ));
actionCollection()->action("center_telescope")->setDisabled(true);
actionCollection()->action("center_telescope")->setText( i18n( "Center Telescope\n*No WCS Info*" ));
actionCollection()->action("view_objects")->setDisabled(false);
actionCollection()->action("view_objects")->setDisabled(true);
actionCollection()->action("view_objects")->setText( i18n( "Show Objects in Image\n*No WCS Info*" ));
}
......
......@@ -36,6 +36,8 @@
#include "kstarsdata.h"
#include "skymap.h"
#include "colorscheme.h"
#include "fitsviewer/fitsviewer.h"
#include "fitsviewer/fitsview.h"
#include "skyobjects/starobject.h"
static int ItemColorData = Qt::UserRole + 1;
......@@ -127,6 +129,10 @@ void OpsColors::newColor( QListWidgetItem *item ) {
}
KStars::Instance()->map()->forceUpdate();
QList<FITSViewer *> viewers = KStars::Instance()->findChildren<FITSViewer *>();
foreach(FITSViewer *viewer, viewers){
viewer->getCurrentView()->updateFrame();
}
}
void OpsColors::slotPreset( int index ) {
......@@ -160,6 +166,10 @@ bool OpsColors::setColors( const QString &filename ) {
}
KStars::Instance()->map()->forceUpdate();
QList<FITSViewer *> viewers = KStars::Instance()->findChildren<FITSViewer *>();
foreach(FITSViewer *viewer, viewers){
viewer->getCurrentView()->updateFrame();
}
return true;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment