Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…nto table_scroll_to_selection
  • Loading branch information
pklampros committed Jul 12, 2020
2 parents 1aa75ce + a5dd45a commit e787f15
Show file tree
Hide file tree
Showing 42 changed files with 881 additions and 239 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ depthmapX-build
build
RegressionTest/rundir
__pycache__
depthmapX.pro.user
CMakeLists.txt.user
*_BACKUP_*
*_BASE_*
*_LOCAL_*
Expand Down
3 changes: 3 additions & 0 deletions .mailmap
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Petros Koutsolampros <[email protected]> <[email protected]>
Petros Koutsolampros <[email protected]> Petros Koutsolampros <[email protected]>
Petros Koutsolampros <[email protected]> Petros <[email protected]>
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9" CACHE STRING "Minimum macOS deployment version")
project(depthmapX)
cmake_minimum_required(VERSION 3.13.0)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)

if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR
"${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
Expand Down
17 changes: 12 additions & 5 deletions cliTest/testlinkparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,6 @@ TEST_CASE("LINK args invalid", "")
LinkParser p;
REQUIRE_THROWS_WITH(p.parse(ah.argc(), ah.argv()), Catch::Contains("Invalid link provided"));
}
{
ArgumentHolder ah{"prog", "-f", "infile", "-o", "outfile", "-m", "LINK", "-lnk", "1.2,3.4,5.6,7.8", "-lm", "unlink", "-lmt", "pointmaps"};
LinkParser p;
REQUIRE_THROWS_WITH(p.parse(int(ah.argc()), ah.argv()), Catch::Contains("unlinking is not supported for pointmaps"));
}
}

TEST_CASE("LINK args valid", "valid")
Expand All @@ -73,6 +68,7 @@ TEST_CASE("LINK args valid", "valid")
cmdP.parse(int(ah.argc()), ah.argv());
REQUIRE(cmdP.getManualLinks().size() == 1);
REQUIRE(cmdP.getManualLinks()[0] == "1.2,3.4,5.6,7.8");
REQUIRE(cmdP.getLinkMode() == cmdP.LinkMode::LINK);
}

{
Expand All @@ -82,6 +78,17 @@ TEST_CASE("LINK args valid", "valid")
REQUIRE(cmdP.getManualLinks().size() == 2);
REQUIRE(cmdP.getManualLinks()[0] == "1.2,3.4,5.6,7.8");
REQUIRE(cmdP.getManualLinks()[1] == "0.1,0.2,0.3,0.4");
REQUIRE(cmdP.getLinkMode() == cmdP.LinkMode::LINK);
}

{
ArgumentHolder ah{"prog", "-f", "infile", "-o", "outfile", "-m", "LINK", "-lnk", "1.2,3.4,5.6,7.8", "-lnk", "0.1,0.2,0.3,0.4",
"-lm", "unlink", "-lmt", "pointmaps"};
LinkParser cmdP;
cmdP.parse(ah.argc(), ah.argv());
REQUIRE(cmdP.getManualLinks().size() == 2);
REQUIRE(cmdP.getManualLinks()[0] == "1.2,3.4,5.6,7.8");
REQUIRE(cmdP.getManualLinks()[1] == "0.1,0.2,0.3,0.4");
REQUIRE(cmdP.getLinkMode() == cmdP.LinkMode::UNLINK);
}
}
10 changes: 9 additions & 1 deletion depthmapX/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,16 @@ if(UNIX AND NOT APPLE)
add_executable(${depthmapX} ${depthmapX_SRCS} ${UI_HDRS} ${DM_RSRC})
endif()
if(APPLE)
set(MACOSX_BUNDLE_ICON_FILE depthmapX.icns)
set(depthmapX_ICON ${CMAKE_CURRENT_SOURCE_DIR}/icons/depthmapX.icns)
set_source_files_properties(${depthmapX_ICON} PROPERTIES
MACOSX_PACKAGE_LOCATION "Resources")
set(graph_ICON ${CMAKE_CURRENT_SOURCE_DIR}/icons/graph.icns)
set_source_files_properties(${graph_ICON} PROPERTIES
MACOSX_PACKAGE_LOCATION "Resources")
add_definitions(-DGL_SILENCE_DEPRECATION)
add_executable(${depthmapX} MACOSX_BUNDLE ${depthmapX_SRCS} ${UI_HDRS} ${DM_RSRC})
add_executable(${depthmapX} MACOSX_BUNDLE ${depthmapX_ICON} ${graph_ICON}
${depthmapX_SRCS} ${UI_HDRS} ${DM_RSRC})
set_target_properties(${depthmapX} PROPERTIES
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/resources/Info.plist)
endif(APPLE)
Expand Down
4 changes: 4 additions & 0 deletions depthmapX/dialogs/settings/interfacepage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,13 @@ InterfacePage::InterfacePage(Settings &settings, QWidget *parent)
QCheckBox *legacyMapCheckBox = new QCheckBox(tr("Legacy map window as default"));
legacyMapCheckBox->setChecked(m_defaultMapWindowIsLegacy);
connect(legacyMapCheckBox, &QCheckBox::stateChanged, [=] () {m_defaultMapWindowIsLegacy = !m_defaultMapWindowIsLegacy;});
QCheckBox *hoverCheckBox = new QCheckBox(tr("Allow highlighting shapes on hover"));
hoverCheckBox->setChecked(m_highlightOnHover);
connect(hoverCheckBox, &QCheckBox::stateChanged, [=] () {m_highlightOnHover = !m_highlightOnHover;});

QVBoxLayout *generalLayout = new QVBoxLayout;
generalLayout->addWidget(legacyMapCheckBox);
generalLayout->addWidget(hoverCheckBox);
generalGroup->setLayout(generalLayout);

QGroupBox *interfaceColoursGroup = new QGroupBox(tr("Interface colours"));
Expand Down
3 changes: 3 additions & 0 deletions depthmapX/dialogs/settings/interfacepage.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@ class InterfacePage : public SettingsPage
std::map<QListWidgetItem *, QColor *> colourMap;
int m_antialiasingSamples = 0;
bool m_defaultMapWindowIsLegacy = false;
bool m_highlightOnHover = true;
void readSettings(Settings &settings) {
m_foreground = QColor(settings.readSetting(SettingTag::foregroundColour, qRgb(128,255,128)).toInt());
m_background = QColor(settings.readSetting(SettingTag::backgroundColour, qRgb(0,0,0)).toInt());
m_antialiasingSamples = settings.readSetting(SettingTag::antialiasingSamples, 0).toInt();
m_defaultMapWindowIsLegacy = settings.readSetting(SettingTag::legacyMapWindow, false).toBool();
m_highlightOnHover = settings.readSetting(SettingTag::highlightOnHover, true).toBool();
}
private slots:
void onInterfaceColourlItemClicked(QListWidgetItem *item);
Expand All @@ -46,5 +48,6 @@ private slots:
settings.writeSetting(SettingTag::foregroundColour, m_foreground.rgb());
settings.writeSetting(SettingTag::antialiasingSamples, m_antialiasingSamples);
settings.writeSetting(SettingTag::legacyMapWindow, m_defaultMapWindowIsLegacy);
settings.writeSetting(SettingTag::highlightOnHover, m_highlightOnHover);
}
};
16 changes: 16 additions & 0 deletions depthmapX/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1069,68 +1069,84 @@ void MainWindow::updateActiveWindows()
{
case ID_MAPBAR_ITEM_SELECT:
SelectButton->setChecked(true);
activeMapView()->OnEditSelect();
break;
case ID_MAPBAR_ITEM_MOVE:
DragButton->setChecked(true);
activeMapView()->OnViewPan();
break;
case ID_MAPBAR_ITEM_ZOOM_IN:
zoomToolButton->setIcon(QIcon(":/images/win/b-5-3.png"));
zoomToolButton->setChecked(true);
zoomInAct->setChecked(true);
activeMapView()->OnViewZoomIn();
break;
case ID_MAPBAR_ITEM_ZOOM_OUT:
zoomToolButton->setIcon(QIcon(":/images/win/b-5-4.png"));
zoomToolButton->setChecked(true);
zoomOutAct->setChecked(true);
activeMapView()->OnViewZoomOut();
break;
case ID_MAPBAR_ITEM_FILL:
fillColorToolButton->setChecked(true);
activeMapView()->OnEditFill();
break;
case ID_MAPBAR_ITEM_SEMIFILL:
fillColorToolButton->setChecked(true);
activeMapView()->OnEditSemiFill();
break;
case ID_MAPBAR_ITEM_AUGMENT_FILL: // AV TV
fillColorToolButton->setChecked(true);
activeMapView()->OnEditAugmentFill();
break;
case ID_MAPBAR_ITEM_PENCIL:
SelectPenButton->setChecked(true);
activeMapView()->OnEditPencil();
break;
case ID_MAPBAR_ITEM_LINETOOL:
lineToolButton->setIcon(QIcon(":/images/win/b-5-10.png"));
lineToolButton->setChecked(true);
SelectLineAct->setChecked(true);
activeMapView()->OnEditLineTool();
break;
case ID_MAPBAR_ITEM_POLYGON:
lineToolButton->setIcon(QIcon(":/images/win/b-5-11.png"));
lineToolButton->setChecked(true);
SelectPolyLineAct->setChecked(true);
activeMapView()->OnEditPolygonTool();
break;
case ID_MAPBAR_ITEM_ISOVIST:
newisoToolButton->setIcon(QIcon(":/images/win/b-5-12.png"));
newisoToolButton->setChecked(true);
MakeIosAct->setChecked(true);
activeMapView()->OnModeIsovist();
break;
case ID_MAPBAR_ITEM_HALFISOVIST:
newisoToolButton->setIcon(QIcon(":/images/win/b-5-13.png"));
newisoToolButton->setChecked(true);
PartialMakeIosAct->setChecked(true);
activeMapView()->OnModeTargetedIsovist();
break;
case ID_MAPBAR_ITEM_AL2:
AxialMapButton->setChecked(true);
activeMapView()->OnModeSeedAxial();
break;
case ID_MAPBAR_ITEM_JOIN:
JoinToolButton->setIcon(QIcon(":/images/win/b-5-16.png"));
JoinToolButton->setChecked(true);
JoinAct->setChecked(true);
activeMapView()->OnModeJoin();
break;
case ID_MAPBAR_ITEM_UNJOIN:
JoinToolButton->setIcon(QIcon(":/images/win/b-5-17.png"));
JoinToolButton->setChecked(true);
JoinUnlinkAct->setChecked(true);
activeMapView()->OnModeUnjoin();
break;
default:
SelectButton->setChecked(true);
SelectButton->setChecked(false);
activeMapView()->OnEditSelect();
break;
}
QGraphDoc* m_p = activeMapDoc();
Expand Down
95 changes: 72 additions & 23 deletions depthmapX/resources/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,81 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>CFBundleIconFile</key>
<string>depthmapX.icns</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>depthmapX</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>graph</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>graph.icns</string>
<key>CFBundleTypeName</key>
<string>Graph File</string>
<key>CFBundleTypeOSTypes</key>
<array>
<string>graph</string>
</array>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>NSDocumentClass</key>
<string>GraphDocument</string>
</dict>
</array>
<key>CFBundleExecutable</key>
<string>depthmapX</string>
<key>CFBundleIconFile</key>
<string>depthmapX.icns</string>
<key>CFBundleIdentifier</key>
<string>com.spacegroupucl.depthmapX</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>graph</string>
</array>
<key>CFBundleTypeName</key>
<string>Graph File</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleTypeIconFile</key>
<string>graph.icns</string>
</dict>
</array>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>depthmapX</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
</array>
<key>LSApplicationCategoryType</key>
<string>public.app-category.business</string>
<key>LSHasLocalizedDisplayName</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>depthmapXApplication</string>
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<string>public.data</string>
<key>UTTypeDescription</key>
<string>Graph File</string>
<key>UTTypeIdentifier</key>
<string>com.spacegroupucl.graph</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>com.apple.ostype</key>
<array>
<string>GRAPH</string>
</array>
<key>public.filename-extension</key>
<string>graph</string>
<key>public.mime-type</key>
<string>application/graph</string>
</dict>
</dict>
</array>
</dict>
</plist>
1 change: 1 addition & 0 deletions depthmapX/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ namespace SettingTag
const QString licenseAccepted = "licenseAccepted";
const QString depthmapViewSize = "depthmapViewSize";
const QString legacyMapWindow = "legacyMapWindow";
const QString highlightOnHover = "highlightOnHover";
}

/**
Expand Down
2 changes: 1 addition & 1 deletion depthmapX/views/glview/glpolygons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* This class is an OpenGL representation of multiple polygons of different colour
*/

void GLPolygons::loadPolygonData(const std::map<std::vector<Point2f>, PafColor>& colouredPolygons)
void GLPolygons::loadPolygonData(const std::vector<std::pair<std::vector<Point2f>, PafColor>>& colouredPolygons)
{
m_polygons.clear();
for (auto& colouredPolygon: colouredPolygons)
Expand Down
2 changes: 1 addition & 1 deletion depthmapX/views/glview/glpolygons.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
class GLPolygons
{
public:
void loadPolygonData(const std::map<std::vector<Point2f>, PafColor>& colouredPolygons);
void loadPolygonData(const std::vector<std::pair<std::vector<Point2f>, PafColor> > &colouredPolygons);
void paintGL(const QMatrix4x4 &m_mProj, const QMatrix4x4 &m_mView, const QMatrix4x4 &m_mModel);
void initializeGL(bool m_core);
void updateGL(bool m_core);
Expand Down
16 changes: 13 additions & 3 deletions depthmapX/views/glview/glshapemap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,18 @@

#include "glshapemap.h"

void GLShapeMap::loadGLObjects(const std::vector<std::pair<SimpleLine, PafColor>> &colouredLines,
const std::vector<std::pair<std::vector<Point2f>, PafColor>>& colouredPolygons,
const std::vector<std::pair<Point2f, PafColor>> &colouredPoints,
const int pointSides, const float pointRadius) {
m_lines.loadLineData(colouredLines);
m_polygons.loadPolygonData(colouredPolygons);
m_points.loadPolygonData(colouredPoints, pointSides, pointRadius);
}

void GLShapeMap::loadGLObjects(ShapeMap &shapeMap) {
m_lines.loadLineData(shapeMap.getAllLinesWithColour());
m_polygons.loadPolygonData(shapeMap.getAllPolygonsWithColour());
m_points.loadPolygonData(shapeMap.getAllPointsWithColour(), 8, shapeMap.getSpacing()*0.1);
loadGLObjects(shapeMap.getAllLinesWithColour(),
shapeMap.getAllPolygonsWithColour(),
shapeMap.getAllPointsWithColour(),
8, shapeMap.getSpacing()*0.1);
}
4 changes: 4 additions & 0 deletions depthmapX/views/glview/glshapemap.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ class GLShapeMap
m_polygons.paintGL(m_mProj, m_mView, m_mModel);
m_points.paintGL(m_mProj, m_mView, m_mModel);
}
void loadGLObjects(const std::vector<std::pair<SimpleLine, PafColor>> &colouredLines,
const std::vector<std::pair<std::vector<Point2f>, PafColor>> &colouredPolygons,
const std::vector<std::pair<Point2f, PafColor>> &colouredPoints,
const int pointSides, const float pointRadius);
void loadGLObjects(ShapeMap &shapeMap);
private:
GLLines m_lines;
Expand Down
Loading

0 comments on commit e787f15

Please sign in to comment.