diff --git a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/CMakeLists.txt b/qt6-after/qt6-migrated-legatus/Lts/Application/THP/CMakeLists.txt deleted file mode 100755 index 29a89710c..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/CMakeLists.txt +++ /dev/null @@ -1,168 +0,0 @@ -# -# THP-Viewer -# -# Make ${Qt6_Gui} optional -if(QT6_GUI_AVAILABLE AND TARGET Qt6::Gui) - set(Qt6_Gui ${Qt6_Gui}) -else() - set(Qt6_Gui "") -endif() - -# Make ${Qt6_Widgets} optional -if(QT6_GUI_AVAILABLE AND TARGET Qt6::Widgets) - set(Qt6_Widgets ${Qt6_Widgets}) -else() - set(Qt6_Widgets "") -endif() - - -ADD_SUBDIRECTORY(THP-Starter) - -# Make VLC optional - only try to find it if user explicitly enables it -OPTION(WITH_VLC "Enable VLC support" OFF) -IF(WITH_VLC) - FIND_PACKAGE(VLC) - IF(VLC_FOUND) - SET(THP_HAS_VLC TRUE) - SET(THP_VLC_SOURCES - thpwidgets/thp_audio_video_widget.cpp - thpwidgets/thp_audio_video_widget.h - thpwidgets/thp_audio_video_widget_p.h - thpwidgets/thp_audio_video_widget.ui - ) - ELSE() - MESSAGE(WARNING "VLC requested but not found - building without VLC support") - SET(THP_HAS_VLC FALSE) - SET(THP_VLC_SOURCES "") - ENDIF() -ELSE() - SET(THP_HAS_VLC FALSE) - SET(THP_VLC_SOURCES "") -ENDIF() - -SET(thp_viewer_SRCS - main.cpp - thp_plugin_provider.cpp - thp_plugin_provider.h - thp_situation_filter_interface_impl.cpp - thp_situation_filter_interface_impl.h - thp_viewer.cpp - thp_viewer.h - - ${THP_VLC_SOURCES} - thpwidgets/thp_building_settings.cpp - thpwidgets/thp_building_settings.h - thpwidgets/thp_building_widget.cpp - thpwidgets/thp_building_widget.h - thpwidgets/thp_html_widget.cpp - thpwidgets/thp_html_widget.h - thpwidgets/thp_pdf_widget.cpp - thpwidgets/thp_pdf_widget.h - thpwidgets/thp_situation_building_base.h - thpwidgets/thp_situation_building_base.cpp - thpwidgets/thp_situation_filter_aes.cpp - thpwidgets/thp_situation_filter_aes.h - thpwidgets/thp_situation_filter_building_components.cpp - thpwidgets/thp_situation_filter_building_components.h - thpwidgets/thp_situation_filter_collapse_expand.cpp - thpwidgets/thp_situation_filter_collapse_expand.h - thpwidgets/thp_situation_filter_symbol_appearance.cpp - thpwidgets/thp_situation_filter_symbol_appearance.h - thpwidgets/thp_situation_filter_types.cpp - thpwidgets/thp_situation_filter_types.h - thpwidgets/thp_situation_widget.cpp - thpwidgets/thp_situation_widget.h - thpwidgets/thp_zoom_slider.cpp - thpwidgets/thp_zoom_slider.h -) - -NGL_WRAP_UI(thp_viewer_SRCS - thp_viewer.ui - ${THP_VLC_SOURCES} - thpwidgets/thp_building_settings.ui - thpwidgets/thp_html_widget.ui - thpwidgets/thp_pdf_widget.ui - thpwidgets/thp_situation_building_base.ui -) -IF(WIN32) - SET(JBN ${JENKINS_BUILD_NUMBER}) - IF (NOT JENKINS_BUILD_NUMBER) - SET(JBN "0") - ENDIF() - SET(THP_VERSION_INFO "${LTS_VERSION_MAJOR}, ${LTS_VERSION_MINOR}, ${JBN}, ${LTS_VERSION_PATCH}") - CONFIGURE_FILE(thp_viewer.rc.cmake ${CMAKE_CURRENT_BINARY_DIR}/thp_viewer.rc) - LIST(APPEND thp_viewer_SRCS ${CMAKE_CURRENT_BINARY_DIR}/thp_viewer.rc) -ENDIF(WIN32) -NGL_ADD_APP_ICON(thp_viewer_SRCS) - -NGL_ADD_EXECUTABLE(WS thp_viewer WIN32 ${thp_viewer_SRCS}) -NGL_INSTALL_TARGET(thp_viewer) -IF(VLC_FOUND) -NGL_TARGET_INCLUDE_DIRECTORIES(thp_viewer - PRIVATE - ${VLC_INCLUDE_DIR} -) -NGL_TARGET_COMPILE_DEFINITIONS(thp_viewer - PRIVATE -) -ENDIF() -if(QT6_GUI_AVAILABLE) - NGL_TARGET_LINK_LIBRARIES(thp_viewer - ArcGISQt5Hack # make sure it's loaded *before* libEsriCommonQt.so - - Qt6::Core - ${Qt6_Gui} - Qt6::PrintSupport - Qt6::Svg - Qt6::WebEngineCore - Qt6::WebEngineWidgets - ${Qt6_Widgets} - Qt6::Xml - - RmeLightStyleQrc - - AsbData - AsbForeignDataPluginThp - BuildingViewerCommon - FltAesGuiCommon - FltAesWidget - FltBldgCmpntWidget - FltParticipantWidget - IsmDataPluginThp - LtsCoordTrans - LtsCommandLineParser - NGLLogger - nglsingleapplication - ngltools - ngltranslator - nglwidgets - PdmComboBoxGui - PpmComboBoxGui - SitmapDds - SituationReplaySqlite - - svcFlmCommon - - svcAesClient - svcBldClient - svcCesClient - svcGimClient - $,svcIsmClient,> - svcPpmClient - svcPdmClient - svcAlmClient - ) -endif() -IF(VLC_FOUND) -NGL_TARGET_LINK_LIBRARIES(thp_viewer - $<$:PkgConfig::VLC> -) -ENDIF() -IF(WIN32) -# NGL_INSTALL(WS FILES autorun.inf DESTINATION bin) -# NGL_INSTALL(WS FILES readme.win32.en_US.txt DESTINATION bin) -# NGL_INSTALL(WS FILES readme.win32.de_DE.txt DESTINATION bin) -ENDIF() -NGL_INSTALL(WS FILES log4cxx_thp_viewer.props DESTINATION bin) - -ADD_SUBDIRECTORY(SitMapReplayTest) diff --git a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/README.txt b/qt6-after/qt6-migrated-legatus/Lts/Application/THP/README.txt deleted file mode 100755 index 56388c104..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/README.txt +++ /dev/null @@ -1,101 +0,0 @@ -# -# Hinweise für das THP -# -# $Id$ -# $HeadURL$ -# $Author$ -# - -N. Thoden, 12.03.2020 - -Das TakeHomePackage (für Windows) besteht aus 3 Komponenten: -============================================================ - -1) den THP-Viewer / THP-Starter - (inkl. Qt ; ohne MSVCRuntime, z.B. msvcr120.dll, in C:\Windows\system32 !?) - http://jenkins-master.sl.defence-elec.de:8080/job/ahtc_OC-Tablet/ - thp.tgz -2) die Kartendaten - (evtl. für den Datenträger reduziert in Bezug auf die Speichergröße) -3) die Topic-Daten (Video, Audio, DB-Abzug...) - - -Woher kommt was? -================ -1) Der THP-Viewer / THP-Starter - Kann aus der CI-Umgebung (Jenkins) heruntergeladen werden (thp.tgz) - Am besten mit 7Zip entpackt werden: - (tgz -> gepackt und anschliessend komprimiert) - - Per Kontext-Menue "entpacken nach hier" - - die resultierende Datei "thp' "entpacken nach thp~". - Dann sollte ein Verzeichnis "thp" MIT diversen Unterverzeichnissen entstehen. - - Das THP-Verzeichnis wird auf jeder Workstation im Ordner /opt/THP als Quelle für den USB-Datentraeger bereitgestellt. - -2) Diese werden manuell für das THP bereitgestellt (meist als tpk-Datei). - -3) Die Topic-Daten werden in der OpApp mit "Präsentation exportieren" erzeugt. - Sie werden unter /tmp/THP-Export generiert. - - -Woher kommt das Verzeichnis 'Maps'? -=================================== -Der Verzeichnisname 'Maps' ist fest und darf nicht verändert werden. -Es müssen die für das Medium (CD, DVD, Stick..) passenden Basiskarten/Kartendaten hinein. -Das sind also z.B. - - 2020-03-03_UaeAerial_32639_Lvl6.tpk - - 2020-03-03_UaeAerial_WebMerc_Lvl15.tpk - - 2020-03-03_UaeTopo_32639_Lvl6.tpk - - 2020-03-03_UaeTopo_WebMerc_Lvl15.tpk - - AHTC_utm_dgm_surface_wgs84.tif - -Das layerMapping.json hat nun die Aufgabe, diese (für das Übungsgebiet) spezifischen -Dateinamen zu abstrahieren. -Die bei der Ausführung des THPs geforderten Basiskarten (Annahme: eine Topo und zwei Aerial) -können mit Hilfe der layerMapping.json auf eine geringere Anzahl Dateien gemappt werden. - -Basiskarten: Mapping per layerMapping.json - in der WS-App: Dateien in Dir 'Maps' - -------------- --------------------- - - Aerial2 -> 2020-03-03_UaeAerial_32639_Lvl6.tpk - - Aerial1 -> 2020-03-03_UaeAerial_32639_Lvl6.tpk - - Topo -> 2020-03-03_UaeTopo_32639_Lvl6.tpk - -Best Practise: -Daher ergibt es Sinn, eine layerMapping.json in dem Verzeichnis 'Maps' vorzubereiten -und beim Zusammengefügen in die darüberliegende Dateiebene zu kopieren. - - -Wie müssen die 3 Komponenten zusammengefügt werden? -=================================================== - -Device: - - Excersise_6 - - 1 <- Übungsdaten (Komponenten 3) - - ... - - index.html <- Übungsdaten (Komponenten 3) - - ... <- Übungsdaten (Komponenten 3) - - - Maps <- Kartendaten (Komponenten 2) - - *.tpk - - [layerMapping.json] <- Sonderfall AHTC 03/2020: Diese Datei in - die darüberliegende Ebenen verschieben. - - layerMapping.json <- Übungsdaten (Komponenten 2/3) - (generiert, Sonderfall AHTC 03/2020: - aus 'Maps' hierher transferieren) - - - thp <- thp (Komponenten 1) - - resources <- thp (Komponenten 1), hat mal gefehlt) - - thv_viewer.exe <- thp (Komponenten 1) - - vc.redist.x64.exe <- thp (Komponenten 1), für MSVCRuntime - - thp_starter.exe <- thp (Komponenten 1) - - autorun.inf <- thp (Komponenten 1) - - [wappen.png] <- thp (Komponenten 1 oder 3) optional !? - - -Logfiles zuir Fehlersuche -========================= -Ein Logfile befindet sich unter ~Benutzer\AppData\Local\Temp\. -Bsp: C:\User\thoden\AppData\Local\Temp\thoden_thp.log - C:\User\thoden\AppData\Local\Temp\thoden_thp.log.1 - diff --git a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/SitMapReplayTest/CMakeLists.txt b/qt6-after/qt6-migrated-legatus/Lts/Application/THP/SitMapReplayTest/CMakeLists.txt deleted file mode 100755 index 38fd24f00..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/SitMapReplayTest/CMakeLists.txt +++ /dev/null @@ -1,40 +0,0 @@ -# -# SitMapReplayTest -# -SET(SRPTEST_SRCS - srp_main.cpp - srp_main_window.cpp - srp_main_window.h - ../thp_plugin_provider.cpp - ../thp_plugin_provider.h - ../thp_situation_filter_interface_impl.cpp - ../thp_situation_filter_interface_impl.h -) -NGL_WRAP_UI(SRPTEST_SRCS - srp_main_window.ui -) -NGL_ADD_EXECUTABLE(WS SitMapReplayTest ${SRPTEST_SRCS}) -NGL_TARGET_LINK_LIBRARIES(SitMapReplayTest - SituationReplaySqlite - - $,ddsconnector,> - Qt6::Core - nglapplication - SitmapDds - - AsbForeignDataPluginThp - BuildingViewerCommon - FltAesGuiCommon - IsmDataPluginThp - - svcFlmCommon - - svcAesClient - svcBldClient - svcCesClient - svcGimClient - $,svcIsmClient,> - svcPpmClient - svcPdmClient -) - diff --git a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/SitMapReplayTest/srp_main.cpp b/qt6-after/qt6-migrated-legatus/Lts/Application/THP/SitMapReplayTest/srp_main.cpp deleted file mode 100755 index 34268f7a8..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/SitMapReplayTest/srp_main.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/** - * @RDE_HEADER@ - * Main for SitMapReplayTest - * $Id$ - * $HeadURL$ - * $Author$ - * Created by Christian Ehrlicher, SLSE, 2016-02-29 - */ - -#include -#include -#include -#include -#include -#include -#include -#include "../thp_plugin_provider.h" -#include "srp_main_window.h" -#include "ui_srp_main_window.h" - -int main(int argc, char **argv) -{ - QNetworkProxy::setApplicationProxy(QNetworkProxy()); - NGLApplication app(argc, argv); - app.createLogger("SRP"); - app.setAttribute(Qt::AA_UseHighDpiPixmaps); - - SituationReplay::ConnectionParams connParams; - connParams.domainId = 1; - connParams.partitionId = 1; - std::shared_ptr srpMainHandler(new SituationReplay::MainHandlerSqlite); - if (!srpMainHandler->initDds(connParams)) - return 1; - // TODO: fixme or trash me - SituationReplay::ReplayInformation ri; - ri.databaseFilePath = QStringLiteral("dump.sqlite"); - ri.replayConfigPath = QStringLiteral("dump.json"); - if (!srpMainHandler->initDb(ri, {}, {})) - return 2; - - std::shared_ptr ddsConn = srpMainHandler->ddsReplay(); - THP::SitMapPluginProvider *pp = new THP::SitMapPluginProvider; - pp->init(ddsConn); - - SituationMap::SituationMapInit *smi = new SituationMap::SituationMapInit(nullptr); - smi->initPluginProvider(pp); - - QPointer movementTrackMgr = - QPointer(new SituationMap::MovementTrackManager(smi)); - - smi->initAdapter(movementTrackMgr, false); - smi->initMap(true, SituationMap::Mode::Mode_2D); - - SituationReplay::MainWindow *mw = new SituationReplay::MainWindow(smi, srpMainHandler->handlerSrp()); - mw->show(); - - int ret = app.exec(); - - delete mw; - delete smi; - delete pp; - ddsConn.reset(); - return ret; -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/SitMapReplayTest/srp_main_window.cpp b/qt6-after/qt6-migrated-legatus/Lts/Application/THP/SitMapReplayTest/srp_main_window.cpp deleted file mode 100755 index 9b98756d3..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/SitMapReplayTest/srp_main_window.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/** - * @RDE_HEADER@ - * MainWindow for SitMapReplayTest - * $Id$ - * $HeadURL$ - * $Author$ - * Created by Christian Ehrlicher, SLSE, 2016-02-29 - */ - -#include "srp_main_window.h" -#include "ui_srp_main_window.h" -#include -#include - -namespace SituationReplay -{ -MainWindow::MainWindow(SituationMap::SituationMapInit *sitMap, - const std::shared_ptr &srpHandler, - QWidget *parent) - : QMainWindow(parent) - , m_srpHandler(srpHandler) - , m_ui(new Ui::SrpMainWindow) -{ - m_ui->setupUi(this); - setCentralWidget(sitMap->getWidget()); - connect(m_ui->actionStart_Replay, &QAction::triggered, this, &MainWindow::onStartReplay); - connect(m_ui->actionStop_Replay, &QAction::triggered, this, &MainWindow::onStopReplay); -} - -MainWindow::~MainWindow() -{ - delete m_ui; -} - -void MainWindow::onStartReplay() -{ - const qint64 begin = (time(nullptr) - 60 * 60 * 30) * 1000; - const qint64 end = 0; - const double pace = 1; - m_srpHandler->onStartReplayRequest(begin, end, pace); -} - -void MainWindow::onStopReplay() -{ - m_srpHandler->onStopReplayRequest(); -} -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/SitMapReplayTest/srp_main_window.h b/qt6-after/qt6-migrated-legatus/Lts/Application/THP/SitMapReplayTest/srp_main_window.h deleted file mode 100755 index a4a6c0fa9..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/SitMapReplayTest/srp_main_window.h +++ /dev/null @@ -1,41 +0,0 @@ -/** - * @RDE_HEADER@ - * MainWindow for SitMapReplayTest - * $Id$ - * $HeadURL$ - * $Author$ - * Created by Christian Ehrlicher, SLSE, 2016-02-29 - */ -#pragma once - -#include -#include - -namespace Ui -{ -class SrpMainWindow; -} -namespace SituationMap -{ -class SituationMapInit; -} -namespace SituationReplay -{ -class HandlerSituationReplaySqlite; - -class MainWindow : public QMainWindow -{ - Q_OBJECT -public: - MainWindow(SituationMap::SituationMapInit *sitMap, - const std::shared_ptr &srpHandler, - QWidget *parent = nullptr); - ~MainWindow(); -protected slots: - void onStartReplay(); - void onStopReplay(); -private: - std::shared_ptr m_srpHandler; - Ui::SrpMainWindow *m_ui; -}; -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/SitMapReplayTest/srp_main_window.ui b/qt6-after/qt6-migrated-legatus/Lts/Application/THP/SitMapReplayTest/srp_main_window.ui deleted file mode 100755 index aa92e573a..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/SitMapReplayTest/srp_main_window.ui +++ /dev/null @@ -1,49 +0,0 @@ - - - SrpMainWindow - - - - 0 - 0 - 800 - 600 - - - - MainWindow - - - - - - 0 - 0 - 800 - 29 - - - - - Fi&le - - - - - - - - - - Start Replay - - - - - Stop Replay - - - - - - diff --git a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/THP-Starter/CMakeLists.txt b/qt6-after/qt6-migrated-legatus/Lts/Application/THP/THP-Starter/CMakeLists.txt deleted file mode 100755 index 9d60bb14f..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/THP-Starter/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -# -# $Id$ -# $HeadURL$ -# $Author$ -# - -IF(WIN32) - # static msvc runtime - FOREACH(flag_var - CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE - CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) - IF(${flag_var} MATCHES "/MD") - STRING(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") - ENDIF() - ENDFOREACH() - SET(THP_ICO "${CMAKE_SOURCE_DIR}/Lts/Common/LtsWidgets/resources/rde_icon_256.ico") - CONFIGURE_FILE(thp_starter.rc.cmake ${CMAKE_CURRENT_BINARY_DIR}/thp_starter.rc) - - NGL_ADD_EXECUTABLE(WS thp_starter WIN32 thp_starter.cpp ${CMAKE_CURRENT_BINARY_DIR}/thp_starter.rc) - NGL_TARGET_LINK_LIBRARIES(thp_starter user32.lib opengl32.lib gdi32.lib) - NGL_INSTALL_TARGET(thp_starter) -ENDIF(WIN32) diff --git a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/THP-Starter/thp_starter.cpp b/qt6-after/qt6-migrated-legatus/Lts/Application/THP/THP-Starter/thp_starter.cpp deleted file mode 100755 index 9f457ce41..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/THP-Starter/thp_starter.cpp +++ /dev/null @@ -1,149 +0,0 @@ -/** - * @RDE_HEADER@ - * Small wrapper to automatically start thp_viewer - * $Id$ - * $HeadURL$ - * $Author$ - * Created by Christian Ehrlicher, SLSE, 2016-02-29 - */ - -#include -#include -#include - -static void* getGLExtensionFuncPtr(const char *funcName, const char *fallbackFuncName) -{ - void* ptr = wglGetProcAddress(funcName); - if (ptr) - return ptr; - return wglGetProcAddress(fallbackFuncName); -} - -static int checkOpenGL(HWND hWnd) -{ - HDC hDC = GetDC( hWnd ); - - PIXELFORMATDESCRIPTOR pfd; - ZeroMemory( &pfd, sizeof( pfd ) ); - pfd.nSize = sizeof( pfd ); - pfd.nVersion = 1; - pfd.dwFlags = PFD_DRAW_TO_WINDOW | - PFD_SUPPORT_OPENGL | - PFD_DOUBLEBUFFER | - PFD_SWAP_EXCHANGE; - pfd.iPixelType = PFD_TYPE_RGBA; - pfd.cColorBits = 32; - pfd.cRedBits = 8; - pfd.cGreenBits = 8; - pfd.cBlueBits = 8; - pfd.cAlphaBits = 8; - pfd.cDepthBits = 0; - pfd.iLayerType = PFD_MAIN_PLANE; - int iFormat = ChoosePixelFormat( hDC, &pfd ); - if( !SetPixelFormat( hDC, iFormat, &pfd ) ) { - DWORD dw = GetLastError(); - int ret = MessageBox(NULL, - L"Your system does not support some mandatory OpenGL Functions.\nThe THP-Viewer may not display all things correct!\nDo you really want to start the THP-viewer?", - L"THP-Viewer startup", - MB_ICONWARNING|MB_YESNO); - if(ret == IDNO) { - ReleaseDC( hWnd, hDC ); - return 1; - } - } - - HGLRC hRC = wglCreateContext( hDC ); - - DWORD dw = wglMakeCurrent( hDC, hRC ); - void *_glCompressedTexImage2D = getGLExtensionFuncPtr( "glCompressedTexImage2D", "glCompressedTexImage2DARB" ); - if(!_glCompressedTexImage2D) { - int ret = MessageBox(NULL, - L"Your system does not support the mandatory OpenGL Function glCompressedTexImage2D.\nThe THP-Viewer may not display all things correct!\nDo you really want to start the THP-viewer?", - L"THP-Viewer startup", - MB_ICONWARNING|MB_YESNO); - if(ret == IDNO) { - wglDeleteContext( hRC ); - ReleaseDC( hWnd, hDC ); - return 1; - } - } - - wglDeleteContext( hRC ); - ReleaseDC( hWnd, hDC ); - - return 0; -} - -static int startThpViewer(HINSTANCE hInstance) -{ - TCHAR fn[MAX_PATH*10]; - DWORD len = GetModuleFileName(hInstance, fn, sizeof(fn)); - - for(int i = len - 1; i >= 0; --i) { - if(fn[i] == '\\') - break; - fn[i] = '\0'; - } - wcscat(fn, L"thp\\thp_viewer.exe"); - - STARTUPINFO si; ZeroMemory(&si, sizeof(si)); - PROCESS_INFORMATION pi; ZeroMemory(&pi, sizeof(pi)); - si.cb = sizeof(si); - - DWORD ret = CreateProcess(fn, - NULL, // lpCommandLine - NULL, // lpProcessAttributes - NULL, // lpThreadAttributes - NULL, // bInheritHandles - 0, // dwCreationFlags - NULL, // lpEnvironment - NULL, // lpCurrentDirectory - &si, // lpStartupInfo - &pi); // lpProcessInformation - - if(ret == 0) { - MessageBox(NULL, - L"Error starting the THP-Viewer!", - L"THP-Viewer startup", - MB_ICONWARNING|MB_OK); - return 1; - } - // Wait until child process exits. - WaitForSingleObject( pi.hProcess, INFINITE ); - - // Close process and thread handles. - CloseHandle( pi.hProcess ); - CloseHandle( pi.hThread ); - - return 0; -} - -LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - return DefWindowProc( hWnd, message, wParam, lParam ); -} - -int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, - LPSTR lpCmdLine, int nCmdShow) -{ - WNDCLASS wc; - ZeroMemory( &wc, sizeof(wc) ); - // register window class - wc.style = CS_OWNDC; - wc.lpfnWndProc = WndProc; - wc.hInstance = hInstance; - wc.lpszClassName = L"THP_Viewer_startup"; - RegisterClass( &wc ); - - // create main window - HWND hWnd = CreateWindow(L"THP_Viewer_startup", - L"THP-Viewer startup", - WS_CAPTION | WS_POPUPWINDOW, - 0, 0, 256, 256, - NULL, NULL, hInstance, NULL ); - - int iRet = checkOpenGL(hWnd); - if(iRet != 0) - return iRet; - return startThpViewer(hInstance); -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/THP-Starter/thp_starter.rc.cmake b/qt6-after/qt6-migrated-legatus/Lts/Application/THP/THP-Starter/thp_starter.rc.cmake deleted file mode 100755 index bd838c67a..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/THP-Starter/thp_starter.rc.cmake +++ /dev/null @@ -1 +0,0 @@ -IDI_ICON1 ICON DISCARDABLE "@THP_ICO@" diff --git a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/autorun.inf b/qt6-after/qt6-migrated-legatus/Lts/Application/THP/autorun.inf deleted file mode 100755 index a4a4ec31a..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/autorun.inf +++ /dev/null @@ -1,6 +0,0 @@ -[autorun] -OPEN=thp\bin\thp_viewer.exe -ICON=thp\bin\thp_viewer.exe,0 -SHELL=readit -SHELL\readit="THP-Viewer starten" -SHELL\readit\command=thp\bin\thp_viewer.exe diff --git a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/log4cxx_thp_viewer.props b/qt6-after/qt6-migrated-legatus/Lts/Application/THP/log4cxx_thp_viewer.props deleted file mode 100755 index f30520ea3..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/log4cxx_thp_viewer.props +++ /dev/null @@ -1,28 +0,0 @@ -log4j.reset=true -log4j.rootLogger=WARN, file - -#log4j.logger.GDW=WARN -#log4j.logger.GDW_CTC=WARN -#log4j.logger.KALA=WARN -# -# THP -# -#log4j.logger.THP=WARN -#log4j.logger.THP.AudioVideoWidget=WARN -#log4j.logger.THP.PlanFilter=WARN -#log4j.logger.THP.SymbolLoaderThread=WARN -#log4j.logger.THP.SHMFileHandler=WARN - -# Appender -############ -log4j.appender.file=Lts::RollingFileAppender -log4j.appender.file.MaxFileSize=1MB -log4j.appender.file.MaxBackupIndex=9 -log4j.appender.file.layout=org.apache.log4j.PatternLayout -log4j.appender.file.layout.ConversionPattern=%d %-5p %c |#| %m (%.50F:%L) %n - -# Appnd_Console -########################################################### -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d %-5p %c |#| %m (%.50F:%L) %n diff --git a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/main.cpp b/qt6-after/qt6-migrated-legatus/Lts/Application/THP/main.cpp deleted file mode 100755 index 3c2a7eb0c..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/main.cpp +++ /dev/null @@ -1,166 +0,0 @@ -/** - * @RDE_HEADER@ - * Main entry for thp viewer - * $Id$ - * $HeadURL$ - * $Author$ - */ -#include -#include -#include -#include -#include -#include -#include - -#include "thp_viewer.h" -#include -#include - -#ifdef Q_OS_WIN -# include -#endif - -class CmdLineParser : public LtsCommandLineParser::LtsCommandLineParser -{ -public: - CmdLineParser() - : LtsCommandLineParser(ProvideCommandLineParameterOptions::None) - { - addOption({{QStringLiteral("l"), QStringLiteral("lang")}, - QStringLiteral("Language iso code to use (de_DE, en_GB, en_US)"), - QStringLiteral("") - }); - addOption({{QStringLiteral("t"), QStringLiteral("alwaysontop")}, - QStringLiteral("Set as always on top window") - }); - } - bool useAsAlwaysOnTop() const - { - return isSet(QStringLiteral("t")); - } - QString langIsoCode() const { return value(QStringLiteral("l")); } -}; - -int main(int argc, char **argv) -{ - QNetworkProxy::setApplicationProxy(QNetworkProxy()); - - NGLSingleApplication app(argc, argv); - app.createLogger("THP", "log4cxx_thp_viewer.props"); - app.setOrganizationName(QStringLiteral("RME")); - app.setApplicationName(QStringLiteral("thp_viewer")); - app.setAttribute(Qt::AA_UseHighDpiPixmaps); - - QDir::setSearchPaths(QLatin1String("icon"), QStringList(QLatin1String(":/style/"))); - Q_INIT_RESOURCE(rme_light_style); - - // Parse Options - CmdLineParser options; - if (!options.init()) - return -1; - - // Set Translation - QString langIsoCode = options.langIsoCode(); - if (langIsoCode.isEmpty()) - langIsoCode = QLocale::system().name(); - NGL::setTranslationLocale(langIsoCode.toLatin1()); - - //check for optional alyways on top flag - bool alwaysOnTop = options.useAsAlwaysOnTop(); - - QString index; - const QStringList args = options.positionalArguments(); - -// QString searchDir = QCoreApplication::applicationDirPath(); - QString searchDir(QDir::currentPath()); - - if (args.count() == 1) - { - QFileInfo fi(args.first()); - if (fi.isDir()) - searchDir = fi.absolutePath(); - else - index = fi.absoluteFilePath(); - } - - if (index.isEmpty()) - { - const auto indexFiles = { QStringLiteral("index_%1.html").arg(langIsoCode), - QStringLiteral("index.html") }; - for (const QString &indexFile : indexFiles) - { - QDir d(searchDir); - index = d.absoluteFilePath(indexFile); - while (!d.exists(index)) - { - if (!d.cdUp()) - break; - index = d.absoluteFilePath(indexFile); - } - if (d.exists(index)) - break; - } - } - - QFileInfo fi(index); - QString basePath = fi.path() + QLatin1Char('/'); - if (!fi.exists() || !fi.isFile()) - { - fprintf(stderr, "%s basePath=%s\n", argv[0], basePath.toStdString().c_str()); - QMessageBox::critical(nullptr, - QObject::tr("File missing"), - QObject::tr("Could not find a valid index.html - aborting")); - return -1; - } - index = fi.absoluteFilePath(); - - if (app.sendMessage(index)) - return 0; - - int ret = 1; - { - QString splashfile = basePath; - static const auto extension = {QStringLiteral("gif"), - QStringLiteral("jpg"), - QStringLiteral("png")}; - for (const auto &ext : extension) - { - const QString fn = splashfile + QStringLiteral("/wappen.") + ext; - if (!QFile::exists(fn)) - continue; - splashfile = fn; - break; - } - - const QPixmap splashPixmap(splashfile); - QSplashScreen splash((splashPixmap)); - if (!splashPixmap.isNull()) - splash.show(); - -#ifdef BUILD_STATIC_LIBRARIES - Q_INIT_RESOURCE(libsymbol); - Q_INIT_RESOURCE(nglresources); -#endif - - NGL::ThpViewer view(QUrl::fromLocalFile(index)); - if (alwaysOnTop) - { - view.setWindowFlag(Qt::WindowStaysOnTopHint, true); - view.setWindowFlag(Qt::WindowMinimizeButtonHint, false); - } - - if (!view.init()) - return ret; - view.center(); - - QObject::connect(&app, &NGLSingleApplication::messageReceived, - &view, &NGL::ThpViewer::onNewThp); - view.show(); - splash.finish(&view); - - ret = app.exec(); - } - - return ret; -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thp_plugin_provider.cpp b/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thp_plugin_provider.cpp deleted file mode 100755 index 0d4b73d9c..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thp_plugin_provider.cpp +++ /dev/null @@ -1,105 +0,0 @@ -/** - * @RDE_HEADER@ - * Plugin Provider for standalone SRP / THP - * $Id$ - * $HeadURL$ - * $Author$ - * Created by Christian Ehrlicher, SLSE, 2016-02-29 - */ - -#include "thp_plugin_provider.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "thp_situation_filter_interface_impl.h" - -namespace THP -{ - -QString SitMapPluginProvider::toString() const -{ - return QString(); -} - -bool SitMapPluginProvider::init(const std::shared_ptr &ddsConnector) -{ - m_ddsConnector = ddsConnector; - - m_buildingPluginProvider = std::make_shared(); - - m_aesDtc = AreaEffectSimulation::Interface::Dtc::create(ddsConnector); - m_aesDtc->enableAll(); - m_bldDtc = Buildings::Interface::Dtc::create(ddsConnector); - m_bldDtc->enableAll(); - m_cesDtc = CentralEffectSimulation::Interface::Dtc::create(ddsConnector); - m_cesDtc->enableAll(); - m_gimDtc = GuezIedManagement::Interface::Dtc::create(ddsConnector); - m_gimDtc->enableAll(); -// m_ismDtc = InfrastructureManagement::Interface::Dtc::create(ddsConnector); -// m_ismDtc->enableAll(); -// m_ismForeign = std::make_shared(m_ismDtc); - m_ppmDtc = ParticipantManagement::Interface::Dtc::create(ddsConnector); - m_ppmDtc->enableAll(); - m_pdmDtc = ProjectDataManagement::Interface::Dtc::create(ddsConnector); - m_pdmDtc->enableAll(); - - // needs m_ppmDtc - m_fltParticipantIfc = std::make_shared(m_ppmDtc); - m_fltAesIfc = std::make_shared(m_ppmDtc); - m_fltBuildingComponentIfc = std::make_shared(m_ppmDtc); - // m_fltParticipantIfc = m_fltAesIfc; // Not sure, lets try - - return m_buildingPluginProvider->init(ddsConnector, this); -} - - -bool BuildingPluginProvider::init(const std::shared_ptr &ddsConnector, - SitMapPluginProvider *smPluginProvider) -{ - Q_ASSERT(smPluginProvider); - m_smPluginProvider = smPluginProvider; - connect(m_smPluginProvider, &SitMapPluginProvider::partitionTimeChanged, - this, &BuildingPluginProvider::partitionTimeChanged); - - m_connectionParams.domainId = ddsConnector->getDomainId(); - m_connectionParams.partitionId = ddsConnector->getPartitionId(); - m_connectionParams.exerciseId = ddsConnector->getPartitionId(); - m_connectionParams.tcpConnectionUrl = ddsConnector->getTcpConnectionUrl(); - - m_asbIfc = std::make_shared(m_smPluginProvider->ppmDtc(), - m_smPluginProvider->aesDtc(), - m_smPluginProvider->gimDtc()); - - return true; -} - - -std::shared_ptr SitMapPluginProvider::ismDataIfc() const -{ - if (!m_ismForeign) - m_ismForeign = std::make_shared(ismDtc()); - - return m_ismForeign; -} - - -std::shared_ptr SitMapPluginProvider::ismDtc() const -{ - if (!m_ismDtc) - { - m_ismDtc = InfrastructureManagement::Interface::Dtc::create(m_ddsConnector); - m_ismDtc->enableAll(); - } - - return m_ismDtc; -} - -} // namespace THP diff --git a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thp_plugin_provider.h b/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thp_plugin_provider.h deleted file mode 100755 index 0226b29de..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thp_plugin_provider.h +++ /dev/null @@ -1,149 +0,0 @@ -/** - * @RDE_HEADER@ - * Plugin Provider for standalone SRP / THP - * $Id$ - * $HeadURL$ - * $Author$ - * Created by Christian Ehrlicher, SLSE, 2016-02-29 - */ - -#pragma once - -#include -#include -#include -#include -#include -#include - -namespace DDSConnector -{ -class DdsConnector; -} -namespace THP -{ -class BuildingPluginProvider; -class SitMapPluginProvider final : public SituationMap::PluginProvider -{ - Q_OBJECT -public: - using SituationMap::PluginProvider::PluginProvider; - - QString toString() const override; - - bool init(const std::shared_ptr &ddsConnector); - - void emitPartitionTimeChanged(qint64 curTime) { m_curPartitionTime = curTime; emit partitionTimeChanged(curTime); } - - void setExerciseId(int exerciseId) { m_exerciseId = exerciseId; } - int exerciseId() const override { return m_exerciseId; } - bool isSessionValid() const override { return true; } - qint64 partitionTime() const override { return m_curPartitionTime; } - int partitionId() const override { return -1; } - int operatorId() const override { return 42; } - LtsAppDescriptor::App appId() const override { return LtsAppDescriptor::App::ThpSituationReplay; } - - bool isVisibleParty(int) const override { return true; } - QString workspaceId() const override { return {}; } - bool isReplayPartition() const override { return false; } - - std::shared_ptr aesDtc() const override { return m_aesDtc; } - std::shared_ptr aesInfoIfc() const override { return {}; } - std::shared_ptr almDtc() const override { return {}; } - std::shared_ptr almFtc() const override { return {}; } - std::shared_ptr almInfoIfc() const override { return {}; } - std::shared_ptr asmDtc() const override { return {}; } - std::shared_ptr asmFtc() const override { return {}; } - std::shared_ptr bldDtc() const override { return m_bldDtc; } - std::shared_ptr bldFtc() const override { return {}; } - std::shared_ptr bldInfoIfc() const override { return {}; } - std::shared_ptr cesDtc() const override { return m_cesDtc; } - std::shared_ptr exmDtc() const override { return {}; } - std::shared_ptr exmFtc() const override { return {}; } - std::shared_ptr fltDtc() const override { return {}; } - std::shared_ptr fltFtc() const override { return {}; } - std::shared_ptr fltParticipantIfc() const override { return m_fltParticipantIfc; } - std::shared_ptr fltAesIfc() const override { return m_fltAesIfc; } - std::shared_ptr fltBuildingComponentIfc() const override { return m_fltBuildingComponentIfc; } - std::shared_ptr gimDtc() const override { return m_gimDtc; } - std::shared_ptr gimIfc() const override { return {}; } - std::shared_ptr gnaDtc() const override { return {}; } - std::shared_ptr gnaIfc() const override { return {}; } - std::shared_ptr ismDtc() const override; - std::shared_ptr ismDataIfc() const override; - std::shared_ptr ismGuiIfc() const override { return {}; } - std::shared_ptr opmDtc() const override { return {}; } - std::shared_ptr opmFtc() const override { return {}; } - std::shared_ptr ppmDtc() const override { return m_ppmDtc; } - std::shared_ptr ppmFtc() const override { return {}; } - std::shared_ptr ppmParticipantInfoIfc() const override { return {}; } - std::shared_ptr pdmDtc() const override { return m_pdmDtc; } - std::shared_ptr srpDtc() const override { return m_srpDtc; } - std::shared_ptr ocParticipantInfoIfc() const override { return {}; } - std::shared_ptr smoServiceMonitorIfc() const override { return {}; } - std::shared_ptr tgtDtc() const override { return {}; } - std::shared_ptr cmoDtc() const override { return {}; } - - // for BuildingPluginProvider - BuildingPluginProvider *buildingPluginProvider() { return m_buildingPluginProvider.get(); } - -private: - std::shared_ptr m_aesDtc; - std::shared_ptr m_bldDtc; - std::shared_ptr m_cesDtc; - std::shared_ptr m_fltParticipantIfc; - std::shared_ptr m_fltAesIfc; - std::shared_ptr m_fltBuildingComponentIfc; - std::shared_ptr m_gimDtc; - mutable std::shared_ptr m_ismDtc; - mutable std::shared_ptr m_ismForeign; - std::shared_ptr m_ppmDtc; - std::shared_ptr m_srpDtc; - std::shared_ptr m_pdmDtc; - - qint64 m_curPartitionTime = 0; - int m_exerciseId = 0; - - std::shared_ptr m_buildingPluginProvider; - std::shared_ptr m_ddsConnector; -}; - -class BuildingPluginProvider final : public BuildingViewer::PluginProvider -{ - Q_OBJECT -public: - using BuildingViewer::PluginProvider::PluginProvider; - - BuildingPluginProvider() = default; - - QString toString() const override { return m_smPluginProvider->toString(); } - - bool init(const std::shared_ptr &ddsConnector, - SitMapPluginProvider *smPluginProvider); - - void emitPartitionTimeChanged(qint64 curTime) { m_smPluginProvider->emitPartitionTimeChanged(curTime); } - - int exerciseId() const override { return m_smPluginProvider->exerciseId(); } - qint64 partitionTime() const override { return m_smPluginProvider->partitionTime(); } - bool isReplayPartition() const override { return false; } - bool isVisibleParty(int partyId) const override { return m_smPluginProvider->isVisibleParty(partyId); } - LtsSession::DdsConnectionParams connParams() const override { return m_connectionParams; } - - std::shared_ptr asbIfc() const override { return m_asbIfc; } - std::shared_ptr avmDataIfc() const override { return nullptr; } // optional - std::shared_ptr bldDtc() const override { return m_smPluginProvider->bldDtc(); } - std::shared_ptr bldInfoIfc() const override { return m_smPluginProvider->bldInfoIfc(); } // optional - std::shared_ptr ismDtc() const override { return m_smPluginProvider->ismDtc(); } - std::shared_ptr ismDataIfc() const override { return m_smPluginProvider->ismDataIfc(); } - std::shared_ptr aesDtc() const override { return m_smPluginProvider->aesDtc(); } // optional - std::shared_ptr ppmDtc() const override { return m_smPluginProvider->ppmDtc(); } // optional - std::shared_ptr pdmDtc() const override { return m_smPluginProvider->pdmDtc(); } // optional - std::shared_ptr srpDtc() const override { return m_smPluginProvider->srpDtc(); } // optional - std::shared_ptr ppmParticipantInfoIfc() const override { return m_smPluginProvider->ppmParticipantInfoIfc(); } // optional - -private: - SitMapPluginProvider *m_smPluginProvider{nullptr}; - std::shared_ptr m_asbIfc; - LtsSession::DdsConnectionParams m_connectionParams; -}; -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thp_situation_filter_interface_impl.cpp b/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thp_situation_filter_interface_impl.cpp deleted file mode 100755 index 8154bbeb4..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thp_situation_filter_interface_impl.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/** - * @RDE_HEADER@ - * Simple implmentation of FilterHandling for THP - * $Id$ - * $HeadURL$ - * $Author$ - * Created by Christian Ehrlicher, SLSE, 2016-02-29 - */ - -#include "thp_situation_filter_interface_impl.h" -#include -#include -#include - -namespace FilterManagement -{ -ThpFilterInterfaceImpl::ThpFilterInterfaceImpl(const std::shared_ptr &dtcPpm) - : m_fltSymbols(std::make_shared(dtcPpm)) - , m_fltAes(std::make_shared()) - , m_fltBuildingComponentSettings(std::make_shared()) -{ - m_fltAes->setVisiblePartiesCheck([](int) -> bool { return true; }); -} - -std::shared_ptr ThpFilterInterfaceImpl::symbolAppearanceForOperator(int operatorId, const QString &context) -{ - Q_UNUSED(operatorId); - Q_UNUSED(context); - return m_fltSymbols; -} - -std::shared_ptr ThpFilterInterfaceImpl::aesFilterForOperator(int operatorId, const QString &context) -{ - Q_UNUSED(operatorId); - Q_UNUSED(context); - return m_fltAes; -} - -std::shared_ptr ThpFilterInterfaceImpl::buildingComponentSettingsForOperator(int operatorId, const QString &context) -{ - Q_UNUSED(operatorId); - Q_UNUSED(context); - return m_fltBuildingComponentSettings; - -} - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thp_situation_filter_interface_impl.h b/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thp_situation_filter_interface_impl.h deleted file mode 100755 index d82e6fda4..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thp_situation_filter_interface_impl.h +++ /dev/null @@ -1,40 +0,0 @@ -/** - * @RDE_HEADER@ - * Simple implmentation of FilterHandling for THP - * $Id$ - * $HeadURL$ - * $Author$ - * Created by Christian Ehrlicher, SLSE, 2016-02-29 - */ -#pragma once - -#include -#include -#include -#include - -namespace FilterManagement -{ -class ThpFilterInterfaceImpl : public ForeignFltParticipantGuiInterface, - public ForeignAesGuiInterface, - public ForeignFltBuildingComponentGuiInterface -{ -public: - explicit ThpFilterInterfaceImpl(const std::shared_ptr &dtcPpm); - - // from Participant - std::shared_ptr symbolAppearanceForOperator(int operatorId, const QString &context) override; - - // from Aes - std::shared_ptr aesFilterForOperator(int operatorId, const QString &context) override; - - // from BuildingComponent - std::shared_ptr buildingComponentSettingsForOperator(int operatorId, const QString &context) override; - - -private: - std::shared_ptr m_fltSymbols; - std::shared_ptr m_fltAes; - std::shared_ptr m_fltBuildingComponentSettings; -}; -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thp_viewer.cpp b/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thp_viewer.cpp deleted file mode 100755 index 46f41c8bb..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thp_viewer.cpp +++ /dev/null @@ -1,686 +0,0 @@ -/** - * @RDE_HEADER@ - * Main thp viewer widget - * $Id$ - * $HeadURL$ - * $Author$ - */ -#include "thp_viewer.h" -#include "ui_thp_viewer.h" -#include "thp_plugin_provider.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -namespace NGL -{ -/* - * ThpViewer base class - */ -ThpViewer::ThpViewer(const QUrl &url, QWidget *parent) - : QWidget(parent) - , ui(new Ui::thpViewer) - , m_scaleFactor(1.0) - , m_homeLink(url) - , m_homePath(QFileInfo(m_homeLink.toLocalFile()).absolutePath()) - , m_trainingName(QString()) - , m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("ThpViewer")) -{ - ui->setupUi(this); - ui->audioWidget->setAV(true); - ui->videoWidget->setAV(false); - - /* - TODO - if (!conffile.isEmpty()) - { - QSettings thpsettings(conffile, QSettings::IniFormat, this); - - // needed? - const char timeZone = thpsettings.value(QStringLiteral("Time/Timezone"), QStringLiteral("Z")).toString().at(0).toLatin1(); - DTG::setTimezone(timeZone, true); - } - */ - - QString basedir(url.toLocalFile()); - basedir = basedir.left(basedir.lastIndexOf(QLatin1Char('/'))); - - DEBUG_LOG(m_logger) << "url: " << url.toString() << " basedir: " << basedir; - - QFont f = ui->mainLabel->font(); - f.setBold(true); - f.setPointSizeF(f.pointSizeF() * 1.2); - ui->mainLabel->setFont(f); - - connect(ui->closeButton, &QToolButton::clicked, this, &ThpViewer::close); - connect(ui->backButton, &QToolButton::clicked, this, &ThpViewer::onBack); - connect(ui->homeButton, &QToolButton::clicked, this, &ThpViewer::onHome); - connect(ui->helpButton, &QToolButton::clicked, this, &ThpViewer::onHelp); - connect(ui->printButton, &QToolButton::clicked, this, &ThpViewer::onPrint); - connect(ui->fullScreenButton, &QToolButton::clicked, this, &ThpViewer::onFullScreen); - connect(ui->htmlWidget, &THP::HtmlWidget::linkClicked, this, &ThpViewer::onLinkClicked); - connect(ui->htmlWidget, &THP::HtmlWidget::urlChanged, this, &ThpViewer::onUrlChanged); - connect(ui->htmlWidget, &THP::HtmlWidget::titleChanged, this, &ThpViewer::onTitleChanged); - - ui->backButton->setEnabled(false); - ui->helpButton->setVisible(false); // Help disabled for now -#ifndef Q_WS_WIN - setWindowIcon(QIcon(QStringLiteral(":icons/16x16/rde.ico"))); -#endif - setWindowTitle(tr("Combat Training Center")); -} - -ThpViewer::~ThpViewer() -{ - delete ui; -} - -bool ThpViewer::init() -{ - QFile file(m_homePath + QStringLiteral("/data.json")); - int exerciseId = 0; - if (file.exists() && file.open(QIODevice::ReadOnly)) - { - const auto obj = QJsonDocument::fromJson(file.readAll()).object(); - exerciseId = obj.value(QLatin1String("exerciseId")).toInt(); - } - else - { - - QFile file2(m_homePath + QStringLiteral("/../data.json")); - if (file2.exists() && file2.open(QIODevice::ReadOnly)) - { - const auto obj = QJsonDocument::fromJson(file2.readAll()).object(); - exerciseId = obj.value(QLatin1String("exerciseId")).toInt(); - } - } - DEBUG_LOG(m_logger) << "Use EXERCISE" << exerciseId; - - if (!ui->situationWidget->init(m_homePath, exerciseId)) - { - ERROR_LOG(m_logger) << "Could not init situation widget - abort"; - return false; - } - if (!ui->buildingWidget->init(ui->situationWidget->replayHandler(), - ui->situationWidget->pluginProvider()->buildingPluginProvider(), - m_homePath)) - { - ERROR_LOG(m_logger) << "Could not init situation widget - abort"; - return false; - } - - onZoomChanged(); - onLinkClicked(m_homeLink); - - return true; -} - -void ThpViewer::center() -{ - QRect rect = QGuiApplication::primaryScreen()->availableGeometry(); - // 80 % - int width = rect.width() * 4 / 5; - int height = rect.height() * 4 / 5; - int x = rect.width() / 2 - width / 2; - int y = rect.height() / 2 - height / 2; - resize(width, height); - move(x, y); -} - -void ThpViewer::closeEvent(QCloseEvent *event) -{ - // explicit delete those two widgets here, otherwise we may get in trouble - // on windows when the app is closed with the 'X' button from the window frame - delete ui->buildingWidget; - ui->buildingWidget = nullptr; - delete ui->situationWidget; - ui->situationWidget = nullptr; - QWidget::closeEvent(event); -} - -void ThpViewer::onNewThp(const QString &index) -{ - DEBUG_LOG(m_logger) << "onNewThp: " << index; - - if (index.isEmpty()) - return; - m_homeLink = QUrl::fromLocalFile(index); - m_homePath = QFileInfo(m_homeLink.toLocalFile()).absolutePath(); - DEBUG_LOG(m_logger) << "home: " << m_homeLink.toString(); - onLinkClicked(m_homeLink); - ui->backButton->setEnabled(false); - this->raise(); -} - -void ThpViewer::onTitleChanged(const QString &title) -{ - if (title.endsWith(QLatin1String("html")) || - title.endsWith(QLatin1String("html#!/"))) - return; - if (m_trainingName.isEmpty()) - m_trainingName = title; - ui->mainLabel->setText(m_trainingName == title ? m_trainingName : QStringLiteral("%1 - %2").arg(m_trainingName, title)); -} - -void ThpViewer::keyPressEvent(QKeyEvent *e) -{ - switch (e->key()) - { - case Qt::Key_Backspace: - onBack(); - break; - case Qt::Key_Plus: - if (ui->stackedWidget->isVisible() && ui->stackedWidget->currentWidget() == ui->situationWidget) - return; - if (m_scaleFactor < 10) - { - m_scaleFactor *= 1.5; - onZoomChanged(); - } - break; - case Qt::Key_M: - { - if (QApplication::queryKeyboardModifiers() == Qt::ControlModifier) - onLinkClicked(QUrl::fromLocalFile(QDir::currentPath() + QStringLiteral("/") + QInputDialog::getText(this, {}, QStringLiteral("href_local")))); - break; - } - case Qt::Key_Minus: - if (ui->stackedWidget->isVisible() && ui->stackedWidget->currentWidget() == ui->situationWidget) - return; - if (m_scaleFactor > 0.05) - { - m_scaleFactor /= 1.5; - onZoomChanged(); - } - break; - case Qt::Key_F1: - onHelp(); - break; - case Qt::Key_Escape: - if (isFullScreen()) - onFullScreen(); - break; - default: - QWidget::keyPressEvent(e); - break; - } -} - -void ThpViewer::onHelp() -{ - QFileInfo f(QStringLiteral("%1/../DATA/help/%2/help.html").arg(QCoreApplication::applicationDirPath(), QString::fromLatin1(NGL::translationLocale()))); - if (f.exists()) - onLinkClicked(QUrl::fromLocalFile(f.absoluteFilePath())); // TODO Pfad anpassen! - else - { - f.setFile(qApp->applicationDirPath() + QStringLiteral("/../DATA/help/en_US/help.html")); // TODO Pfad anpassen! - if (f.exists()) - onLinkClicked(QUrl::fromLocalFile(f.absoluteFilePath())); - } -} - -void ThpViewer::onZoomChanged() -{ - ui->pdfWidget->setZoomFactor(m_scaleFactor); - ui->htmlWidget->setZoomFactor(m_scaleFactor); - -// double zoom = ( int ) ( m_scaleFactor * 100. + 0.5 ); -// ui->statusbar->showMessage ( tr ( "zoom: %1 %" ).arg ( zoom ) ); -} - -void ThpViewer::onLinkClicked(const QUrl &url) -{ - DEBUG_LOG(m_logger) << "url: " << url.toString(); - - const QString path = url.path(); - const QString lpath = path.toLower(); - - const QStringRef ext = lpath.splitRef(QLatin1Char('.')).last(); - const QStringRef ext2Chars = ext.left(2); - - ui->audioWidget->stop(); - ui->videoWidget->stop(); - // Video-only - if (lpath.endsWith(QLatin1String("video.pls")) || - ext == QLatin1String("mpg") || - ext == QLatin1String("avi") || - ext == QLatin1String("ogg")) - { - ui->videoWidget->play(url); - - ui->stackedWidget->hide(); - ui->videoWidget->show(); - ui->audioWidget->hide(); - - ui->backButton->setEnabled(true); - // Audio-only - } - else if (lpath.endsWith(QLatin1String("audio.pls")) || - ext == QLatin1String("mp3")) - { - ui->audioWidget->play(url); - - // Ermitteln der Groesse des AudioWidgets - QSize sizeAudio = ui->audioWidget->sizeHint(); - QSize sizeStack = ui->stackedWidget->sizeHint(); - sizeStack -= sizeAudio; - QList l; - l << sizeStack.height() << sizeAudio.height(); - ui->splitter_1->setSizes(l); - - ui->stackedWidget->show(); // hier können wir html mit anzeigen - ui->videoWidget->hide(); - ui->audioWidget->show(); - - ui->backButton->setEnabled(true); - // PDF-only - } - else if (ext == QLatin1String("pdf")) - { - if (ui->pdfWidget->showPDF(url)) - { - - ui->stackedWidget->setCurrentWidget(ui->pdfWidget); - ui->stackedWidget->show(); - ui->pdfWidget->resizePdfToWidth(); - ui->videoWidget->hide(); - ui->audioWidget->hide(); - - ui->backButton->setEnabled(true); - } - else - { - QMessageBox::warning(this, - tr("Opening PDF file"), - tr("Can not open PDF file %1 - missing or corrupt file!").arg(url.toString())); - } - } - else if (lpath.endsWith(QLatin1String("sitmap.json"), Qt::CaseInsensitive)) - { - - // 2D oder 3D ? - { - NOTICE_LOG(m_logger) << LOGFUNCTION << " lpath = '" << lpath << "'"; - // peek into /sitreplay.json: - - QFileInfo fi(path); - const QString basePath = fi.absolutePath(); - const QString replayConfigFile = basePath + QDir::separator() + QStringLiteral("sitreplay.json"); // aka replayConfigPath - NOTICE_LOG(m_logger) << LOGFUNCTION << " replayConfigFile = '" << replayConfigFile << "'"; - } - - // Lage-only - QString localFile = url.toLocalFile(); - QString basePath = localFile; - int idx = basePath.lastIndexOf(QLatin1Char('/')); - idx = basePath.lastIndexOf(QLatin1Char('/'), idx - 1); - if (idx >= 0) - basePath.chop(basePath.size() - idx - 1); - - ui->situationWidget->showSituation(url.toLocalFile(), - basePath); - - ui->stackedWidget->setCurrentWidget(ui->situationWidget); - ui->stackedWidget->show(); - ui->videoWidget->hide(); - ui->audioWidget->hide(); - - ui->backButton->setEnabled(true); - } - else if (lpath.endsWith(QLatin1String("buildingViewer.json"), Qt::CaseInsensitive)) - { - // BuildingViewer-only - QString localFile = url.toLocalFile(); - QString basePath = localFile; - int idx = basePath.lastIndexOf(QLatin1Char('/')); - idx = basePath.lastIndexOf(QLatin1Char('/'), idx - 1); - if (idx >= 0) - basePath.chop(basePath.size() - idx - 1); - ui->buildingWidget->showSituation(url.toLocalFile(), - basePath); - - ui->stackedWidget->setCurrentWidget(ui->buildingWidget); - ui->stackedWidget->show(); - ui->videoWidget->hide(); - ui->audioWidget->hide(); - - ui->backButton->setEnabled(true); - } - else if (ext == QLatin1String("html") && - lpath.midRef(lpath.lastIndexOf(QLatin1Char('/')) + 1).startsWith(QLatin1String("combined_"))) - { - // Kombiniert - QHash urls = getCombinedPlaybackDetails(url); - - if (urls.isEmpty()) - return; - - if (urls.contains(QLatin1String("audio"))) - { - ui->audioWidget->show(); - ui->audioWidget->play(urls[QLatin1String("audio")]); - } - if (urls.contains(QLatin1String("video"))) - { - ui->videoWidget->show(); - ui->videoWidget->play(urls[QLatin1String("video")]); - } - - // Einer von dreien: - if (urls.contains(QLatin1String("pdf"))) - { - ui->stackedWidget->setCurrentWidget(ui->pdfWidget); - ui->pdfWidget->showPDF(urls[QLatin1String("pdf")]); - ui->stackedWidget->show(); - } - else if (urls.contains(QLatin1String("html"))) - { - ui->stackedWidget->setCurrentWidget(ui->htmlWidget); - ui->htmlWidget->showHTML(urls[QLatin1String("html")]); - ui->stackedWidget->show(); - } - else if (urls.contains(QLatin1String("jpg"))) - { - ui->stackedWidget->setCurrentWidget(ui->htmlWidget); - ui->htmlWidget->showHTML(urls[QLatin1String("jpg")]); - ui->stackedWidget->show(); - } - else if (urls.contains(QLatin1String("png"))) - { - ui->stackedWidget->setCurrentWidget(ui->htmlWidget); - ui->htmlWidget->showHTML(urls[QLatin1String("png")]); - ui->stackedWidget->show(); - } - else - ui->stackedWidget->hide(); - ui->backButton->setEnabled(true); - } - else if (ext2Chars == QLatin1String("do") || - ext2Chars == QLatin1String("xl") || - ext2Chars == QLatin1String("pp")) - QDesktopServices::openUrl(url); - else - { - DEBUG_LOG(m_logger) << "Trying to open url: " << url.toString(); - ui->htmlWidget->showHTML(url); - - ui->stackedWidget->setCurrentWidget(ui->htmlWidget); - ui->stackedWidget->show(); - ui->videoWidget->hide(); - ui->audioWidget->hide(); - - ui->backButton->setEnabled(url != m_homeLink); - } -} -/******************************************************************************************** - * Parsed eine HTML-Dateinach allen Links, die sich direkt unterhalb des BODY-Tags befinden - * und liefert die entsprechenden Link-URLs zurück, wenn diese das Tag ID besitzen. - * - * Von der aufrufenden Funktion derzeit ausgewertete Werte für ID sind: - * html, audio, video, lage, pdf (alles klein geschrieben!) - */ -QHash ThpViewer::getCombinedPlaybackDetails(const QUrl &url) const -{ - QHash hash; - QFile file(url.toLocalFile()); - QDomDocument doc(QStringLiteral("RSS")); - if (!file.open(QIODevice::ReadOnly)) - return hash; - QString errorStr; - int errorLine, errorColumn; - if (!doc.setContent(&file, true, &errorStr, &errorLine, &errorColumn)) - { - file.close(); - return hash; - } - QDomElement domel = doc.documentElement(); - domel = domel.firstChildElement(QStringLiteral("BODY")); - domel = domel.firstChildElement(QStringLiteral("A")); - - while (!domel.isNull()) - { - if (!domel.attribute(QStringLiteral("id")).isEmpty()) - { - QUrl linkurl(domel.attribute(QStringLiteral("HREF"))); - if (linkurl.isRelative()) - linkurl = url.resolved(linkurl); - DEBUG_LOG(m_logger) << "attr: " << domel.attribute(QStringLiteral("id")).toLower() << " url: " << linkurl.toString(); - hash[domel.attribute(QStringLiteral("id")).toLower()] = linkurl; - } - domel = domel.nextSiblingElement(QStringLiteral("A")); - } - file.close(); - return hash; -} - -void ThpViewer::onPrint() -{ - if (ui->stackedWidget->isVisible()) - { - if (ui->stackedWidget->currentWidget() == ui->situationWidget) - { - QImage image = ui->situationWidget->grabFrameBuffer(); - - QPrinter printer; - QPrintDialog *dialog = new QPrintDialog(&printer, this); - dialog->setWindowTitle(tr("Print Document")); - if (dialog->exec() != QDialog::Accepted) - return; - - QPainter painter; - painter.begin(&printer); - - QRectF rect = painter.viewport(); - - double mmH = printer.logicalDpiY() / 25.4; // 25.4 = mm/inch - double mmW = printer.logicalDpiX() / 25.4; - - painter.setFont(QFont(QStringLiteral("Arial"), 30)); - QString title = tr("Combat Training Center"); - QRectF textBox = painter.boundingRect(QRectF(), Qt::AlignLeft & Qt::TextSingleLine, title); - textBox.setWidth(painter.viewport().width()); - painter.drawText(textBox, Qt::AlignCenter & Qt::TextSingleLine, title); - QPointF underImage; - - if (printer.orientation() == QPrinter::Portrait) - { - const QPointF textBlockBegin = QPointF(0 * mmW, 25 * mmH); // Baseline 25mm unter Seitenbeginn - - // Noch mal schauen, welches (auch übersetzt!) der breiteste Bezeichner (also 1. Spalte) ist! - painter.setFont(QFont(QStringLiteral("Arial"), 14, QFont::Bold, false)); - textBox = painter.boundingRect(QRect(), Qt::AlignLeft & Qt::TextSingleLine, tr("Center point:\nExercise:\nTime:")); - - // Textbox hat 3 Zeilen, also ist der Faktor pro Zeile 0.33 = 1/3 - // Spalte 1 - painter.drawText(textBlockBegin, tr("Exercise:")); - painter.drawText(textBlockBegin + QPointF(0, 0.33 * textBox.height()), tr("Time:")); - painter.drawText(textBlockBegin + QPointF(0, 0.66 * textBox.height()), tr("Center point:")); - - // Zwischen Spalte 1 und Spalte 2 noch 3mm Platz lassen - // Spalte 2 - painter.setFont(QFont(QStringLiteral("Arial"), 14, QFont::Normal, false)); - painter.drawText(textBlockBegin + QPointF(textBox.width() + 3 * mmW, 0), m_trainingName); - painter.drawText(textBlockBegin + QPointF(textBox.width() + 3 * mmW, 0.33 * textBox.height()), ui->situationWidget->currentDTGTime()); - painter.drawText(textBlockBegin + QPointF(textBox.width() + 3 * mmW, 0.66 * textBox.height()), ui->situationWidget->centerPointString()); - - // Das Bild soll formatfüllend angezeigt werden, das Rechteck muss 45mm "flacher" sein, da es erst ab 45mm gedruckt werden soll. - QSizeF size = image.size(); - rect.adjust(0, 0, 0, -45 * mmH); - size.scale(rect.size(), Qt::KeepAspectRatio); - - // Und ab 45mm von oben drucken: - QRectF imgrect = QRectF(QPointF(0 * mmW, 45 * mmH), size); - painter.drawImage(imgrect, image); - - // Untere linke Ecke des Bildes - underImage = imgrect.bottomLeft(); - - } - else // Landscape - { - // Noch mal schauen, welches (auch übersetzt!) der breiteste Bezeichner oder variable Text ist! - painter.setFont(QFont(QStringLiteral("Arial"), 14, QFont::Bold, false)); - textBox = painter.boundingRect(QRect(), Qt::AlignLeft, tr("Center point:\n%1\n\nTime:\n%2\n\nExercise:\n%3") - .arg(m_trainingName, - ui->situationWidget->currentDTGTime(), - ui->situationWidget->centerPointString())); - - // TextBlock fängt an: Notwendige Breite von rechts und 15 mm + 1 Zeilenhöhe (=1/8 der Textboxhöhe) von oben. - // Die Zeilenhöhe ist notwendig weil drawText(QPoint, QString) den QPoint auf die Baseline setzt! - QPointF textBlockBegin = QPointF(painter.viewport().width() - textBox.width(), 15 * mmH + 0.125 * textBox.height()); - - // Die Textbox hat 8 Zeilen, also ist der Faktor pro Zeile 1/8 = 0.125 - // Übung - painter.setFont(QFont(QStringLiteral("Arial"), 14, QFont::Bold, false)); - painter.drawText(textBlockBegin, tr("Exercise:")); - painter.setFont(QFont(QStringLiteral("Arial"), 14, QFont::Normal, false)); - painter.drawText(textBlockBegin + QPointF(0, 0.125 * textBox.height()), m_trainingName); - - painter.setFont(QFont(QStringLiteral("Arial"), 14, QFont::Bold, false)); - painter.drawText(textBlockBegin + QPointF(0, 0.375 * textBox.height()), tr("Time:")); - painter.setFont(QFont(QStringLiteral("Arial"), 14, QFont::Normal, false)); - painter.drawText(textBlockBegin + QPointF(0, 0.500 * textBox.height()), ui->situationWidget->currentDTGTime()); - - painter.setFont(QFont(QStringLiteral("Arial"), 14, QFont::Bold, false)); - painter.drawText(textBlockBegin + QPointF(0, 0.750 * textBox.height()), tr("Center point:")); - painter.setFont(QFont(QStringLiteral("Arial"), 14, QFont::Normal, false)); - painter.drawText(textBlockBegin + QPointF(0, 0.875 * textBox.height()), ui->situationWidget->centerPointString()); - - // Das Bild soll formatfüllend angezeigt werden, das Rechteck muss 15mm "flacher" sein, da es erst ab 15mm gedruckt werden soll. - // Ausserdem müssen in der Breite die Textboxbreite und 3mm Luft dazwischen abgezogen werden. - QSizeF size = image.size(); - rect.adjust(0, 0, -textBox.width() - 3 * mmW, -15 * mmH); - size.scale(rect.size(), Qt::KeepAspectRatio); - - // Und ab 15mm von oben drucken: - QRectF imgrect = QRectF(QPointF(0 * mmW, 15 * mmH), size); - painter.drawImage(imgrect, image); - - // Untere linke Ecke des Bildes - underImage = imgrect.bottomLeft(); - } - - painter.setFont(QFont(QStringLiteral("Arial"), 12)); - // String für Breite und Höhe erstellen - const QRectF extent = ui->situationWidget->extentMgrs(); - QString areasize = tr("Width: %1m, Height: %2m").arg(extent.width()).arg(extent.height()); - // Die Größe herausfinden - textBox = painter.boundingRect(QRect(), Qt::AlignLeft & Qt::TextSingleLine, areasize); - // Einen Dot vergrößern (siehe QRect: Die Rahmenpixel unten und rechts sind nicht Teil der Rechteckgröße) - textBox.adjust(0, 0, 1, 1); - // An die richtige Stelle bugsieren - textBox.moveBottomLeft(underImage); - // Und mit weiß und 50% Deckkraft vollmalen. - painter.fillRect(textBox, QColor(255, 255, 255, 128)); - //Dann den Text drüberlegen - painter.drawText(underImage, areasize); - - painter.end(); - } - else if (ui->stackedWidget->currentWidget() == ui->pdfWidget) - { - QPrinter printer; - QPrintDialog *dialog = new QPrintDialog(&printer, this); - dialog->setWindowTitle(tr("Print Document")); - if (dialog->exec() != QDialog::Accepted) - return; - - QVector images = ui->pdfWidget->getPrintableImages(printer.resolution()); - int lastItem = images.size() - 1; - - QPainter painter; - painter.begin(&printer); - for (int i = 0; i < images.size(); ++i) - { - QRect rect = painter.viewport(); - QSize size = images.at(i).size(); - size.scale(rect.size(), Qt::KeepAspectRatio); - painter.setViewport(rect.x(), rect.y(), - size.width(), size.height()); - painter.setWindow(images.at(i).rect()); - painter.drawImage(0, 0, images.at(i)); - if (i != lastItem) - printer.newPage(); - } - painter.end(); - } - else if (ui->stackedWidget->currentWidget() == ui->htmlWidget) - { - QPrinter printer; - QPrintDialog *dialog = new QPrintDialog(&printer, this); - dialog->setWindowTitle(tr("Print Document")); - if (dialog->exec() != QDialog::Accepted) - return; - ui->htmlWidget->print(&printer); - } - else // Audio/Video-Widget - { - } - } - else // nur HTML sichtbar... - { - QPrinter printer; - QPrintDialog *dialog = new QPrintDialog(&printer, this); - dialog->setWindowTitle(tr("Print Document")); - if (dialog->exec() != QDialog::Accepted) - return; - ui->htmlWidget->print(&printer); - } -} - -void ThpViewer::onBack() -{ - ui->audioWidget->stop(); - ui->videoWidget->stop(); - ui->situationWidget->stop(); - - ui->audioWidget->hide(); - ui->videoWidget->hide(); - if (ui->stackedWidget->currentWidget() == ui->htmlWidget && - ui->stackedWidget->isVisible()) - ui->htmlWidget->back(); - ui->stackedWidget->show(); - ui->stackedWidget->setCurrentWidget(ui->htmlWidget); - onUrlChanged(ui->htmlWidget->url()); -} - -void ThpViewer::onHome() -{ - ui->htmlWidget->show(); - onLinkClicked(m_homeLink); -} - -void ThpViewer::onFullScreen() -{ - setWindowState(windowState() ^ Qt::WindowFullScreen); -} - -void ThpViewer::onUrlChanged(const QUrl &url) -{ - ui->backButton->setEnabled(url != m_homeLink); -} - -} // namespace NGL diff --git a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thp_viewer.h b/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thp_viewer.h deleted file mode 100755 index 25613ffe8..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thp_viewer.h +++ /dev/null @@ -1,60 +0,0 @@ -/** - * @RDE_HEADER@ - * Main thp viewer widget - * $Id$ - * $HeadURL$ - * $Author$ - */ -#pragma once - -#include -#include - -namespace Ui -{ -class thpViewer; -} -namespace NGL -{ -class INGLLogger; -} - -namespace NGL -{ -class ThpViewer : public QWidget -{ - Q_OBJECT -public: - explicit ThpViewer(const QUrl &url, QWidget *parent = nullptr); - ~ThpViewer(); - - bool init(); - void center(); - - void closeEvent(QCloseEvent *event) override; -protected: - QHash getCombinedPlaybackDetails(const QUrl &url) const; - -protected Q_SLOTS: - void onLinkClicked(const QUrl &url); - void onZoomChanged(); - void onBack(); - void onHome(); - void onHelp(); - void onPrint(); - void onFullScreen(); - void onTitleChanged(const QString &title); - void onUrlChanged(const QUrl &url); -public Q_SLOTS: - void onNewThp(const QString &index); -protected: - void keyPressEvent(QKeyEvent *e) override; -protected: - Ui::thpViewer *ui; - double m_scaleFactor; - QUrl m_homeLink; - QString m_homePath; - QString m_trainingName; - NGL::INGLLogger &m_logger; -}; -} // namespace NGL diff --git a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thp_viewer.rc.cmake b/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thp_viewer.rc.cmake deleted file mode 100755 index 481c71151..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thp_viewer.rc.cmake +++ /dev/null @@ -1,30 +0,0 @@ -#include - -VS_VERSION_INFO VERSIONINFO - FILEVERSION @THP_VERSION_INFO@ - PRODUCTVERSION @THP_VERSION_INFO@ - FILEFLAGSMASK 0x0L - FILEFLAGS 0x0L - FILEOS VOS_NT_WINDOWS32 - FILETYPE VFT_APP - FILESUBTYPE VFT2_UNKNOWN -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040704b0" - BEGIN - VALUE "CompanyName", "Rheinmetall Electronics GmbH" - VALUE "FileDescription", "Take Home Package Viewer" - VALUE "FileVersion", "@THP_VERSION_INFO@" - VALUE "InternalName", "THP" - VALUE "LegalCopyright", "Copyright © 2018 Rheinmetall Electronics GmbH. Alle Rechte vorbehalten" - VALUE "OriginalFilename", "thp_viewer.exe" - VALUE "ProductName", "Take Home Package Viewer (THP)" - VALUE "ProductVersion", "@THP_VERSION_INFO@" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x407, 1200 - END -END diff --git a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thp_viewer.ui b/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thp_viewer.ui deleted file mode 100755 index a8e3788d9..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thp_viewer.ui +++ /dev/null @@ -1,216 +0,0 @@ - - - thpViewer - - - - 0 - 0 - 793 - 675 - - - - - 793 - 0 - - - - MainWindow - - - - - - - - - - - - - - :icons/16x16/go-previous.png:icons/16x16/go-previous.png - - - - - - - - - - - :icons/16x16/view-fullscreen.png:icons/16x16/view-fullscreen.png - - - F11 - - - - - - - - - - - :icons/16x16/go-home.png:icons/16x16/go-home.png - - - - - - - - - Qt::Horizontal - - - - 0 - 0 - - - - - - - - THP-Viewer - - - Qt::AlignCenter - - - - - - - Qt::Horizontal - - - - 0 - 0 - - - - - - - - - - - - - - :icons/16x16/document-print.png:icons/16x16/document-print.png - - - - - - - - - - - :icons/16x16/system-help.png:icons/16x16/system-help.png - - - - - - - - - - - :icons/16x16/dialog-close.png:icons/16x16/dialog-close.png - - - - - - - - - - - Qt::Vertical - - - - Qt::Horizontal - - - - - 0 - 0 - - - - - - - 0 - 0 - - - - - - - - - - - - 0 - 0 - - - - - - - - - - THP::AudioVideoWidget - QWidget -
thpwidgets/thp_audio_video_widget.h
- 1 -
- - THP::PdfWidget - QFrame -
thpwidgets/thp_pdf_widget.h
- 1 -
- - THP::HtmlWidget - QFrame -
thpwidgets/thp_html_widget.h
- 1 -
- - THP::SituationWidget - QFrame -
thpwidgets/thp_situation_widget.h
- 1 -
- - THP::BuildingWidget - QFrame -
thpwidgets/thp_building_widget.h
- 1 -
-
- - -
diff --git a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_audio_video_widget.cpp b/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_audio_video_widget.cpp deleted file mode 100755 index 0e5fa9492..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_audio_video_widget.cpp +++ /dev/null @@ -1,772 +0,0 @@ -/** - * @RDE_HEADER@ - * Handle Audio/Video output for thp through libvlc - * $Id$ - * $HeadURL$ - * $Author$ - */ -#include "thp_audio_video_widget.h" -#include "thp_audio_video_widget_p.h" -#include "ui_thp_audio_video_widget.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#ifdef THP_HAS_VLC -#include -#endif - -namespace THP -{ - -#ifdef THP_HAS_VLC - -static const float s_speedArray[] = -{ - 1. / 8., - 1. / 4., - 1. / 2., - 1., - 2., - 4., - 8. -}; - -/** - * AudioVideoWidget::Private - */ -AudioVideoWidget::Private::Private(QFrame *parent) - : m_vlcinstance(nullptr) - , m_mPlayer(nullptr) - , m_mListPlayer(nullptr) - , m_mediaList(nullptr) - , currentSpeedIdx(3) - , m_parent(parent) - , m_timer(new QTimer) - , m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("THP.AudioVideoWidget")) -{ - init(); - - connect(ui->btnSlower, &QToolButton::clicked, this, &AudioVideoWidget::Private::onSlower); - connect(ui->btnFaster, &QToolButton::clicked, this, &AudioVideoWidget::Private::onFaster); - connect(ui->btn100pct, &QToolButton::clicked, this, &AudioVideoWidget::Private::on100pct); - connect(ui->btnPlay, &QToolButton::clicked, this, &AudioVideoWidget::Private::onPlay); - connect(ui->btnStop, &QToolButton::clicked, this, &AudioVideoWidget::Private::onStop); - connect(ui->sldPosition, &QSlider::sliderMoved, this, &AudioVideoWidget::Private::onPositionChanged); - connect(ui->sldVolume, &QSlider::sliderMoved, this, &AudioVideoWidget::Private::onVolumeChanged); - connect(m_timer, &QTimer::timeout, this, &AudioVideoWidget::Private::onUpdateGUI); - - m_initThread = new AudioVideoInitThread(this); - connect(m_initThread, &AudioVideoInitThread::finished, this, &AudioVideoWidget::Private::onVLCInstanceInitializd); - m_initThread->start(QThread::LowPriority); -} - -AudioVideoWidget::Private::~Private() -{ - uninitVLCPlayer(); - uninitVLCInstance(); - delete ui; - delete m_timer; -} - -bool AudioVideoWidget::Private::init() -{ - if (!m_parent) - return false; - ui = new Ui::audioVideoWidget(); - ui->setupUi(m_parent); - - QPixmap pm(10, 10); - pm.fill(Qt::black); - ui->outputWidget->setPixmap(pm); - ui->outputWidget->setScaledContents(true); - - ui->sldPosition->setMaximum(1000); - ui->sldVolume->setMaximum(100); - - return true; -} - -void AudioVideoWidget::Private::onVLCInstanceInitializd() -{ - m_initThread->deleteLater(); - m_initThread = nullptr; -} - -void AudioVideoWidget::Private::setAV(bool isAudio) -{ - if (isAudio) - { - delete ui->btn100pct; - delete ui->btnFaster; - delete ui->btnSlower; - delete ui->outputWidget; - ui->outputWidget = nullptr; - } - else - { -// delete ui->verticalSpacer; ui->verticalSpacer = 0; - delete ui->lblAudio; - } -} - -static QMutex *serializeVLCInit() -{ - static QMutex s_serializeVLCInit; - return &s_serializeVLCInit; -} - -bool AudioVideoWidget::Private::initVLCInstance(bool bInInitThread) -{ - QMutexLocker l(serializeVLCInit()); - - if (!bInInitThread && m_initThread != nullptr) - { - QLabel myLabel; - myLabel.setWindowTitle(tr("Loading VLC player...")); - myLabel.setText(tr("Waiting until VLC player is loaded")); - QRect r = QGuiApplication::primaryScreen()->availableGeometry(); - myLabel.show(); - myLabel.move(r.width() / 2 - myLabel.width() / 2, r.height() / 2 - myLabel.height() / 2); - myLabel.setWindowIcon(QIcon(QLatin1String(":icons/16x16/rde.ico"))); - - while (m_initThread) - QCoreApplication::processEvents(); - } - if (m_vlcinstance != nullptr) - return true; - - //preparation of the vlc command - const char *vlc_argv[20]; - int iCount = 0; - vlc_argv[iCount++] = "-I"; - vlc_argv[iCount++] = "dummy"; // Don't use any interface -// vlc_argv[iCount++] = "--ignore-config"; // Don't use VLC's config -#ifdef LTS_DEBUG - vlc_argv[iCount++] = "--extraintf=logger"; // log anything - vlc_argv[iCount++] = "--verbose=2"; // be much more verbose then normal for debugging purpose -#else - vlc_argv[iCount++] = "--quiet"; -#endif - if (bInInitThread) - vlc_argv[iCount++] = "--no-media-library"; - vlc_argv[iCount++] = "--"; - vlc_argv[iCount] = nullptr; - - //Initialize an instance of vlc - //create a new libvlc instance - m_vlcinstance = libvlc_new(iCount, vlc_argv); //tricky calculation of the char space used - if (!m_vlcinstance) - ERROR_LOG(m_logger) << "Error initializing libVLC - unable to play audio or video"; - - return (m_vlcinstance != nullptr); -} - -bool AudioVideoWidget::Private::uninitVLCInstance() -{ - QMutexLocker l(serializeVLCInit()); - - if (!uninitVLCPlayer()) - return false; - - if (m_vlcinstance) - { - libvlc_release(m_vlcinstance); - m_vlcinstance = nullptr; - } - return true; -} - -bool AudioVideoWidget::Private::initVLCPlayer() -{ - DEBUG_LOG(m_logger) << "Initializing libVLC"; - if (m_mPlayer) - { - if (!ui) - return false; - ui->sldVolume->setValue(libvlc_audio_get_volume(m_mPlayer)); - return true; - } - - initVLCInstance(); - - //Initialize an instance of vlc - //Create a media player playing environement - m_mPlayer = libvlc_media_player_new(m_vlcinstance); - m_mListPlayer = libvlc_media_list_player_new(m_vlcinstance); - m_mediaList = libvlc_media_list_new(m_vlcinstance); - - libvlc_media_list_player_set_media_player(m_mListPlayer, m_mPlayer); - libvlc_media_list_player_set_media_list(m_mListPlayer, m_mediaList); - - ui->sldVolume->setValue(libvlc_audio_get_volume(m_mPlayer)); - - return true; -} - -bool AudioVideoWidget::Private::uninitVLCPlayer() -{ - DEBUG_LOG(m_logger) << "Uninitializing libVLC"; - - if (m_mListPlayer) - { - /* Stop playing */ - libvlc_media_list_player_stop(m_mListPlayer); - /* Free the media_player */ - libvlc_media_list_player_release(m_mListPlayer); - m_mListPlayer = nullptr; - } - if (m_mediaList) - { - clearMediaList(); - libvlc_media_list_release(m_mediaList); - m_mediaList = nullptr; - } - if (m_mPlayer) - { - /* Stop playing */ - libvlc_media_player_stop(m_mPlayer); - /* Free the media_player */ - libvlc_media_player_release(m_mPlayer); - - m_mPlayer = nullptr; - } - return true; -} - -void AudioVideoWidget::Private::clearMediaList() -{ - DEBUG_LOG(m_logger) << "Clearing current playlist"; - - if (!m_mediaList) - return; - libvlc_media_list_lock(m_mediaList); - const int cnt = libvlc_media_list_count(m_mediaList); - for (int i = cnt - 1; i >= 0; --i) - libvlc_media_list_remove_index(m_mediaList, i); - libvlc_media_list_unlock(m_mediaList); -} - -bool AudioVideoWidget::Private::playVLC(const QUrl &url) -{ - if (!ui) - return false; - - DEBUG_LOG(m_logger) << "Try to play " << url.toString(); - - const QString path = url.toLocalFile(); - if (path.isEmpty()) - return false; - - clearMediaList(); - - libvlc_media_list_lock(m_mediaList); - QFileInfo fi(path); - DEBUG_LOG(m_logger) << "path: " << path << " isFile: " << fi.isFile(); - if (fi.isFile() && path.endsWith(QLatin1String(".pls"))) - { - // pls parsing scheint nicht mehr richtig zu funktionieren - selbst machen - DEBUG_LOG(m_logger) << "Parse Playlist"; - QFile f(path); - if (f.open(QIODevice::ReadOnly)) - { - DEBUG_LOG(m_logger) << "Parse Playlist2 " << f.canReadLine(); - QMap fileMap; - QByteArray baAll = f.readAll(); - const QList lines = baAll.split('\n'); - for (const QByteArray &line : lines) - { - QByteArray ba = line.trimmed(); - DEBUG_LOG(m_logger) << "ba: " << ba; - if (!ba.startsWith("File ")) - continue; - ba = ba.mid(qstrlen("File ")); - int idx = ba.indexOf('='); - DEBUG_LOG(m_logger) << "idx: " << idx; - if (idx < 0) - continue; - bool bOk; - int id = ba.left(idx).toInt(&bOk); - DEBUG_LOG(m_logger) << "id: " << id << " bOk: " << bOk << " str: " << ba.left(idx); - if (!bOk) - continue; - QByteArray filename = ba.mid(idx + 1); - DEBUG_LOG(m_logger) << "filename: " << filename; - fileMap.insertMulti(id, fi.absolutePath().toLocal8Bit() + '/' + filename); - } - for (const QByteArray &fn : fileMap) - { - const QByteArray pNative = QDir::toNativeSeparators(QString::fromLocal8Bit(fn)).toLocal8Bit(); - DEBUG_LOG(m_logger) << "pNative: " << pNative; - libvlc_media_t *media = libvlc_media_new_path(m_vlcinstance, pNative.data()); - if (!media) - { - ERROR_LOG(m_logger) << "Error setting media to " << pNative; - return false; - } - //add option to disable hardware acceleration - libvlc_media_add_option(media, ":avcodec-hw=none"); - libvlc_media_list_add_media(m_mediaList, media); -#if LIBVLC_VERSION_MAJOR > 2 - libvlc_media_parse_with_options(media, libvlc_media_parse_local, 0); -#else - libvlc_media_parse(media); -#endif - libvlc_media_release(media); // libvlc_media_new_location(), ref-counting! - } - } - } - else if (fi.isFile()) - { - const QByteArray pNative = QDir::toNativeSeparators(path).toLocal8Bit(); - libvlc_media_t *media = libvlc_media_new_path(m_vlcinstance, pNative.data()); - if (!media) - { - ERROR_LOG(m_logger) << "Error setting media to '" << pNative << "'"; - return false; - } - libvlc_media_list_add_media(m_mediaList, media); - libvlc_media_release(media); // libvlc_media_new_location(), ref-counting! - } - else if (fi.isDir()) - { - QDirIterator dirIt(fi.absoluteFilePath()); - while (dirIt.hasNext()) - { - const QString fn = dirIt.next(); - fi.setFile(fn); - if (!fi.isFile()) - continue; - const QByteArray pNative = QDir::toNativeSeparators(fn).toLocal8Bit(); - libvlc_media_t *media = libvlc_media_new_path(m_vlcinstance, pNative.data()); - if (!media) - { - ERROR_LOG(m_logger) << "Error setting media to " << pNative; - return false; - } - libvlc_media_list_add_media(m_mediaList, media); -#if LIBVLC_VERSION_MAJOR > 2 - libvlc_media_parse_with_options(media, libvlc_media_parse_local, 0); -#else - libvlc_media_parse(media); -#endif - libvlc_media_release(media); // libvlc_media_new_location(), ref-counting! - } - } - else - { - ERROR_LOG(m_logger) << "Unknown media given: " << path; - libvlc_media_list_unlock(m_mediaList); - return false; - } - libvlc_media_list_unlock(m_mediaList); - - if (ui->outputWidget) - { -#if defined(Q_OS_WIN) - libvlc_media_player_set_hwnd(m_mPlayer, (HWND)ui->outputWidget->winId()); -#elif defined(Q_OS_MAC) - libvlc_media_player_set_agl(m_mPlayer, ui->outputWidget->winId()) ; -#else //Linux - libvlc_media_player_set_xwindow(m_mPlayer, ui->outputWidget->winId()); -#endif - } - - ui->btnPlay->setIcon(QIcon(QStringLiteral(":icons/16x16/media-playback-start.png"))); - ui->btnPlay->setEnabled(true); - ui->sldPosition->setEnabled(false); - ui->btnStop->setEnabled(true); - - currentSpeedIdx = 3; - - QTimer::singleShot(0, this, &AudioVideoWidget::Private::onPlay); - - return true; -} - -bool AudioVideoWidget::Private::stopVLC() -{ - DEBUG_LOG(m_logger) << "Stop playing"; - - QTimer::singleShot(0, this, &AudioVideoWidget::Private::onStop); - return true; -} - -void AudioVideoWidget::Private::setRate() -{ - DEBUG_LOG(m_logger) << "Setting speed to " << s_speedArray[currentSpeedIdx]; - - libvlc_state_t state = getState(); - if (state == libvlc_Playing || state == libvlc_Paused) - libvlc_media_player_set_rate(m_mPlayer, s_speedArray[currentSpeedIdx]); -} - -libvlc_state_t AudioVideoWidget::Private::getState() const -{ - libvlc_state_t s = libvlc_media_list_player_get_state(m_mListPlayer); - static libvlc_state_t lastState = libvlc_NothingSpecial; - if (s == lastState) - return s; - lastState = s; - if (s == libvlc_Error) - ERROR_LOG(m_logger) << "libVLC error: " << libvlc_errmsg(); - return s; -} - - -void AudioVideoWidget::Private::onSlower() -{ - if (currentSpeedIdx == 0) - return; - --currentSpeedIdx; - setRate(); - onUpdateGUI(); -} - -void AudioVideoWidget::Private::onFaster() -{ - if (currentSpeedIdx == 6) - return; - ++currentSpeedIdx; - setRate(); - onUpdateGUI(); -} - -void AudioVideoWidget::Private::on100pct() -{ - currentSpeedIdx = 3; - setRate(); - onUpdateGUI(); -} - -void AudioVideoWidget::Private::onPlay() -{ - if (libvlc_media_list_player_is_playing(m_mListPlayer)) - { - DEBUG_LOG(m_logger) << "Pause playing"; - libvlc_media_list_player_pause(m_mListPlayer); - ui->btnPlay->setIcon(QIcon(QStringLiteral(":icons/16x16/media-playback-start.png"))); - m_timer->stop(); - onUpdateGUIWithState(libvlc_Paused); - } - else - { - DEBUG_LOG(m_logger) << "Start playing"; - ui->btnPlay->setIcon(QIcon(QStringLiteral(":icons/16x16/media-playback-pause.png"))); - ui->sldPosition->setEnabled(true); - - libvlc_media_list_player_play(m_mListPlayer); - setRate(); - - m_timer->start(100); - onUpdateGUIWithState(libvlc_Playing); - } -} - -void AudioVideoWidget::Private::onStop() -{ - if (!m_mListPlayer) - return; - - libvlc_state_t state = getState(); - - if (state == libvlc_Stopped) - return; - - DEBUG_LOG(m_logger) << "Stop playing"; - - libvlc_media_list_player_stop(m_mListPlayer); - onUpdateGUI(); -} - -void AudioVideoWidget::Private::onPositionChanged(int newPosition) -{ - libvlc_state_t state = getState(); - - DEBUG_LOG(m_logger) << "Slider changed - going to new position"; - - if (state != libvlc_Playing && state != libvlc_Paused) - return; - - // Position geht von 0..1, Slider hat 1000 Steps - libvlc_media_player_set_position(m_mPlayer, newPosition / 1000.); - onUpdateGUI(); -} - -void AudioVideoWidget::Private::onVolumeChanged(int newVol) -{ - libvlc_audio_set_volume(m_mPlayer, newVol); - onUpdateGUI(); -} - -void AudioVideoWidget::Private::onUpdateGUI() -{ - onUpdateGUIWithState(libvlc_NothingSpecial); -} - -void AudioVideoWidget::Private::onUpdateGUIWithState(libvlc_state_t overwrite_state) -{ - libvlc_state_t state = overwrite_state; - if (state == libvlc_NothingSpecial) - state = getState(); - DEBUG_LOG(m_logger) << "onUpdateGUI for state " << state; - - if (state == libvlc_Playing || state == libvlc_Paused) - { - double maxTime = libvlc_media_player_get_length(m_mPlayer) / 1000.; - if (maxTime > 0.1) - { - libvlc_media_list_lock(m_mediaList); - const int cnt = libvlc_media_list_count(m_mediaList); - for (int i = cnt - 1; i >= 0; --i) - { - libvlc_media_t *media = libvlc_media_list_item_at_index(m_mediaList, i); - DEBUG_LOG(m_logger) << "Duration: " << libvlc_media_get_duration(media); - libvlc_media_release(media); - } - libvlc_media_list_unlock(m_mediaList); - - } - double curTime = libvlc_media_player_get_time(m_mPlayer) / 1000.; - auto curPos = libvlc_media_player_get_position(m_mPlayer); - // Slider ist in 1000 Schritte eingeteilt - ui->sldPosition->setValue(qRound(curPos * 1000)); - - const int minutesCur = floor(curTime / 60.); - const int secondsCur = curTime - 60 * minutesCur; - const int minutesAbs = floor(maxTime / 60.); - const int secondsAbs = maxTime - 60 * minutesAbs; - char timeStr[64]; - snprintf(timeStr, sizeof(timeStr), "%02d:%02d / %02d:%02d", minutesCur, secondsCur, minutesAbs, secondsAbs); - ui->lblPosition->setText(QString::fromLatin1(timeStr)); - - } - else if (state == libvlc_Stopped || state == libvlc_Ended) - { - // wir können nicht onStop() aufrufen -> rekursion! - bool bStop = true; - if (state == libvlc_Ended) - { - // Timer und VLC *nicht* stoppen da der aktuelle State ggf. genau zwischen den einzelnen - // Video-Schnipseln einer Playlist abgefragt wurde - // --> prüfen, ob es das letzte Video der Playlist war - libvlc_media_t *media = libvlc_media_player_get_media(m_mPlayer); - if (media != nullptr) - { - const int cnt = libvlc_media_list_count(m_mediaList); - if (cnt > 0) - { - libvlc_media_t *media2 = libvlc_media_list_item_at_index(m_mediaList, cnt - 1); - bStop = (media2 == media); - libvlc_media_release(media2); - } - libvlc_media_release(media); - } - if (bStop) - libvlc_media_list_player_stop(m_mListPlayer); - } - if (bStop) - { - ui->btnPlay->setIcon(QIcon(QStringLiteral(":icons/16x16/media-playback-start.png"))); - ui->sldPosition->setEnabled(false); - m_timer->stop(); - ui->sldPosition->setValue(0); - ui->lblPosition->setText(QLatin1String("--:-- / --:--")); - } - } - - QString speedStr = QStringLiteral("%1x").arg(s_speedArray[currentSpeedIdx], 4, 'f', 2); - ui->lblSpeed->setText(speedStr); -} - -/** - * AudioVideoInitThread - */ -AudioVideoInitThread::AudioVideoInitThread(AudioVideoWidget::Private *p) - : m_private(p) -{} - -void AudioVideoInitThread::run() -{ - m_private->initVLCInstance(true); -} - -/** - * AudioVideoWidget - */ -AudioVideoWidget::AudioVideoWidget(QWidget *parent) - : QFrame(parent) - , d(new Private(this)) -{} - -AudioVideoWidget::~AudioVideoWidget() -{ - delete d; -} - -bool AudioVideoWidget::play(const QUrl &file) -{ - d->initVLCPlayer(); - return d->playVLC(file); -} - -bool AudioVideoWidget::stop() -{ - return d->stopVLC(); -} - -void AudioVideoWidget::setAV(bool isAudio) -{ - d->setAV(isAudio); -} - -} // namespace THP - -#else // THP_HAS_VLC - Stub implementation when VLC is not available - -#include - -AudioVideoWidget::Private::Private(QFrame *parent) - : m_vlcinstance(nullptr) - , m_mPlayer(nullptr) - , m_mListPlayer(nullptr) - , m_mediaList(nullptr) - , currentSpeedIdx(2) - , m_parent(parent) - , m_timer(nullptr) - , m_initThread(nullptr) - , ui(new Ui::audioVideoWidget()) - , m_logger(NGL::INGLLogger::Instance()) -{ - m_logger.Log("AudioVideoWidget: VLC not available, using stub implementation", NGL::eLogWarning); - ui->setupUi(m_parent); -} - -AudioVideoWidget::Private::~Private() -{ - delete ui; -} - -bool AudioVideoWidget::Private::initVLCInstance(bool /*bInInitThread*/) -{ - m_logger.Log("AudioVideoWidget::initVLCInstance: VLC not available", NGL::eLogWarning); - return false; -} - -bool AudioVideoWidget::Private::uninitVLCInstance() -{ - return true; -} - -bool AudioVideoWidget::Private::initVLCPlayer() -{ - m_logger.Log("AudioVideoWidget::initVLCPlayer: VLC not available", NGL::eLogWarning); - return false; -} - -bool AudioVideoWidget::Private::uninitVLCPlayer() -{ - return true; -} - -bool AudioVideoWidget::Private::playVLC(const QUrl & /*url*/) -{ - m_logger.Log("AudioVideoWidget::playVLC: VLC not available", NGL::eLogWarning); - return false; -} - -bool AudioVideoWidget::Private::stopVLC() -{ - return true; -} - -void AudioVideoWidget::Private::setAV(bool /*isAudio*/) -{ - m_logger.Log("AudioVideoWidget::setAV: VLC not available", NGL::eLogWarning); -} - -void AudioVideoWidget::Private::onSlower() -{ -} - -void AudioVideoWidget::Private::onFaster() -{ -} - -void AudioVideoWidget::Private::on100pct() -{ -} - -void AudioVideoWidget::Private::onPlay() -{ -} - -void AudioVideoWidget::Private::onStop() -{ -} - -void AudioVideoWidget::Private::onPositionChanged(int /*pos*/) -{ -} - -void AudioVideoWidget::Private::onVolumeChanged(int /*vol*/) -{ -} - -void AudioVideoWidget::Private::onUpdateGUI() -{ -} - -void AudioVideoWidget::Private::onVLCInstanceInitializd() -{ -} - -void AudioVideoWidget::Private::clearMediaList() -{ -} - -void AudioVideoWidget::Private::playVLCInternal() -{ -} - -void AudioVideoWidget::Private::onUpdateGUIWithState(libvlc_state_t /*overwrite_state*/) -{ -} - -bool AudioVideoWidget::Private::init() -{ - m_logger.Log("AudioVideoWidget::init: VLC not available", NGL::eLogWarning); - return false; -} - -void AudioVideoWidget::Private::setRate() -{ -} - -libvlc_state_t AudioVideoWidget::Private::getState() const -{ - return libvlc_NothingSpecial; -} - -AudioVideoInitThread::AudioVideoInitThread(AudioVideoWidget::Private *p) - : m_private(p) -{ -} - -void AudioVideoInitThread::run() -{ -} - -#endif // THP_HAS_VLC - -} // namespace THP diff --git a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_audio_video_widget.h b/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_audio_video_widget.h deleted file mode 100755 index d78846615..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_audio_video_widget.h +++ /dev/null @@ -1,32 +0,0 @@ -/** - * @RDE_HEADER@ - * Handle Audio/Video output for thp through libvlc - * $Id$ - * $HeadURL$ - * $Author$ - */ -#pragma once - -#include - -class QUrl; - -namespace THP -{ -class AudioVideoWidget : public QFrame -{ - Q_OBJECT -public: - explicit AudioVideoWidget(QWidget *parent = nullptr); - ~AudioVideoWidget(); - - bool play(const QUrl &file); - bool stop(); - void setAV(bool isAudio = false); - -private: - class Private; - Private *const d; - friend class AudioVideoInitThread; -}; -} // namespace THP diff --git a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_audio_video_widget.ui b/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_audio_video_widget.ui deleted file mode 100755 index 2101cd62b..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_audio_video_widget.ui +++ /dev/null @@ -1,254 +0,0 @@ - - - audioVideoWidget - - - - 0 - 0 - 911 - 563 - - - - - 0 - 0 - - - - Form - - - QFrame::Panel - - - QFrame::Sunken - - - - - - - - - 0 - 0 - - - - - - - - - - - Qt::Vertical - - - QSizePolicy::MinimumExpanding - - - - 0 - 0 - - - - - - - - - - - - Audio - - - - - - - - 0 - 0 - - - - Qt::Horizontal - - - - - - - - 70 - 0 - - - - 55:55 / 55:55 - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - - false - - - - - - - :icons/16x16/media-playback-start.png:icons/16x16/media-playback-start.png - - - - - - - false - - - - - - - :icons/16x16/media-playback-stop.png:icons/16x16/media-playback-stop.png - - - - - - - - - - - :icons/16x16/media-play-slower.png:icons/16x16/media-play-slower.png - - - - - - - - - - - :icons/16x16/media-play-normal.png:icons/16x16/media-play-normal.png - - - - - - - - - - - :icons/16x16/media-play-faster.png:icons/16x16/media-play-faster.png - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 5 - 20 - - - - - - - - QFrame::Sunken - - - 100 % - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - Volume: - - - - - - - - 0 - 0 - - - - - 40 - 0 - - - - - 100 - 16777215 - - - - 100 - - - 60 - - - Qt::Horizontal - - - - - - - - - - - - - - diff --git a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_audio_video_widget_p.h b/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_audio_video_widget_p.h deleted file mode 100755 index 5e5d9ad86..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_audio_video_widget_p.h +++ /dev/null @@ -1,108 +0,0 @@ -/** - * @RDE_HEADER@ - * Handle Audio/Video output for thp through libvlc, private data - * $Id$ - * $HeadURL$ - * $Author$ - */ -#pragma once - -#ifdef _MSC_VER -// no ssize_t with msdn... -#include -typedef SSIZE_T ssize_t; -#endif - -#ifdef THP_HAS_VLC -#include -#endif -#include -#include -#include -#include "thp_audio_video_widget.h" - -class QUrl; -class QFrame; -class QTimer; -namespace Ui -{ -class audioVideoWidget; -} - -// Forward declarations for VLC types when VLC is not available -#ifndef THP_HAS_VLC -typedef int libvlc_state_t; -#define libvlc_NothingSpecial 0 -#endif - -namespace THP -{ -class AudioVideoInitThread; -class AudioVideoWidget::Private : public QObject -{ - Q_OBJECT -public: - explicit Private(QFrame *parent); - ~Private(); - - bool initVLCInstance(bool bInInitThread = false); - bool uninitVLCInstance(); - bool initVLCPlayer(); - bool uninitVLCPlayer(); - bool playVLC(const QUrl &url); - bool stopVLC(); - void setAV(bool isAudio); - -protected Q_SLOTS: - void onSlower(); - void onFaster(); - void on100pct(); - void onPlay(); - void onStop(); - void onPositionChanged(int); - void onVolumeChanged(int); - void onUpdateGUI(); - void onVLCInstanceInitializd(); - -protected: - void clearMediaList(); - void playVLCInternal(); - void onUpdateGUIWithState(libvlc_state_t overwrite_state); - bool init(); - void setRate(); - libvlc_state_t getState() const; - -#ifdef THP_HAS_VLC - libvlc_instance_t *m_vlcinstance; - libvlc_media_player_t *m_mPlayer; - libvlc_media_list_player_t *m_mListPlayer; - libvlc_media_list_t *m_mediaList; -#else - void *m_vlcinstance; - void *m_mPlayer; - void *m_mListPlayer; - void *m_mediaList; -#endif - - int currentSpeedIdx; - - QFrame *m_parent; - QTimer *m_timer; - AudioVideoInitThread *m_initThread; - - Ui::audioVideoWidget *ui; - - NGL::INGLLogger &m_logger; -}; - -class AudioVideoInitThread final : public QThread -{ - Q_OBJECT -public: - explicit AudioVideoInitThread(AudioVideoWidget::Private *p); -protected: - void run() override; -protected: - AudioVideoWidget::Private *m_private; -}; -} // namespace THP diff --git a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_building_settings.cpp b/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_building_settings.cpp deleted file mode 100755 index bde8fe762..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_building_settings.cpp +++ /dev/null @@ -1,118 +0,0 @@ -/** - * @RDE_HEADER@ - * HMI Plugin for MeteoDataManagement - Meteo Data Overview Dialog - * $Id$ - * $HeadURL$ - * $Author$ - * Created by Patric Karwat, SLSE, 2016-10-05 - */ - -#include "thp_building_settings.h" -#include "ui_thp_building_settings.h" -#include - -#include - -namespace THP -{ -static QVariant getSetting(const QString &key, const QVariant &def) -{ - return LtsUtils::OperatorSettings::getInstance()->value(QStringLiteral("BgViewer"), key, def); -} - -static void setSetting(const QString &key, const QVariant &val) -{ - LtsUtils::OperatorSettings::getInstance()->setValue(QStringLiteral("BgViewer"), key, val); -} - -BgViewerSettingsView::BgViewerSettingsView(BuildingViewer::BgViewerController *pBgvController, - QWidget *parent) - : QDialog(parent) - , m_ui(new Ui::BgViewerSettingsUI) - , m_pBgvController(pBgvController) -{ - m_ui->setupUi(this); - - connect(m_ui->m_pCheckBoxGlobalIsoMode, &QCheckBox::clicked, this, &BgViewerSettingsView::onViewModeChanged); - connect(m_ui->m_pCheckBoxUseDotsMode, &QCheckBox::clicked, this, &BgViewerSettingsView::onPlayerDisplayModeChanged); - connect(m_ui->m_pSliderGlobalTransparency, &QSlider::valueChanged, this, &BgViewerSettingsView::onTransparencyChanged); - connect(m_ui->m_pSliderPlayerSymbolSize, &QSlider::valueChanged, this, &BgViewerSettingsView::onSymbolSizeChanged); - connect(m_ui->m_slider_SymbolFlashing, &QSlider::valueChanged, this, &BgViewerSettingsView::onSymbolFireEventFlashingChanged); - connect(m_ui->m_slider_HitlineDuration, &QSlider::valueChanged, this, &BgViewerSettingsView::onHitLineDisplayLengthChanged); - - resetValues(); - onSymbolFireEventFlashingChanged(m_ui->m_slider_HitlineDuration->value()); - onHitLineDisplayLengthChanged(m_ui->m_slider_SymbolFlashing->value()); - - connect(m_ui->buttonBox, &QDialogButtonBox::accepted, this, &BgViewerSettingsView::accept); - connect(m_ui->buttonBox, &QDialogButtonBox::rejected, this, &BgViewerSettingsView::reject); -} - - -BgViewerSettingsView::~BgViewerSettingsView() -{ - delete m_ui; -} - - -void BgViewerSettingsView::accept() -{ - setSetting(QStringLiteral("GlobalTransparency"), m_ui->m_pSliderGlobalTransparency->value()); - setSetting(QStringLiteral("UseIsoMode"), m_ui->m_pCheckBoxGlobalIsoMode->isChecked()); - setSetting(QStringLiteral("UseDotsMode"), m_ui->m_pCheckBoxUseDotsMode->isChecked()); - setSetting(QStringLiteral("PlayerSymbolSize"), m_ui->m_pSliderPlayerSymbolSize->value()); - setSetting(QStringLiteral("maxHitlineDurationTime_s"), m_ui->m_slider_HitlineDuration->value()); - setSetting(QStringLiteral("GearFlashTime_s"), m_ui->m_slider_SymbolFlashing->value()); - setSetting(QStringLiteral("maxGearFlashTime_s"), m_ui->m_slider_SymbolFlashing->maximum()); - QDialog::accept(); -} - -void BgViewerSettingsView::reject() -{ - resetValues(); - QDialog::reject(); -} - -void BgViewerSettingsView::resetValues() -{ - m_ui->m_pSliderGlobalTransparency->setValue(getSetting(QStringLiteral("GlobalTransparency"), 75).toInt()); - m_ui->m_pCheckBoxGlobalIsoMode->setChecked(getSetting(QStringLiteral("UseIsoMode"), false).toBool()); - m_ui->m_pCheckBoxUseDotsMode->setChecked(getSetting(QStringLiteral("UseDotsMode"), false).toBool()) ; - m_ui->m_pSliderPlayerSymbolSize->setValue(getSetting(QStringLiteral("PlayerSymbolSize"), 20).toInt()); - m_ui->m_slider_HitlineDuration->setValue(getSetting(QStringLiteral("maxHitlineDurationTime_s"), 10).toInt()); - m_ui->m_slider_SymbolFlashing->setValue(getSetting(QStringLiteral("GearFlashTime_s"), 10).toInt()); -} - -void BgViewerSettingsView::onViewModeChanged() -{ - m_pBgvController->excSetGlobalViewMode(m_ui->m_pCheckBoxGlobalIsoMode->isChecked()); -} - -void BgViewerSettingsView::onPlayerDisplayModeChanged() -{ - m_pBgvController->excSetGlobalDotsMode(m_ui->m_pCheckBoxUseDotsMode->isChecked()); -} - -void BgViewerSettingsView::onSymbolSizeChanged() -{ - m_pBgvController->updatePlayerSymbols(m_ui->m_pSliderPlayerSymbolSize->value()); -} - -void BgViewerSettingsView::onTransparencyChanged() -{ - m_pBgvController->excSetGlobalTransparency(m_ui->m_pSliderGlobalTransparency->value()); -} - -void BgViewerSettingsView::onSymbolFireEventFlashingChanged(int val) -{ - // only modified per config setting... - m_ui->m_label_durationSymbolFlashing->setText(tr("%1 sec").arg(val)); -} - -void BgViewerSettingsView::onHitLineDisplayLengthChanged(int val) -{ - m_pBgvController->excSetHitlineDuration(val); - m_ui->m_label_HitlineDuration->setText(tr("%1 sec").arg(val)); -} - -} // namespace BuildingViewer diff --git a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_building_settings.h b/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_building_settings.h deleted file mode 100755 index 30da61be5..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_building_settings.h +++ /dev/null @@ -1,52 +0,0 @@ -/** - * @RDE_HEADER@ - * HMI Plugin for MeteoDataManagement - Meteo Data Overview Dialog - * $Id$ - * $HeadURL$ - * $Author$ - * Created by Patric Karwat, SLSE, 2016-10-05 - */ - -#pragma once - -#include - -namespace Ui -{ -class BgViewerSettingsUI; -} - -namespace BuildingViewer -{ -class BgViewerController; -} - -namespace THP -{ -class BgViewerSettingsView final : public QDialog -{ - Q_OBJECT - -public: - explicit BgViewerSettingsView(BuildingViewer::BgViewerController *pBgvController, - QWidget *parent = nullptr); - ~BgViewerSettingsView(); - -private slots: - void onViewModeChanged(); - void onPlayerDisplayModeChanged(); - void onTransparencyChanged(); - void onSymbolSizeChanged(); - void onSymbolFireEventFlashingChanged(int val); - void onHitLineDisplayLengthChanged(int val); - -private: - void accept() override; - void reject() override; - void resetValues(); - - Ui::BgViewerSettingsUI *m_ui; - BuildingViewer::BgViewerController *m_pBgvController; -}; - -} // namespace BuildingViewer diff --git a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_building_settings.ui b/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_building_settings.ui deleted file mode 100755 index f108dda16..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_building_settings.ui +++ /dev/null @@ -1,181 +0,0 @@ - - - BgViewerSettingsUI - - - - 300 - 0 - - - - General Settings - - - - - - Qt::Vertical - - - - 20 - 0 - - - - - - - - - - - 100 - 0 - - - - 100 - - - 75 - - - Qt::Horizontal - - - - - - - true - - - Use orthographic view mode - - - true - - - - - - - Player symbol size: - - - - - - - %1 sec - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - %1 sec - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Symbol fire event flashing: - - - - - - - 10 - - - 45 - - - 20 - - - Qt::Horizontal - - - - - - - Transparency value: - - - - - - - Hit line display length: - - - - - - - 120 - - - 5 - - - 10 - - - Qt::Horizontal - - - - - - - Use dots mode - - - - - - - true - - - 120 - - - 5 - - - 10 - - - Qt::Horizontal - - - - - - - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - diff --git a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_building_widget.cpp b/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_building_widget.cpp deleted file mode 100755 index ac2dbd45d..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_building_widget.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/** - * @RDE_HEADER@ - * Handle bulding display in thp - * $Id$ - * $HeadURL$ - * $Author$ - */ - -#include "thp_building_widget.h" -#include "ui_thp_situation_building_base.h" -#include "thp_building_settings.h" -#include "thp_plugin_provider.h" - -#include - -#include -#include -#include -#include - -#include - -namespace THP -{ -using namespace SituationReplay; - -BuildingWidget::BuildingWidget(QWidget *parent) - : SituationBuildingBase("THP.BuildingWidget", parent) -{ - QMenu *m = new QMenu(m_ui->btnFilter); - m->addAction(tr("Global Settings"), this, &BuildingWidget::onGlobalSettings); - m_ui->btnFilter->setMenu(m); -} - -BuildingWidget::~BuildingWidget() -{ - delete m_bgvController; -} - -bool BuildingWidget::init(SituationReplay::MainHandlerSqlite *mhs, BuildingPluginProvider *pp, const QString &homePath) -{ - if (!SituationBuildingBase::init(mhs)) - return false; - m_replayHandler = mhs; - m_pluginProvider = pp; - - // parse json, create xml, init buildingviewer - delete m_bgvController; - m_bgvController = new BuildingViewer::BgViewerController(this); - if (!m_bgvController->init(m_pluginProvider, true, homePath + QStringLiteral("/BuildingModels/"))) - return false; - - auto w = m_bgvController->getBgViewerWidget(); - w->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - m_ui->vLayout->insertWidget(0, w); - return true; -} - -bool BuildingWidget::showSituationInternal() -{ - m_bgvController->excRestoreViewState(m_attributes[QStringLiteral("arrBuildingStates")]); - if (!SituationBuildingBase::showSituationInternal()) - return false; - onInitDone(); - return true; -} - -void BuildingWidget::emitPartitionTimeChanged(qint64 curTime) -{ - m_pluginProvider->emitPartitionTimeChanged(curTime); -} - -void BuildingWidget::onGlobalSettings() -{ - if (!m_globalSettingsDialog) - m_globalSettingsDialog = new BgViewerSettingsView(m_bgvController, this); - m_globalSettingsDialog->show(); -} - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_building_widget.h b/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_building_widget.h deleted file mode 100755 index 573eb8a97..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_building_widget.h +++ /dev/null @@ -1,50 +0,0 @@ -/** - * @RDE_HEADER@ - * Handle bulding display in thp - * $Id$ - * $HeadURL$ - * $Author$ - */ -#pragma once - -#include -#include "thp_situation_building_base.h" - -namespace BuildingViewer -{ -class BgViewerController; -} -namespace Ui -{ -class BuildingWidget; -} -namespace THP -{ -class BuildingPluginProvider; -class BgViewerSettingsView; -class BuildingWidget : public SituationBuildingBase -{ - Q_OBJECT -public: - BuildingWidget(QWidget *parent = nullptr); - ~BuildingWidget(); - - bool init(SituationReplay::MainHandlerSqlite *mhs, - BuildingPluginProvider *pp, - const QString &homePath); - -protected: - bool showSituationInternal() override; - void emitPartitionTimeChanged(qint64 curTime) override; - -protected Q_SLOTS: - void onGlobalSettings(); - virtual void applyCurentFilter(const SituationReplay::FilterInformation &) override {} - virtual void applyNewOverlay(int) override {} - virtual void removeOverlay(int) override {} -private: - BuildingPluginProvider *m_pluginProvider = nullptr; - BuildingViewer::BgViewerController *m_bgvController = nullptr; - BgViewerSettingsView *m_globalSettingsDialog = nullptr; -}; -} // namespace THP diff --git a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_html_widget.cpp b/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_html_widget.cpp deleted file mode 100755 index d4f1fe354..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_html_widget.cpp +++ /dev/null @@ -1,139 +0,0 @@ -/** - * @RDE_HEADER@ - * Handle HTML output for thp - * $Id$ - * $HeadURL$ - * $Author$ - */ -#include "thp_html_widget.h" -#include "ui_thp_html_widget.h" - -#include -#include -#include - - -namespace THP -{ - -class MyQWebEnginePage : public QWebEnginePage -{ - Q_OBJECT -public: - explicit MyQWebEnginePage(NGL::INGLLogger &logger, QObject *parent = nullptr) - : QWebEnginePage(parent) - , m_logger(logger) - {} - MyQWebEnginePage(NGL::INGLLogger &logger, QWebEngineProfile *profile, QObject *parent = nullptr) - : QWebEnginePage(profile, parent) - , m_logger(logger) - {} - - bool needsToBeOpenedExternally(const QUrl &url) - { - const QString lpath = url.toString(); - const QStringRef ext = lpath.splitRef(QLatin1Char('.')).last(); - const QStringRef ext2Chars = ext.left(2); - if (ext == QLatin1String("html") && - lpath.midRef(lpath.lastIndexOf(QLatin1Char('/')) + 1).startsWith(QLatin1String("combined_"))) - return true; - // PDF - if (ext == QLatin1String("pdf")) - return true; - // A/V playlist - if (ext == QLatin1String("pls")) - return true; - // Situation - if (ext == QLatin1String("json")) - return true; - // Word/Excel/PowerPoint - if (ext2Chars == QLatin1String("do") || - ext2Chars == QLatin1String("xl") || - ext2Chars == QLatin1String("pp")) - return true; - return false; - } - - bool acceptNavigationRequest(const QUrl &url, - QWebEnginePage::NavigationType type, - bool isMainFrame) override - { - Q_UNUSED(isMainFrame) - if (type == QWebEnginePage::NavigationTypeLinkClicked) - { - if (needsToBeOpenedExternally(url)) - { - emit linkClicked(url); - DEBUG_LOG(m_logger) << "acceptNavigationRequest denied for " << url.toString(); - return false; - } - } - DEBUG_LOG(m_logger) << "acceptNavigationRequest allowed for " << url.toString(); - return true; - } - -Q_SIGNALS: - void linkClicked(const QUrl &url); -private: - NGL::INGLLogger &m_logger; - -}; - -HtmlWidget::HtmlWidget(QWidget *parent) - : QWidget(parent) - , ui(new Ui::HtmlWidget) - , m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("THP.HtmlWidget")) -{ - ui->setupUi(this); - auto webEnginePage = new MyQWebEnginePage(m_logger, this); - ui->html->setPage(webEnginePage); - connect(webEnginePage, &MyQWebEnginePage::linkClicked, this, &HtmlWidget::linkClicked); - connect(ui->html, &QWebEngineView::loadFinished, this, &HtmlWidget::loadFinished); - connect(ui->html, &QWebEngineView::urlChanged, this, &HtmlWidget::urlChanged); - connect(ui->html, &QWebEngineView::titleChanged, this, &HtmlWidget::titleChanged); -} - -HtmlWidget::~HtmlWidget() -{ - delete ui; -} - -void HtmlWidget::back() -{ - ui->html->back(); -} - -QString HtmlWidget::title() const -{ - return ui->html->title(); -} - -QUrl HtmlWidget::url() const -{ - return ui->html->url(); -} - -bool HtmlWidget::showHTML(const QUrl &url) -{ - if (!url.isValid()) - { - WARNING_LOG(m_logger) << "Invalid url: " << url.toString(); - return false; - } - ui->html->load(url); - return true; -} - -void HtmlWidget::setZoomFactor(double newZoomFactor) -{ - ui->html->setZoomFactor(newZoomFactor); -} - -void HtmlWidget::print(QPrinter *printer) const -{ - ui->html->page()->print(printer, [](bool) {}); -} - -} // namespace THP - -#include "thp_html_widget.moc" diff --git a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_html_widget.h b/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_html_widget.h deleted file mode 100755 index 02bb1abc5..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_html_widget.h +++ /dev/null @@ -1,46 +0,0 @@ -/** - * @RDE_HEADER@ - * Handle HTML output for thp - * $Id$ - * $HeadURL$ - * $Author$ - */ -#pragma once -#include -#include - -class QUrl; -class QPrinter; -namespace Ui -{ -class HtmlWidget; -} - -namespace THP -{ -class HtmlWidget : public QWidget -{ - Q_OBJECT -public: - explicit HtmlWidget(QWidget *parent = nullptr); - ~HtmlWidget(); - - void back(); - void print(QPrinter *printer) const; - void setZoomFactor(double newZoomFactor); - QString title() const; - QUrl url() const; - -public Q_SLOTS: - bool showHTML(const QUrl &url); - -Q_SIGNALS: - void linkClicked(const QUrl &link); - void loadFinished(bool); - void urlChanged(const QUrl &url); - void titleChanged(const QString &title); -protected: - Ui::HtmlWidget *ui; - NGL::INGLLogger &m_logger; -}; -} // namespace THP diff --git a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_html_widget.ui b/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_html_widget.ui deleted file mode 100755 index 2de91b1a5..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_html_widget.ui +++ /dev/null @@ -1,49 +0,0 @@ - - - HtmlWidget - - - - 0 - 0 - 719 - 540 - - - - Form - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - about:blank - - - - - - - - - QWebEngineView - QWidget -
QtWebEngineWidgets/QWebEngineView
-
-
- - -
diff --git a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_pdf_widget.cpp b/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_pdf_widget.cpp deleted file mode 100755 index 223b439cf..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_pdf_widget.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/** - * @RDE_HEADER@ - * Handle PDF output for thp - * $Id$ - * $HeadURL$ - * $Author$ - */ -#include "thp_pdf_widget.h" -#include "ui_thp_pdf_widget.h" - -namespace THP -{ - -PdfWidget::PdfWidget(QWidget *parent) - : QWidget(parent) - , ui(new Ui::PdfWidget) -{ - ui->setupUi(this); - - connect(ui->previousPage, &QToolButton::clicked, this, &PdfWidget::onPreviousPage); - connect(ui->nextPage, &QToolButton::clicked, this, &PdfWidget::onNextPage); - connect(ui->pdfDocument, &NGL::PDFDocument::currentPageChanged, this, &PdfWidget::pageChanged); -} - -PdfWidget::~PdfWidget() -{ - delete ui; -} - -bool PdfWidget::showPDF(const QUrl &pdf) -{ - return ui->pdfDocument->showPDF(pdf); -} - -void PdfWidget::setZoomFactor(double newZoomFactor) -{ - ui->pdfDocument->setZoomFactor(newZoomFactor); -} - -void PdfWidget::onPreviousPage() -{ - ui->pdfDocument->previousPage(); -} - -void PdfWidget::onNextPage() -{ - ui->pdfDocument->nextPage(); -} - -QVector PdfWidget::getPrintableImages(int resolution) -{ - return ui->pdfDocument->getPrintableImages(resolution); -} - -void PdfWidget::resizePdfToWidth() -{ - ui->pdfDocument->resizePdfToWidth(); -} - -void PdfWidget::pageChanged(int cur, int max) -{ - ui->pageLabel->setText(tr("Page %1 of %2").arg(cur).arg(max)); - ui->nextPage->setEnabled(cur < max); - ui->previousPage->setEnabled(cur > 1); -} - -} // namespace THP diff --git a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_pdf_widget.h b/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_pdf_widget.h deleted file mode 100755 index f109fbd1a..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_pdf_widget.h +++ /dev/null @@ -1,40 +0,0 @@ -/** - * @RDE_HEADER@ - * Handle PDF output for thp - * $Id$ - * $HeadURL$ - * $Author$ - */ -#pragma once -#include - - -class QUrl; -namespace Ui -{ -class PdfWidget; -} - -namespace THP -{ -class PdfWidget : public QWidget -{ - Q_OBJECT -public: - explicit PdfWidget(QWidget *parent = nullptr); - ~PdfWidget(); - - bool showPDF(const QUrl &pdf); - void setZoomFactor(double newZoomFactor); - QVector getPrintableImages(int resolution = 300); - void resizePdfToWidth(); - -protected Q_SLOTS: - void onPreviousPage(); - void onNextPage(); - void pageChanged(int cur, int max); -protected: - - Ui::PdfWidget *ui; -}; -} // namespace THP diff --git a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_pdf_widget.ui b/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_pdf_widget.ui deleted file mode 100755 index 9d7f14f46..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_pdf_widget.ui +++ /dev/null @@ -1,166 +0,0 @@ - - - PdfWidget - - - - 0 - 0 - 580 - 396 - - - - Form - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - - - - - Qt::Horizontal - - - - 202 - 20 - - - - - - - - - - - 0 - 0 - - - - - - - - :icons/16x16/go-previous.png:icons/16x16/go-previous.png - - - Ctrl+P - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 5 - 20 - - - - - - - - page %1 of %2 - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 5 - 20 - - - - - - - - - 0 - 0 - - - - - - - - :icons/16x16/go-next.png:icons/16x16/go-next.png - - - - 16 - 16 - - - - Ctrl+N - - - - - - - - - Qt::Horizontal - - - - 201 - 20 - - - - - - - - - NGL::PDFDocument - QWidget -
nglwidgets/nglpdfdocument.h
- 1 -
-
- - -
diff --git a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_situation_building_base.cpp b/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_situation_building_base.cpp deleted file mode 100755 index ea659022e..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_situation_building_base.cpp +++ /dev/null @@ -1,488 +0,0 @@ -/** - * @RDE_HEADER@ - * Handle situation display in thp - * $Id$ - * $HeadURL$ - * $Author$ - */ - -#include "thp_situation_building_base.h" -#include "ui_thp_situation_building_base.h" - -#include "thp_situation_filter_aes.h" -#include "thp_situation_filter_symbol_appearance.h" -#include "thp_situation_filter_collapse_expand.h" -#include "thp_situation_filter_types.h" -#include "thp_plugin_provider.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - -namespace THP -{ - -using namespace SituationReplay; - -SituationBuildingBase::SituationBuildingBase(const char *loggerName, - QWidget *parent) - : QFrame(parent) - , m_playTimer(new QTimer(this)) - , m_ui(new Ui::SituationBuildingBase) - , m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger(loggerName)) -{ - m_ui->setupUi(this); - m_ui->zoomSlider->hide(); - m_ui->sldPosition->setMinimum(0); - m_ui->sldPosition->setMaximum(s_sliderMax); - - m_playTimer->setSingleShot(true); - connect(m_playTimer, &QTimer::timeout, this, &SituationBuildingBase::onPlay); - - connect(m_ui->btnSlower, &QToolButton::clicked, this, &SituationBuildingBase::onSlower); - connect(m_ui->btnFaster, &QToolButton::clicked, this, &SituationBuildingBase::onFaster); - connect(m_ui->btn100pct, &QToolButton::clicked, this, &SituationBuildingBase::on100pct); - connect(m_ui->btnPlay, &QToolButton::clicked, this, &SituationBuildingBase::onPlay); - connect(m_ui->btnStop, &QToolButton::clicked, this, &SituationBuildingBase::onStop); - - connect(m_ui->sldPosition, &QSlider::sliderPressed, this, &SituationBuildingBase::onSliderPressed); - connect(m_ui->sldPosition, &QSlider::sliderMoved, this, &SituationBuildingBase::onSliderPositionChanged); - connect(m_ui->sldPosition, &QSlider::sliderReleased, this, &SituationBuildingBase::onSliderReleased); - - connect(m_ui->cbPlaybackParts, QOverload::of(&QComboBox::currentIndexChanged), - this, &SituationBuildingBase::onCbPlaybackPartsChanged); -} - -SituationBuildingBase::~SituationBuildingBase() -{ - delete m_ui; -} - -bool SituationBuildingBase::init(SituationReplay::MainHandlerSqlite *replayHandler) -{ - if (m_replayHandler) - m_replayHandler->disconnect(this); - m_replayHandler = replayHandler; - connect(m_replayHandler, &SituationReplay::MainHandlerSqlite::initialReplaySpeed, - this, &SituationBuildingBase::setSpeed); - connect(m_replayHandler, &SituationReplay::MainHandlerSqlite::applyCurentFilter, - this, &SituationBuildingBase::applyCurentFilter); - connect(m_replayHandler, &SituationReplay::MainHandlerSqlite::applyNewOverlay, - this, &SituationBuildingBase::applyNewOverlay); - connect(m_replayHandler, &SituationReplay::MainHandlerSqlite::removeOverlay, - this, &SituationBuildingBase::removeOverlay); - connect(m_replayHandler, &SituationReplay::MainHandlerSqlite::fileContentAvailable, - this, &SituationBuildingBase::onFileContentAvailable); - updatePositionLabel(LtsUtils::QPoint3D(), false); - updateSpeedLabel(); - return true; -} - -bool SituationBuildingBase::showSituation(const QString &sitReplayDescription, - const QString &basePath) -{ - // read ReplayInformation from sitmap.json (key 'replays') - - QFile f(sitReplayDescription); // ...Exercise_123//n/m/sitmap.json - if (!f.open(QIODevice::ReadOnly)) - { - WARNING_LOG(m_logger) << "Can not open file '" << sitReplayDescription << "': " << f.errorString(); - return false; - } - - QFileInfo fi(f); - m_scriptPath = fi.absolutePath(); - - QJsonParseError jError; - const QByteArray ba = f.readAll(); - QJsonDocument doc(QJsonDocument::fromJson(ba, &jError)); - if (jError.error) - { - WARNING_LOG(m_logger) << "Can not parse json document: " << jError.errorString(); - return false; - } - const QJsonObject rootObj = doc.object(); - const QJsonArray arrReplays(rootObj[QStringLiteral("replays")].toArray()); - QVector replayInformation; - replayInformation.reserve(arrReplays.size()); - for (const auto &val : arrReplays) - { - const QJsonObject obj = val.toObject(); - const QJsonObject objPb = obj[QStringLiteral("playbackTime")].toObject(); - const QJsonObject objSqlite = obj[QStringLiteral("replayInformation")].toObject(); - const QJsonObject objTip = objSqlite[QStringLiteral("timeInPresentation")].toObject(); - ReplayInformation info; - info.m_id = obj[QStringLiteral("id")].toInt(); - info.timeSpan = TimeSpan::fromJson(objPb); - info.relativeTimeSpan = TimeSpan::fromJson(objTip); - const int sqliteFolderId = objSqlite[QStringLiteral("id")].toInt(); - info.databaseFilePath = QStringLiteral("%1/%2/sitreplay.sqlite").arg(basePath).arg(sqliteFolderId); - info.replayConfigPath = QStringLiteral("%1/%2/sitreplay.json").arg(basePath).arg(sqliteFolderId); - if (info.relativeTimeSpan.begin < 0 || - info.relativeTimeSpan.end <= info.relativeTimeSpan.begin || - sqliteFolderId == 0) - { - WARNING_LOG(m_logger) << "Can not parse json document: " << QJsonDocument(obj).toJson(); - return false; - } - replayInformation.push_back(std::move(info)); - } - const QJsonObject attributes(rootObj[QStringLiteral("attributes")].toObject()); - const QJsonArray arrFilters1(attributes[QStringLiteral("Filters")].toArray()); - QVector filterInformation; - QVector overlayInformation; - - for (const auto &arrVal : arrFilters1) - { -// const QJsonArray arrFilters2(arrVal.toArray()); -// for (const auto &val : arrFilters2) -// { - FilterInformation filter; - const QJsonObject obj = arrVal.toObject(); - LtsScriptTimeline::TrackEntry te; - te.fromJson(obj); - if (te.m_topicId <= 0) - { - WARNING_LOG(m_logger) << "Can not load filter information from '" << QJsonDocument(obj).toJson() << "'"; - continue; - } - - if (te.m_type != LtsScriptTimeline::TrackEntryType::SituationMapFilter && - te.m_type != LtsScriptTimeline::TrackEntryType::TacticalPlan) - { - DEBUG_LOG(m_logger) << "Unknown Filter type " << te.m_type << " - ignoring: " << QJsonDocument(obj).toJson() << "'"; - continue; - } - - filter.m_id = te.m_topicId; - filter.relativeTimeSpan.begin = te.m_startTime * 1000LL; - filter.relativeTimeSpan.end = te.m_length * 1000LL + filter.relativeTimeSpan.begin; - const QJsonObject details = obj[QStringLiteral("detailData")].toObject(); - if (te.m_type == LtsScriptTimeline::TrackEntryType::SituationMapFilter) - { - const QJsonObject filters = te.m_detailData[QStringLiteral("filters")].toObject(); - filter.aesFilters = filters[QStringLiteral("AesFilterJson")].toObject(); - filter.symbolSettings = filters[QStringLiteral("SymbolAppearanceJson")].toObject(); - filter.buildingComponentSettings = filters[QStringLiteral("BuildingComponentSettingsJson")].toObject(); - filter.mapSettings = details[QStringLiteral("settings")].toObject(); - - if (filter.relativeTimeSpan.begin < 0 || filter.aesFilters.isEmpty() || filter.symbolSettings.isEmpty()) - { - WARNING_LOG(m_logger) << "Can not parse json document - can not read filter data " << QJsonDocument(obj).toJson(); - return false; - } - if (filter.buildingComponentSettings.isEmpty()) - { - WARNING_LOG(m_logger) << "Can not parse json document - can not read filter data 'BuildingComponentSettingsJson', json= " << QJsonDocument(obj).toJson(); - // return false; // support older thps with this thpViewer - } - - - filterInformation.push_back(std::move(filter)); - } - else if (te.m_type == LtsScriptTimeline::TrackEntryType::TacticalPlan) - { - if (filter.relativeTimeSpan.begin < 0) - { - WARNING_LOG(m_logger) << "Can not parse json document - can not read filter data " << QJsonDocument(obj).toJson(); - return false; - } - - // old version (before 2020/02) - filter.overlayId = details[QStringLiteral("FileId")].toInt(-1); - if (filter.overlayId >= 0) - { - DEBUG_LOG(m_logger) << "Add overlay with id " << filter.overlayId; - overlayInformation.push_back(std::move(filter)); - continue; - } - const QJsonArray arr = details[QStringLiteral("PlanItems")].toArray(); - if (arr.isEmpty()) - { - ERROR_LOG(m_logger) << "No PlanItems given - " << QJsonDocument(details).toJson(); - } - for (const auto &ele : arr) - { - const auto pi = PlanOverlaysPlugin::PlanOverlayModel::PlanItem::fromJson(ele.toObject()); - if (!pi.isValid() || pi.m_fileId <= 0) - { - WARNING_LOG(m_logger) << "Can not parse json document - can not read filter data " << QJsonDocument(ele.toObject()).toJson(); - return false; - } - filter.overlayId = pi.m_fileId; - DEBUG_LOG(m_logger) << "Add overlay with id " << filter.overlayId; - overlayInformation.push_back(filter); - } - } - //} - } - m_replayInformation = replayInformation; - m_filterInformation = filterInformation; - m_overlayInformation = overlayInformation; - m_attributes = rootObj[QStringLiteral("attributes")].toObject(); - return showSituationInternal(); -} - -bool SituationBuildingBase::showSituationInternal() -{ - m_ui->cbPlaybackParts->setVisible(m_replayInformation.size() > 1); - if (m_replayInformation.isEmpty()) - { - WARNING_LOG(m_logger) << "No replay information given..."; - return false; - } - - const QString sqliteDb = m_replayInformation.first().databaseFilePath; - if (sqliteDb.isEmpty()) - { - WARNING_LOG(m_logger) << "No database given..."; - return false; - } - QFileInfo fi(sqliteDb); - if (!fi.exists() || !fi.isFile() || !fi.isReadable()) - { - Q_ASSERT(false); - WARNING_LOG(m_logger) << "Can not access sqlite database '" << fi.absoluteFilePath() << "'"; - return false; - } - - m_ui->cbPlaybackParts->clear(); - m_ui->cbPlaybackParts->blockSignals(true); - for (int i = 0; i < m_replayInformation.size(); ++i) - { - const ReplayInformation &info = m_replayInformation.at(i); - m_ui->cbPlaybackParts->addItem(QStringLiteral("%1: %2 - %3").arg(i+1).arg(DTG::toStringMSec(info.timeSpan.begin, DTG::Long), - DTG::toStringMSec(info.timeSpan.end, DTG::Long)), i); - } - m_ui->cbPlaybackParts->setCurrentIndex(0); - m_ui->cbPlaybackParts->blockSignals(false); - onCbPlaybackPartsChanged(); // creates replayHandler for correct db etc. - - return true; -} - -void SituationBuildingBase::setSpeed(double newSpeed) -{ - m_speedVal = qBound(0.0, newSpeed, 16.0); - if (m_replayHandler->handlerSrp()) - m_replayHandler->handlerSrp()->onPaceChangeRequest(m_speedVal); - - updateSpeedLabel(); -} - -void SituationBuildingBase::onSlower() -{ - // cur speed = 9 -> new speed = 7 - // cur speed = 4 -> new speed = 3 - int diff = lrint(sqrt(m_speedVal) - 1); - if (diff < 1) - diff = 1; - setSpeed(m_speedVal - diff); -} - -void SituationBuildingBase::onFaster() -{ - int diff = lrint(sqrt(m_speedVal) - 1); - if (diff < 1) - diff = 1; - setSpeed(m_speedVal + diff); -} - -void SituationBuildingBase::on100pct() -{ - setSpeed(1.0); -} - -void SituationBuildingBase::onPlay() -{ - DEBUG_LOG(m_logger) << "OnPlay " << int(m_state); - switch (m_state) - { - case State::PS_STOP: - m_state = State::PS_PLAY; - if (m_replayHandler->handlerSrp()) - m_replayHandler->handlerSrp()->onStartReplayRequest(m_speedVal); - break; - case State::PS_PAUSE: - m_state = State::PS_PLAY; - if (m_replayHandler->handlerSrp()) - m_replayHandler->handlerSrp()->onResumeReplayRequest(); - break; - case State::PS_PLAY: - m_state = State::PS_PAUSE; - if (m_replayHandler->handlerSrp()) - m_replayHandler->handlerSrp()->onPauseReplayRequest(); - break; - case State::PS_UNDEFINED: - // dürfte nicht vorkommen - break; - } - - updateButtons(); -} - -void SituationBuildingBase::onStop() -{ - auto srp = m_replayHandler->handlerSrp(); - if (srp) - { - srp->onStopReplayRequest(); - onUpdateTimeSlider(srp->beginTime()); - } - m_state = State::PS_STOP; - updateButtons(); - m_ui->sldPosition->setValue(0); -} - -void SituationBuildingBase::onSliderPressed() -{ - if (m_replayHandler->handlerSrp()) - m_replayHandler->handlerSrp()->onPauseReplayRequest(); - m_state = State::PS_PAUSE; - updateButtons(); -} - -void SituationBuildingBase::onSliderPositionChanged(int newPosition) -{ - if (!m_replayHandler->handlerSrp()) - return; - auto srp = m_replayHandler->handlerSrp(); - const double len = (srp->endTime() - srp->beginTime()); - const double ofs = newPosition * len / s_sliderMax; - m_sliderMoveTime = qRound64(srp->beginTime() + ofs); - - m_currentTimeDTGString = DTG::toStringMSec(m_sliderMoveTime, DTG::Long); - m_ui->lblPosition->setText(m_currentTimeDTGString); -} - -void SituationBuildingBase::onSliderReleased() -{ - if (m_replayHandler->handlerSrp()) - m_replayHandler->handlerSrp()->onStartReplayRequest(m_sliderMoveTime, - m_replayHandler->handlerSrp()->endTime(), - m_speedVal); - m_state = State::PS_PLAY; - updateButtons(); -} - -void SituationBuildingBase::onUpdateTimeSlider(qint64 curTime) -{ - if (!m_replayHandler->handlerSrp() || m_state == State::PS_STOP) - return; - const auto srp = m_replayHandler->handlerSrp(); - const double len = (srp->endTime() - srp->beginTime()); - const double ofs = (curTime - srp->beginTime()); - double pos = ofs / len * s_sliderMax; - if (pos < 0) - pos = 0; - if (pos >= s_sliderMax) - { - onStop(); - return; - } - DEBUG_LOG(m_logger) << "onUpdateTimeSlider: " << curTime << ", pos: " << pos; - m_ui->sldPosition->setValue(qRound(pos)); - - m_currentTimeDTGString = DTG::toStringMSec(curTime, DTG::Long); - m_ui->lblPosition->setText(m_currentTimeDTGString); - emitPartitionTimeChanged(curTime); -} - -void SituationBuildingBase::onCbPlaybackPartsChanged() -{ - onStop(); - int idx = m_ui->cbPlaybackParts->currentData().toInt(); - if (idx < 0 || idx >= m_replayInformation.size()) - return; - const ReplayInformation &info = m_replayInformation.at(idx); - if (!m_replayHandler->initDb(info, m_filterInformation, m_overlayInformation)) - { - WARNING_LOG(m_logger) << "Can not initialize replay handler (" << info.databaseFilePath << ")"; - return; - } - - // currently after initDb since there handlerSrp is (re)created - connect(m_replayHandler->handlerSrp().get(), &SituationReplay::HandlerSituationReplaySqlite::replayTimeChanged, - this, &SituationBuildingBase::onUpdateTimeSlider, Qt::UniqueConnection); -} - -void SituationBuildingBase::updateSpeedLabel() -{ - QString speedStr = QStringLiteral("%1x").arg(m_speedVal, 4, 'f', 2); - m_ui->lblSpeed->setText(speedStr); -} - -void SituationBuildingBase::updatePositionLabel(const LtsUtils::QPoint3D &geoPos, bool isValid) -{ - if (isValid) - { - const LtsCoordTrans::UtmCoordinate coord(LtsCoordTrans::UtmCoordinate::fromGeographic(geoPos.x(), geoPos.y())); - m_ui->lblCursorPos->setText(coord.mgrs()); - } - else - { - m_ui->lblCursorPos->setText(QString()); - } -} - -QString SituationBuildingBase::currentDTGTime() const -{ - return m_currentTimeDTGString; -} - -void SituationBuildingBase::updateButtons() -{ - switch (m_state) - { - case State::PS_UNDEFINED: - m_ui->btnStop->setEnabled(false); - m_ui->btnPlay->setEnabled(false); - m_ui->btnPlay->setIcon(QIcon(QStringLiteral(":icons/16x16/media-playback-start.png"))); - m_ui->sldPosition->setEnabled(false); - break; - case State::PS_STOP: - m_ui->btnStop->setEnabled(false); - m_ui->btnPlay->setEnabled(true); - m_ui->btnPlay->setIcon(QIcon(QStringLiteral(":icons/16x16/media-playback-start.png"))); - m_ui->sldPosition->setEnabled(true); - break; - case State::PS_PLAY: - m_ui->btnStop->setEnabled(true); - m_ui->btnPlay->setEnabled(true); - m_ui->btnPlay->setIcon(QIcon(QStringLiteral(":icons/16x16/media-playback-pause.png"))); - m_ui->sldPosition->setEnabled(true); - break; - case State::PS_PAUSE: - m_ui->btnStop->setEnabled(true); - m_ui->btnPlay->setEnabled(true); - m_ui->btnPlay->setIcon(QIcon(QStringLiteral(":icons/16x16/media-playback-start.png"))); - m_ui->sldPosition->setEnabled(true); - break; - } -} - -bool SituationBuildingBase::stop() -{ - onStop(); - return true; -} - -void SituationBuildingBase::onInitDone() -{ - m_state = State::PS_STOP; - m_playTimer->start(); -} - -} // namespace THP diff --git a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_situation_building_base.h b/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_situation_building_base.h deleted file mode 100755 index 44f1a7d31..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_situation_building_base.h +++ /dev/null @@ -1,105 +0,0 @@ -/** - * @RDE_HEADER@ - * Handle situation / building display in thp - * $Id$ - * $HeadURL$ - * $Author$ - */ -#pragma once - -#include -#include -#include - -namespace FileManagement -{ -namespace Database -{ -struct FlmFileContent; -} -} - -namespace SituationReplay -{ -class MainHandlerSqlite; -} -namespace LtsUtils -{ -class QPoint3D; -} - -namespace Ui -{ -class SituationBuildingBase; -} -namespace THP -{ -enum class State -{ - PS_UNDEFINED = 0, - PS_STOP = 1, - PS_PLAY = 2, - PS_PAUSE = 3 -}; -constexpr int s_sliderMax = 1000; // 0 .. 1000 - -class SituationBuildingBase : public QFrame -{ - Q_OBJECT -public: - explicit SituationBuildingBase(const char *loggerName, - QWidget *parent = nullptr); - ~SituationBuildingBase(); - - bool init(SituationReplay::MainHandlerSqlite *replayHandler); - bool showSituation(const QString &sitReplayDescription, const QString &basePath); - - void updateButtons(); - bool stop(); - QString currentDTGTime() const; - -protected: - virtual bool showSituationInternal(); - -protected Q_SLOTS: - void setSpeed(double newSpeed); - virtual void applyCurentFilter(const SituationReplay::FilterInformation &filter) = 0; - virtual void applyNewOverlay(int overlayId) = 0; - virtual void removeOverlay(int overlayId) = 0; - void onSlower(); - void onFaster(); - void on100pct(); - void onPlay(); - void onStop(); - - void onSliderPressed(); - void onSliderPositionChanged(int newPosition); - void onSliderReleased(); - void updateSpeedLabel(); - void onUpdateTimeSlider(qint64 curTime); - void onCbPlaybackPartsChanged(); - void updatePositionLabel(const LtsUtils::QPoint3D &geoPos, bool isValid); - virtual void updateZoomSlider() {} - - virtual void onInitDone(); - virtual void emitPartitionTimeChanged(qint64 curTime) = 0; - - virtual void onFileContentAvailable(const FileManagement::Database::FlmFileContent &) {} -protected: - QVector m_replayInformation; - QVector m_filterInformation; - QVector m_overlayInformation; - QJsonObject m_attributes; - QString m_scriptPath; // sitmap.json - double m_speedVal = 1; - State m_state = State::PS_STOP; - QTimer *m_playTimer = nullptr; - SituationReplay::MainHandlerSqlite *m_replayHandler = nullptr; - - QString m_currentTimeDTGString; - qint64 m_sliderMoveTime = 0; - - Ui::SituationBuildingBase *m_ui; - NGL::INGLLogger &m_logger; -}; -} // namespace THP diff --git a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_situation_building_base.ui b/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_situation_building_base.ui deleted file mode 100755 index 7469397ea..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_situation_building_base.ui +++ /dev/null @@ -1,234 +0,0 @@ - - - SituationBuildingBase - - - - 0 - 0 - 911 - 563 - - - - - 0 - 0 - - - - Form - - - QFrame::Panel - - - QFrame::Sunken - - - - - - - - - - - 0 - 0 - - - - - 40 - 0 - - - - - - - - - 0 - 0 - - - - Qt::Horizontal - - - - - - - --:-- / --:-- - - - - - - - - - - - false - - - - - - - :icons/16x16/media-playback-start.png:icons/16x16/media-playback-start.png - - - - - - - false - - - - - - - :icons/16x16/media-playback-stop.png:icons/16x16/media-playback-stop.png - - - - - - - - - - - :icons/16x16/media-play-slower.png:icons/16x16/media-play-slower.png - - - - - - - - - - - :icons/16x16/media-play-normal.png:icons/16x16/media-play-normal.png - - - - - - - - - - - :icons/16x16/media-play-faster.png:icons/16x16/media-play-faster.png - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 5 - 20 - - - - - - - - QFrame::Sunken - - - 100 % - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 5 - 20 - - - - - - - - - 100 - 0 - - - - QComboBox::AdjustToContents - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - MGRS - - - - - - - Filter - - - QToolButton::InstantPopup - - - - - - - - - - - - THP::ZoomSlider - QWidget -
thpwidgets/thp_zoom_slider.h
-
-
- - -
diff --git a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_situation_filter_aes.cpp b/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_situation_filter_aes.cpp deleted file mode 100755 index c55bb6b3f..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_situation_filter_aes.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/** - * @RDE_HEADER@ - * AES filter dialog for situation map/thp - * $Id$ - * $HeadURL$ - * $Author$ - */ - -#include "thp_situation_filter_aes.h" - -#include -#include -#include -#include - -#include -#include -#include -#include - -namespace THP -{ -SituatationFilterAes::SituatationFilterAes(const std::shared_ptr &aesFilter, - SitMapPluginProvider *pluginProvider, - QWidget *parent) - : QDialog(parent) - , m_filterWidget(new FilterManagement::AesFilterWidget(this)) -{ - setWindowTitle(tr("Area Effect Simulation filter settings")); - QGridLayout *gl = new QGridLayout(this); - m_filterWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - gl->addWidget(m_filterWidget, 0, 0); - QFrame *line = new QFrame(this); - line->setFrameShape(QFrame::HLine); - line->setFrameShadow(QFrame::Sunken); - gl->addWidget(line, 1, 0); - QDialogButtonBox *bb = new QDialogButtonBox(this); - gl->addWidget(bb, 2, 0); - - - bb->setStandardButtons(QDialogButtonBox::Apply | QDialogButtonBox::Close | QDialogButtonBox::Cancel); - connect(bb->button(QDialogButtonBox::Apply), &QPushButton::clicked, - m_filterWidget, &FilterManagement::AesFilterWidget::apply); - connect(bb->button(QDialogButtonBox::Close), &QPushButton::clicked, - this, &SituatationFilterAes::accept); - connect(bb->button(QDialogButtonBox::Cancel), &QPushButton::clicked, - this, &SituatationFilterAes::reject); - - std::shared_ptr - ifcPpmCbx(std::make_shared()); - ifcPpmCbx->init(pluginProvider->ppmDtc()); - - std::shared_ptr - ifcPdmCbx(std::make_shared()); - ifcPdmCbx->init(pluginProvider->pdmDtc()); - - m_filterWidget->init(ifcPpmCbx, ifcPdmCbx, aesFilter); - // make sure to update ui when filter changes - connect(m_filterWidget, &FilterManagement::AesFilterWidget::unknownChangesRecognized, - m_filterWidget, &FilterManagement::AesFilterWidget::updateGuiToFilter); -} - -void SituatationFilterAes::accept() -{ - m_filterWidget->apply(); - QDialog::accept(); -} - -void SituatationFilterAes::reject() -{ - m_filterWidget->dialogCanceled(); - QDialog::reject(); -} - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_situation_filter_aes.h b/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_situation_filter_aes.h deleted file mode 100755 index 10b5c9144..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_situation_filter_aes.h +++ /dev/null @@ -1,35 +0,0 @@ -/** - * @RDE_HEADER@ - * AES filter dialog for situation map/thp - * $Id$ - * $HeadURL$ - * $Author$ - */ -#pragma once - -#include "thp_plugin_provider.h" -#include - -namespace FilterManagement -{ -class AesFilterWidget; -class AesDisplayFilter; -} -namespace THP -{ -class SitMapPluginProvider; -class SituatationFilterAes final : public QDialog -{ - Q_OBJECT -public: - explicit SituatationFilterAes(const std::shared_ptr &aesFilter, - SitMapPluginProvider *pluginProvider, - QWidget *parent = nullptr); - -protected: - void accept() override; - void reject() override; -private: - FilterManagement::AesFilterWidget *m_filterWidget; -}; -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_situation_filter_building_components.cpp b/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_situation_filter_building_components.cpp deleted file mode 100755 index 01522e954..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_situation_filter_building_components.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/** - * @RDE_HEADER@ - * Type filter dialog for situation map/thp - * $Id$ - * $HeadURL$ - * $Author$ - */ - -#include "thp_situation_filter_building_components.h" - -#include -#include -#include -#include - -#include -#include - -namespace THP -{ -SituationFilterBuildingComponent::SituationFilterBuildingComponent(const std::shared_ptr &bcs, - SitMapPluginProvider *pluginProvider, - QWidget *parent) - : QDialog(parent) - , m_filterWidget(new FilterManagement::BuildingComponentSettingsWidget(this)) -{ - setWindowTitle(tr("Building / Component filter settings")); - QGridLayout *gl = new QGridLayout(this); - m_filterWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - gl->addWidget(m_filterWidget, 0, 0); - QFrame *line = new QFrame(this); - line->setFrameShape(QFrame::HLine); - line->setFrameShadow(QFrame::Sunken); - gl->addWidget(line, 1, 0); - QDialogButtonBox *bb = new QDialogButtonBox(this); - gl->addWidget(bb, 2, 0); - - - bb->setStandardButtons(QDialogButtonBox::Apply | QDialogButtonBox::Close | QDialogButtonBox::Cancel); - connect(bb->button(QDialogButtonBox::Apply), &QPushButton::clicked, - m_filterWidget, &FilterManagement::BuildingComponentSettingsWidget::apply); - connect(bb->button(QDialogButtonBox::Close), &QPushButton::clicked, - this, &SituationFilterBuildingComponent::accept); - connect(bb->button(QDialogButtonBox::Cancel), &QPushButton::clicked, - this, &SituationFilterBuildingComponent::reject); - - m_filterWidget->init(bcs, pluginProvider->ismDtc()); -} - -void SituationFilterBuildingComponent::accept() -{ - m_filterWidget->apply(); - QDialog::accept(); -} - -void SituationFilterBuildingComponent::reject() -{ - m_filterWidget->dialogCanceled(); - QDialog::reject(); -} - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_situation_filter_building_components.h b/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_situation_filter_building_components.h deleted file mode 100755 index 25e6e4c8f..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_situation_filter_building_components.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @RDE_HEADER@ - * Type filter dialog for situation map/thp - * $Id$ - * $HeadURL$ - * $Author$ - */ -#pragma once - -#include "thp_plugin_provider.h" -#include - -namespace FilterManagement -{ -class BuildingComponentSettings; -class BuildingComponentSettingsWidget; -} -namespace THP -{ -class SitMapPluginProvider; -class SituationFilterBuildingComponent final : public QDialog -{ - Q_OBJECT -public: - explicit SituationFilterBuildingComponent(const std::shared_ptr &bcs, - SitMapPluginProvider *pluginProvider, - QWidget *parent = nullptr); -protected: - void accept() override; - void reject() override; -private: - FilterManagement::BuildingComponentSettingsWidget *m_filterWidget{nullptr}; -}; -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_situation_filter_collapse_expand.cpp b/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_situation_filter_collapse_expand.cpp deleted file mode 100755 index efbc0c29e..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_situation_filter_collapse_expand.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/** - * @RDE_HEADER@ - * AES filter dialog for situation map/thp - * $Id$ - * $HeadURL$ - * $Author$ - */ - -#include "thp_situation_filter_collapse_expand.h" - -#include -#include -#include -#include - -#include -#include -#include -#include - -namespace THP -{ -SituatationFilterCollapseExpand::SituatationFilterCollapseExpand(const std::shared_ptr &sas, - SitMapPluginProvider *pluginProvider, - QWidget *parent) - : QDialog(parent) - , m_filterWidget(new FilterManagement::CollapseExpandParticipantWidget(this)) -{ - setWindowTitle(tr("Collapse/Expand Participant filter settings")); - QGridLayout *gl = new QGridLayout(this); - m_filterWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - gl->addWidget(m_filterWidget, 0, 0); - QFrame *line = new QFrame(this); - line->setFrameShape(QFrame::HLine); - line->setFrameShadow(QFrame::Sunken); - gl->addWidget(line, 1, 0); - QDialogButtonBox *bb = new QDialogButtonBox(this); - gl->addWidget(bb, 2, 0); - - - bb->setStandardButtons(QDialogButtonBox::Apply | QDialogButtonBox::Close | QDialogButtonBox::Cancel); - connect(bb->button(QDialogButtonBox::Apply), &QPushButton::clicked, - m_filterWidget, &FilterManagement::CollapseExpandParticipantWidget::apply); - connect(bb->button(QDialogButtonBox::Close), &QPushButton::clicked, - this, &SituatationFilterCollapseExpand::accept); - connect(bb->button(QDialogButtonBox::Cancel), &QPushButton::clicked, - this, &SituatationFilterCollapseExpand::reject); - - std::shared_ptr - ifcPpmCbx(std::make_shared()); - ifcPpmCbx->init(pluginProvider->ppmDtc()); - - std::shared_ptr - ifcAsb(std::make_shared(pluginProvider->ppmDtc(), - pluginProvider->aesDtc(), - pluginProvider->gimDtc())); - - m_filterWidget->init(pluginProvider->ppmDtc(), - ifcPpmCbx, - ifcAsb, -// pluginProvider->fltParticipantIfc(), - sas); -} - -void SituatationFilterCollapseExpand::accept() -{ - m_filterWidget->apply(); - QDialog::accept(); -} - -void SituatationFilterCollapseExpand::reject() -{ - m_filterWidget->dialogCanceled(); - QDialog::reject(); -} - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_situation_filter_collapse_expand.h b/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_situation_filter_collapse_expand.h deleted file mode 100755 index 76bf78aec..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_situation_filter_collapse_expand.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @RDE_HEADER@ - * Collapse/Expand filter dialog for situation map/thp - * $Id$ - * $HeadURL$ - * $Author$ - */ -#pragma once - -#include "thp_plugin_provider.h" -#include - -namespace FilterManagement -{ -class CollapseExpandParticipantWidget; -class SymbolAppearanceSettings; -} -namespace THP -{ -class SitMapPluginProvider; -class SituatationFilterCollapseExpand final : public QDialog -{ - Q_OBJECT -public: - explicit SituatationFilterCollapseExpand(const std::shared_ptr &sas, - SitMapPluginProvider *pluginProvider, - QWidget *parent = nullptr); -protected: - void accept() override; - void reject() override; -private: - FilterManagement::CollapseExpandParticipantWidget *m_filterWidget; -}; -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_situation_filter_symbol_appearance.cpp b/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_situation_filter_symbol_appearance.cpp deleted file mode 100755 index 8c1ef29f2..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_situation_filter_symbol_appearance.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/** - * @RDE_HEADER@ - * AES filter dialog for situation map/thp - * $Id$ - * $HeadURL$ - * $Author$ - */ - -#include "thp_situation_filter_symbol_appearance.h" - -#include -#include -#include -#include - -#include -#include -#include - -namespace THP -{ -SituatationFilterSymbolAppearance::SituatationFilterSymbolAppearance(const std::shared_ptr &sas, - SitMapPluginProvider *pluginProvider, - QWidget *parent) - : QDialog(parent) - , m_filterWidget(new FilterManagement::SymbolAppearanceWidget(this)) -{ - setWindowTitle(tr("Symbol Appearance filter settings")); - QGridLayout *gl = new QGridLayout(this); - m_filterWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - gl->addWidget(m_filterWidget, 0, 0); - QFrame *line = new QFrame(this); - line->setFrameShape(QFrame::HLine); - line->setFrameShadow(QFrame::Sunken); - gl->addWidget(line, 1, 0); - QDialogButtonBox *bb = new QDialogButtonBox(this); - gl->addWidget(bb, 2, 0); - - - bb->setStandardButtons(QDialogButtonBox::Apply | QDialogButtonBox::Close | QDialogButtonBox::Cancel); - connect(bb->button(QDialogButtonBox::Apply), &QPushButton::clicked, - m_filterWidget, &FilterManagement::SymbolAppearanceWidget::apply); - connect(bb->button(QDialogButtonBox::Close), &QPushButton::clicked, - this, &SituatationFilterSymbolAppearance::accept); - connect(bb->button(QDialogButtonBox::Cancel), &QPushButton::clicked, - this, &SituatationFilterSymbolAppearance::reject); - - m_filterWidget->init(pluginProvider->ppmDtc()->partys(), sas); -} - -void SituatationFilterSymbolAppearance::accept() -{ - m_filterWidget->apply(); - QDialog::accept(); -} - -void SituatationFilterSymbolAppearance::reject() -{ - m_filterWidget->dialogCanceled(); - QDialog::reject(); -} - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_situation_filter_symbol_appearance.h b/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_situation_filter_symbol_appearance.h deleted file mode 100755 index 10a7e9083..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_situation_filter_symbol_appearance.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @RDE_HEADER@ - * Symbol Appearance filter dialog for situation map/thp - * $Id$ - * $HeadURL$ - * $Author$ - */ -#pragma once - -#include "thp_plugin_provider.h" -#include - -namespace FilterManagement -{ -class SymbolAppearanceSettings; -class SymbolAppearanceWidget; -} -namespace THP -{ -class SitMapPluginProvider; -class SituatationFilterSymbolAppearance final : public QDialog -{ - Q_OBJECT -public: - explicit SituatationFilterSymbolAppearance(const std::shared_ptr &sas, - SitMapPluginProvider *pluginProvider, - QWidget *parent = nullptr); -protected: - void accept() override; - void reject() override; -private: - FilterManagement::SymbolAppearanceWidget *m_filterWidget; -}; -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_situation_filter_types.cpp b/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_situation_filter_types.cpp deleted file mode 100755 index f07f88ceb..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_situation_filter_types.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/** - * @RDE_HEADER@ - * Type filter dialog for situation map/thp - * $Id$ - * $HeadURL$ - * $Author$ - */ - -#include "thp_situation_filter_types.h" - -#include -#include -#include -#include - -#include -#include -#include - -namespace THP -{ -SituatationFilterTypes::SituatationFilterTypes(const std::shared_ptr &sas, - SitMapPluginProvider *pluginProvider, - QWidget *parent) - : QDialog(parent) - , m_filterWidget(new FilterManagement::TypeFilterWidget(this)) -{ - setWindowTitle(tr("Type filter settings")); - QGridLayout *gl = new QGridLayout(this); - m_filterWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - gl->addWidget(m_filterWidget, 0, 0); - QFrame *line = new QFrame(this); - line->setFrameShape(QFrame::HLine); - line->setFrameShadow(QFrame::Sunken); - gl->addWidget(line, 1, 0); - QDialogButtonBox *bb = new QDialogButtonBox(this); - gl->addWidget(bb, 2, 0); - - - bb->setStandardButtons(QDialogButtonBox::Apply | QDialogButtonBox::Close | QDialogButtonBox::Cancel); - connect(bb->button(QDialogButtonBox::Apply), &QPushButton::clicked, - m_filterWidget, &FilterManagement::TypeFilterWidget::apply); - connect(bb->button(QDialogButtonBox::Close), &QPushButton::clicked, - this, &SituatationFilterTypes::accept); - connect(bb->button(QDialogButtonBox::Cancel), &QPushButton::clicked, - this, &SituatationFilterTypes::reject); - - std::shared_ptr - ifcPpmCbx(std::make_shared()); - ifcPpmCbx->init(pluginProvider->ppmDtc()); - - m_filterWidget->init(pluginProvider->ppmDtc(), - ifcPpmCbx, - sas); -} - -void SituatationFilterTypes::accept() -{ - m_filterWidget->apply(); - QDialog::accept(); -} - -void SituatationFilterTypes::reject() -{ - m_filterWidget->dialogCanceled(); - QDialog::reject(); -} - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_situation_filter_types.h b/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_situation_filter_types.h deleted file mode 100755 index fcf92b6a4..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_situation_filter_types.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @RDE_HEADER@ - * Type filter dialog for situation map/thp - * $Id$ - * $HeadURL$ - * $Author$ - */ -#pragma once - -#include "thp_plugin_provider.h" -#include - -namespace FilterManagement -{ -class SymbolAppearanceSettings; -class TypeFilterWidget; -} -namespace THP -{ -class SitMapPluginProvider; -class SituatationFilterTypes final : public QDialog -{ - Q_OBJECT -public: - explicit SituatationFilterTypes(const std::shared_ptr &sas, - SitMapPluginProvider *pluginProvider, - QWidget *parent = nullptr); -protected: - void accept() override; - void reject() override; -private: - FilterManagement::TypeFilterWidget *m_filterWidget; -}; -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_situation_widget.cpp b/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_situation_widget.cpp deleted file mode 100755 index b5132e476..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_situation_widget.cpp +++ /dev/null @@ -1,650 +0,0 @@ -/** - * @RDE_HEADER@ - * Handle situation display in thp - * $Id$ - * $HeadURL$ - * $Author$ - */ - -#include "thp_situation_widget.h" -#include "ui_thp_situation_building_base.h" - -#include "thp_situation_filter_aes.h" -#include "thp_situation_filter_symbol_appearance.h" -#include "thp_situation_filter_collapse_expand.h" -#include "thp_situation_filter_types.h" -#include "thp_situation_filter_building_components.h" -#include "thp_plugin_provider.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -namespace THP -{ - -class MySitMapIinit final : public SituationMap::SituationMapInit -{ - Q_OBJECT -public: - using SituationMap::SituationMapInit::SituationMapInit; - - bool trainingAreaExists() const override { return true; } - SituationMap::MapSettingsJson getMapSettingsFromService() const override { return m_mapSettingsJson; } - void setMapSettingsJson(const SituationMap::MapSettingsJson &settings) { m_mapSettingsJson = settings; } - const SituationMap::MapSettingsJson & getMapSettingsJson() const { return m_mapSettingsJson; } - -private: - SituationMap::MapSettingsJson m_mapSettingsJson; -}; - -using namespace SituationReplay; - -SituationWidget::SituationWidget(QWidget *parent) - : SituationBuildingBase("THP.SituationWidget", parent) - , m_pluginProvider(new SitMapPluginProvider) - , m_situationMapInit(new MySitMapIinit(nullptr)) -{ - QMenu *m = new QMenu(m_ui->btnFilter); - m->addAction(tr("AES Filter"), this, &SituationWidget::onFilterAes); - // 29.09.2022, Norbert Thoden - // SWPÄ 2:22 GUEZE-1477 Kartenfilter für Komponenten: - // Es wurde der Komponenten Filter eingeführt. - // in der LiveLage werden allerdings nur MountingPoints angezeigt, die auch eine - // zugeordnetes Asset haben. Die Zuordnug befindet sich in der Tabelle ism.sim_mounting_point_asset. - // ism.sim_mounting_point_asset wird derzeit nicht in die sitreplay.sqlite - // überführt. Es koennen also keine Komponenten angezeigt / gefiltert werden... - // FilterDialog nicht anzeigen: -// m->addAction(tr("Building / Component"), this, &SituationWidget::onFilterBuildingComponent); - - m->addAction(tr("Symbol Appearance"), this, &SituationWidget::onFilterSymbolAppearance); - m->addAction(tr("Collpase/Expand"), this, &SituationWidget::onFilterCollapseExpand); - m->addAction(tr("Type filter"), this, &SituationWidget::onFilterTypes); - m_ui->btnFilter->setMenu(m); -} - -SituationWidget::~SituationWidget() -{ - if (m_replayHandler->handlerSrp()) - m_replayHandler->handlerSrp()->onStopReplayRequest(); - delete m_situationMapInit; - delete m_pluginProvider; - delete m_replayHandler; -} - -bool SituationWidget::init(const QString &homePath, int exerciseId) -{ - m_pluginProvider->setExerciseId(exerciseId); - delete m_replayHandler; - m_replayHandler = new SituationReplay::MainHandlerSqlite; - - if (!SituationBuildingBase::init(m_replayHandler)) - return false; - - loadLayerMappings(homePath); - - SituationReplay::ConnectionParams connParams; - connParams.domainId = 1; - connParams.partitionId = 1; - if (!m_replayHandler->initDds(connParams)) - return false; - - if (!m_pluginProvider->init(m_replayHandler->ddsReplay())) - return false; - if (!m_situationMapInit->initPluginProvider(m_pluginProvider)) - return false; - - QPointer movementTrackMgr = - QPointer(new SituationMap::MovementTrackManager(m_situationMapInit)); - - FATAL_LOG(m_logger) << LOGFUNCTION << " XXXX initMap...."; - - if (!m_situationMapInit->initMap(false, SituationMap::Mode::Mode_2D)) - return false; - - if (!m_situationMapInit->initAdapter(movementTrackMgr, false)) - return false; - - SituationMap::Map *map = m_situationMapInit->getWidget(); - if (!map) - return false; - - connect(map, &SituationMap::Map::mouseGeoPositionChanged, - this, &SituationWidget::updatePositionLabel, - Qt::UniqueConnection); - connect(map, &SituationMap::Map::extentChanged, - this, &SituationWidget::updateZoomSlider); - - map->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - m_ui->vLayout->insertWidget(0, map); - - m_aesDisplayFilter = m_pluginProvider->fltAesIfc()->aesFilterForOperator(0, QString()); - m_symbolAppaearanceSettings = m_pluginProvider->fltParticipantIfc()->symbolAppearanceForOperator(0, QString()); - m_buildingComponentSettings = m_pluginProvider->fltBuildingComponentIfc()->buildingComponentSettingsForOperator(0, QString()); - - return true; -} - -bool SituationWidget::showSituationInternal() -{ - // cleanup 'old' map: - // remove old overlays from former session: - { - SituationMap::Map *map = m_situationMapInit->getWidget(); - if (map) - map->overlayHandler().removeAllOverlays(); - } - - - m_ui->cbPlaybackParts->setVisible(m_replayInformation.size() > 1); - - // MAYBE there are filter to be applied: - applyFilterFromReplayConfigFile(); - - if (m_replayInformation.isEmpty()) - { - WARNING_LOG(m_logger) << "No replay information given..."; - return false; - } - - const QString sqliteDb = m_replayInformation.first().databaseFilePath; - if (sqliteDb.isEmpty()) - { - WARNING_LOG(m_logger) << "No database given..."; - return false; - } - QFileInfo fi(sqliteDb); - if (!fi.exists() || !fi.isFile() || !fi.isReadable()) - { - Q_ASSERT(false); - WARNING_LOG(m_logger) << "Can not access sqlite database '" << fi.absoluteFilePath() << "'"; - return false; - } - - m_ui->cbPlaybackParts->clear(); - m_ui->cbPlaybackParts->blockSignals(true); - for (int i = 0; i < m_replayInformation.size(); ++i) - { - const ReplayInformation &info = m_replayInformation.at(i); - m_ui->cbPlaybackParts->addItem(QStringLiteral("%1: %2 - %3").arg(i+1).arg(DTG::toStringMSec(info.timeSpan.begin, DTG::Long), - DTG::toStringMSec(info.timeSpan.end, DTG::Long)), i); - } - m_ui->cbPlaybackParts->setCurrentIndex(0); - m_ui->cbPlaybackParts->blockSignals(false); - onCbPlaybackPartsChanged(); // creates replayHandler for correct db etc. - - SituationMap::Map *map = m_situationMapInit->getWidget(); - if (map->isReady()) - QTimer::singleShot(0, this, &SituationWidget::onInitDone); - else - connect(map, &SituationMap::Map::mapReady, - this, &SituationWidget::onInitDone, Qt::QueuedConnection); - - return true; -} - -bool SituationWidget::applyFilterFromReplayConfigFile() -{ - // Maybe the Situation topic has own Filter (AesFilter, SymbolAppearance; OperatorMapSettings) - // Read and apply them: - if (m_replayInformation.isEmpty()) - { - WARNING_LOG(m_logger) << "No replay information given..."; - return false; - } - - const QString replayConfigFile = m_replayInformation.first().replayConfigPath; // sitreplay.json - if (replayConfigFile.isEmpty()) - { - WARNING_LOG(m_logger) << "No replayConfigFile given..."; - return false; - } - - QFileInfo fi(replayConfigFile); - if (!fi.exists() || !fi.isFile() || !fi.isReadable()) - { - WARNING_LOG(m_logger) << "Can not access replayConfigFile '" << fi.absoluteFilePath() << "'"; - return false; - } - - QFile f(replayConfigFile); - if (!f.open(QIODevice::ReadOnly)) - { - WARNING_LOG(m_logger) << "Can not open replayConfigFile '" << fi.absoluteFilePath() << "': " << f.errorString(); - return false; - } - - QJsonParseError jError; - const QByteArray ba = f.readAll(); - QJsonDocument doc(QJsonDocument::fromJson(ba, &jError)); - if (jError.error) - { - WARNING_LOG(m_logger) << "Can not parse json document: " - << ", replayConfigFile '" << fi.absoluteFilePath() << "'" - << ", errorString= " << jError.errorString(); - return false; - } - - const QJsonObject &rootObj = doc.object(); - const QJsonObject &filters = rootObj[QStringLiteral("filters")].toObject(); // optional!!! - - if (filters.isEmpty()) - { - WARNING_LOG(m_logger) << "no 'filters' provided at " - << " replayConfigFile '" << fi.absoluteFilePath() << "'"; - return false; - } - - DEBUG_LOG(m_logger) << LOGFUNCTION << " XXXX replayConfigFile='" << fi.absoluteFilePath() << "'" - << " doc.toJson = " << doc.toJson(); - - // fine, put together - FilterInformation filterInfo; - filterInfo.aesFilters = filters[QStringLiteral("AesFilterJson")].toObject(); - filterInfo.symbolSettings = filters[QStringLiteral("SymbolAppearanceJson")].toObject(); - filterInfo.buildingComponentSettings = filters[QStringLiteral("BuildingComponentSettingsJson")].toObject(); - - filterInfo.mapSettings = rootObj[QStringLiteral("settings")].toObject(); - - applyCurentFilter(filterInfo); - - return true; -} - -void SituationWidget::applyCurentFilter(const SituationReplay::FilterInformation &filter) -{ - m_aesDisplayFilter->setFilterFromData(filter.aesFilters); - m_symbolAppaearanceSettings->setSettings(filter.symbolSettings, FilterManagement::SymbolAppearanceSettings::Part::All); - m_buildingComponentSettings->setBldCmpSettings(filter.buildingComponentSettings); - - SituationMap::OperatorMapSettings oms; - oms.fromJsonObject(filter.mapSettings); - if (oms.isEmpty() || oms.mode == SituationMap::Mode::Undefined) - return; - - - if (oms.mode != m_situationMapInit->getWidget()->mode()) - { - INFO_LOG(m_logger) << " Switching to new mode : " << oms.mode; - - SituationMap::MapSettingsJson savedMapSettingsJson; - if (m_situationMapInit) - { - savedMapSettingsJson = m_situationMapInit->getMapSettingsJson(); // containing path from layerMappping.json - m_situationMapInit->stopDisplay(); - m_situationMapInit->clearObjects(); - } - delete m_situationMapInit; - m_situationMapInit = new MySitMapIinit(nullptr); - m_situationMapInit->setMapSettingsJson(savedMapSettingsJson); - m_situationMapInit->initPluginProvider(m_pluginProvider); - - m_situationMapInit->initMap(false, oms.mode); - - QPointer movementTrackMgr = - QPointer(new SituationMap::MovementTrackManager(m_situationMapInit)); - if (!m_situationMapInit->initAdapter(movementTrackMgr, false)) - return; - - SituationMap::Map *map = m_situationMapInit->getWidget(); - if (map) - { - connect(map, &SituationMap::Map::mouseGeoPositionChanged, - this, &SituationWidget::updatePositionLabel, - Qt::UniqueConnection); - connect(map, &SituationMap::Map::extentChanged, - this, &SituationWidget::updateZoomSlider); - - map->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - m_ui->vLayout->insertWidget(0, map); - - - static bool s_waitFlag = true; - - QPointer mapNotifier = map->createMapNotifier(); - if (mapNotifier) - { - connect(mapNotifier.data(), &SituationMap::MapNotifier::mapReadyAndSymbolDictionaryLoaded, this, [this, oms]() - { - s_waitFlag = false; - if (!restoreOperatorMapSettingsOverlays(oms)) - WARNING_LOG(m_logger) << "restoreOperatorMapSettingsOverlays failed"; - - }); - mapNotifier->run(); - - // snyc wait :-( - { - DEBUG_LOG(m_logger) << " WAIT_SYNC BEGIN"; - int i=0; - while(i<100 && s_waitFlag) // 100 * 50ms = 5000ms - { - qApp->processEvents(QEventLoop::ExcludeUserInputEvents|QEventLoop::ExcludeSocketNotifiers, 50); - QThread::msleep(50); - ++i; - DEBUG_LOG(m_logger) << " WAIT_SYNC ..., i=" << i; - } - DEBUG_LOG(m_logger) << " WAIT_SYNC ...DONE, i=" << i; - DEBUG_LOG(m_logger) << " WAIT_SYNC, m_situationMapInit->getWidget()->mode()" << m_situationMapInit->getWidget()->mode(); - m_situationMapInit->startDisplay(); - } - } // if (mapNotifier) - } - } else { - if (!restoreOperatorMapSettingsOverlays(oms)) - WARNING_LOG(m_logger) << "restoreOperatorMapSettingsOverlays failed"; - } -} - -bool SituationWidget::restoreOperatorMapSettingsOverlays(const SituationMap::OperatorMapSettings &oms) -{ - if (!m_situationMapInit || !m_situationMapInit->getWidget() || oms.isEmpty()) - return false; - - if (!m_situationMapInit->getWidget()->restoreOperatorMapSettings(oms)) - WARNING_LOG(m_logger) << LOGFUNCTION << " restoreOperatorMapSettings failed"; - - // continue!!! maybe just LayerOrder failed.... ToDo - - // 2. handle Overlays : - // SituationMap can`t restore the overlays on it´s own: - // So we have to do it here: - const QList &orderedOverlayIds = oms.orderedOverlays; - DEBUG_LOG(m_logger) << LOGFUNCTION << " restore OverlayIds..."; - for (auto overlayId : qAsConst(orderedOverlayIds)) - { - DEBUG_LOG(m_logger) << LOGFUNCTION << " applyNewOverlay , overlayId=" << overlayId; - applyNewOverlay(overlayId); - } - return true; -} - -void SituationWidget::applyNewOverlay(int overlayId) -{ - const QString filename = QStringLiteral("%1/%2.TacticalPlan").arg(m_scriptPath).arg(overlayId); - QFile f(filename); - if (!f.open(QIODevice::ReadOnly)) - { - WARNING_LOG(m_logger) << "Can not open tactical plan '" << filename << "': " << f.errorString(); - return; - } - SituationMap::OverlayHandler &overlayHandler = m_situationMapInit->getWidget()->overlayHandler(); - if (!overlayHandler.setOverlay(overlayId, tr("Plan '%1'").arg(overlayId), f.readAll(), false)) - WARNING_LOG(m_logger) << "can not display overlay " << filename; - -} - -void SituationWidget::removeOverlay(int overlayId) -{ - SituationMap::OverlayHandler &overlayHandler = m_situationMapInit->getWidget()->overlayHandler(); - overlayHandler.removeOverlay(overlayId); -} - -void SituationWidget::onFilterAes() -{ - if (!m_filterAesDialog) - m_filterAesDialog = new SituatationFilterAes(m_aesDisplayFilter, - m_pluginProvider, this); - m_filterAesDialog->show(); -} - -void SituationWidget::onFilterSymbolAppearance() -{ - if (!m_filterSymbolAppearanceDialog) - m_filterSymbolAppearanceDialog = new SituatationFilterSymbolAppearance(m_symbolAppaearanceSettings, - m_pluginProvider, this); - m_filterSymbolAppearanceDialog->show(); -} - -void SituationWidget::onFilterCollapseExpand() -{ - if (!m_filterCollapseExpandDialog) - m_filterCollapseExpandDialog = new SituatationFilterCollapseExpand(m_symbolAppaearanceSettings, - m_pluginProvider, this); - m_filterCollapseExpandDialog->show(); -} - -void SituationWidget::onFilterTypes() -{ - if (!m_filterTypesDialog) - m_filterTypesDialog = new SituatationFilterTypes(m_symbolAppaearanceSettings, - m_pluginProvider, this); - m_filterTypesDialog->show(); -} - -void SituationWidget::onFilterBuildingComponent() -{ - if (!m_filterBuildingComponentDialog) - m_filterBuildingComponentDialog = new SituationFilterBuildingComponent(m_buildingComponentSettings, - m_pluginProvider, this); - m_filterBuildingComponentDialog->show(); -} - -void SituationWidget::emitPartitionTimeChanged(qint64 curTime) -{ - m_pluginProvider->emitPartitionTimeChanged(curTime); -} - -void SituationWidget::updateZoomSlider() -{ - // this is not really what we want to display... but currently we hide the slider anyway - m_ui->zoomSlider->setZoomValue(m_situationMapInit->getWidget()->scale() / 1000); -} - - -QString SituationWidget::centerPointString() const -{ - const QPointF center = m_situationMapInit->getWidget()->centerPoint(); - LtsCoordTrans::UtmCoordinate coord(LtsCoordTrans::UtmCoordinate::fromGeographic(center.x(), center.y())); - return coord.mgrs(); -} - -QRectF SituationWidget::extentMgrs() const -{ - const QRectF r = m_situationMapInit->getWidget()->extent(); - LtsCoordTrans::UtmCoordinate topLeft(LtsCoordTrans::UtmCoordinate::fromGeographic(r.left(), r.top())); - LtsCoordTrans::UtmCoordinate bottomRight(LtsCoordTrans::UtmCoordinate::fromGeographic(r.right(), r.bottom(), topLeft.zone)); - return QRectF(QPointF(topLeft.x, topLeft.y), QPointF(bottomRight.x, bottomRight.y)); -} - -QImage SituationWidget::grabFrameBuffer() const -{ - return m_situationMapInit->getWidget()->grab().toImage(); -} - -void SituationWidget::onInitDone() -{ - SituationBuildingBase::onInitDone(); - m_situationMapInit->startDisplay(); -} - -void SituationWidget::keyPressEvent(QKeyEvent *event) -{ - switch (event->key()) - { - case Qt::Key_F10: - onMgrsGrid(); - break; - case Qt::Key_PageUp: - onRotate(10); - break; - case Qt::Key_PageDown: - onRotate(-10); - break; - default: - QFrame::keyPressEvent(event); - break; - } -} - -void SituationWidget::onMgrsGrid() -{ - SituationMap::Map *m = m_situationMapInit->getWidget(); - m->grid().setVisible(!m->grid().isVisible()); -} - -void SituationWidget::onRotate(int degrees) -{ - SituationMap::Map *m = m_situationMapInit->getWidget(); - m->setRotation(m->rotation() + degrees); -} - -void SituationWidget::onFileContentAvailable(const FileManagement::Database::FlmFileContent &data) -{ - if (data.fileTypeId != FileManagement::FileType::OperatorDefinedSymbol || - data.fileStatusId != FileManagement::FileStatus::Valid || - data.content.size() == 0) - return; - - QColor colorToBeReplaced; - bool bIsXml = false; - - if (!data.properties.isEmpty()) - { - QJsonParseError parseError; - const QJsonDocument jDoc(QJsonDocument::fromJson(data.properties.toUtf8(), &parseError)); - const QJsonObject obj(jDoc.object()); - const QLatin1String imageFormatKey("imageFormat"); - bIsXml = obj.value(imageFormatKey).toString() == QLatin1String("xml"); - if (!bIsXml) - { - // partyColor - const QLatin1String partyColorStr("partyColor"); - if (obj.contains(partyColorStr)) - { - const QJsonObject partyColor = obj[partyColorStr].toObject(); - if (partyColor.size() == 3) // r, g, b - { - // update map: - colorToBeReplaced.setRgb( - partyColor[QLatin1String("r")].toInt(), - partyColor[QLatin1String("g")].toInt(), - partyColor[QLatin1String("b")].toInt()); - } // if (partyColor.size() == 3) - } // if (obj.contains(partyColorStr)) - } - } - - AdvancedSymbology::SymbologyType symType = AdvancedSymbology::SymbolDictionary::defaultSymbologyType(); - AdvancedSymbology::SymbolDictionary &dict = - AdvancedSymbology::SymbolDictionary::dictionary(symType); - if (bIsXml) - { - dict.setXmlSymbol(data.m_id, data.name, QStringLiteral("OperatorName"), 0, QString::fromUtf8(data.content), AdvancedSymbology::SymbolProperties()); - } - else - { - QImage image; - QSvgRenderer svgRenderer; - if (!svgRenderer.load(data.content)) - return; - - // prepare Image: - constexpr int size = 200; // pixel - QImage imageOut(size, size, QImage::Format_ARGB32); - imageOut.fill(Qt::transparent); - - // render - QPainter painter(&imageOut); - svgRenderer.render(&painter); - painter.end(); - - AdvancedSymbology::SymbolProperties symProps; - symProps.setKey(data.name); - symProps.setSidc(AdvancedSymbology::SidcCodec::encodeCivilEts(data.name)); - symProps.setName(data.name); - symProps.setSymbolClass(QLatin1String("3")); // 18.10.2016, N.Thoden: 3 == PointSymbol (mil2525d.stylx - QuartzRelease) - symProps.setGeometryType(AdvancedSymbology::GeometryType::Point); // ETS-Symbols are always Points - symProps.setTags({data.name}); - symProps.setColorToBeReplaced(colorToBeReplaced); - - dict.setEtsSymbol(data.m_id, data.name, symProps, image); - } -} - -void SituationWidget::loadLayerMappings(const QString &homePath) -{ - const QString mappingsFile = homePath + QStringLiteral("/layerMapping.json"); - - QFile f(mappingsFile); - if (!f.open(QIODevice::ReadOnly)) - { - fprintf(stderr, "Could not load layer mappings from '%s' - %s\n", mappingsFile.toStdString().c_str(), f.errorString().toStdString().c_str()); - WARNING_LOG(m_logger) << "Could not load layer mappings from " << mappingsFile << ": " << f.errorString(); - return; - } - m_layerMapping.clear(); - const QJsonObject obj = QJsonDocument::fromJson(f.readAll()).object(); - - SituationMap::MapSettingsJson settings; - if (!settings.fromJsonObject(obj)) - { - WARNING_LOG(m_logger) << "Could not parse layer mappings from " << mappingsFile; - return; - } - - settings.setMapUrls(fixupUrls(settings.getMapUrls(), homePath)); - settings.setSceneUrls(fixupUrls(settings.getSceneUrls(), homePath)); - settings.setSceneObjectUrls(fixupUrls(settings.getSceneObjectUrls(), homePath)); - settings.setElevationUrls(fixupUrls(settings.getElevationUrls(), homePath)); - - m_situationMapInit->setMapSettingsJson(settings); -} - -QVector SituationWidget::fixupUrls(const QVector &in, - const QString &homePath) -{ - QVector out; - for (auto url : in) - { - const QString fn = QStringLiteral("%1/Maps/%2").arg(homePath, url.url()); - if (!QFile::exists(fn)) - { - fprintf(stderr, "Can not find map data file '%s'\n", fn.toStdString().c_str()); - QMessageBox::warning(this, tr("Can not find map data"), - tr("Can not find map data file '%1' - can't start application").arg(fn)); - QCoreApplication::quit(); - return out; - } - url.setUrl(QUrl::fromLocalFile(fn).toString()); - out.push_back(std::move(url)); - } - return out; -} - -} // namespace THP - -#include "thp_situation_widget.moc" diff --git a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_situation_widget.h b/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_situation_widget.h deleted file mode 100755 index f888f48d1..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_situation_widget.h +++ /dev/null @@ -1,106 +0,0 @@ -/** - * @RDE_HEADER@ - * Handle situation display in thp - * $Id$ - * $HeadURL$ - * $Author$ - */ -#pragma once - -#include -#include "thp_situation_building_base.h" - -namespace SituationReplay -{ -class HandlerSituationReplaySqlite; -} -namespace SituationMap -{ -class BaseUrl; -struct OperatorMapSettings; -} -namespace FilterManagement -{ -class AesDisplayFilter; -class SymbolAppearanceSettings; -class BuildingComponentSettings; -} - -namespace Ui -{ -class SituationWidget; -} -namespace THP -{ -class SitMapPluginProvider; -class SituatationFilterAes; -class SituatationFilterSymbolAppearance; -class SituatationFilterCollapseExpand; -class SituatationFilterTypes; -class SituationFilterBuildingComponent; -class MySitMapIinit; - -class SituationWidget : public SituationBuildingBase -{ - Q_OBJECT -public: - explicit SituationWidget(QWidget *parent = nullptr); - ~SituationWidget(); - - bool init(const QString &homePath, int exerciseId); - - SituationReplay::MainHandlerSqlite *replayHandler() { return m_replayHandler; } - SitMapPluginProvider *pluginProvider() { return m_pluginProvider; } - - - QImage grabFrameBuffer() const; - QString centerPointString() const; - QRectF extentMgrs() const; // mgrs - -protected: - bool showSituationInternal() override; - bool applyFilterFromReplayConfigFile(); - - void keyPressEvent(QKeyEvent *event) override; - void loadLayerMappings(const QString &homePath); - QVector fixupUrls(const QVector &in, - const QString &homePath); - - bool restoreOperatorMapSettingsOverlays(const SituationMap::OperatorMapSettings &oms); - -private Q_SLOTS: - void applyCurentFilter(const SituationReplay::FilterInformation &filter) override; - void applyNewOverlay(int overlayId) override; - void removeOverlay(int overlayId) override; - - void onFilterAes(); - void onFilterSymbolAppearance(); - void onFilterCollapseExpand(); - void onFilterTypes(); - void onFilterBuildingComponent(); - - void updateZoomSlider() override; - - void onInitDone() override; - void emitPartitionTimeChanged(qint64 curTime) override; - void onMgrsGrid(); - void onRotate(int degrees); - - void onFileContentAvailable(const FileManagement::Database::FlmFileContent &data) override; -private: - QVector> m_layerMapping; - - SitMapPluginProvider *m_pluginProvider{nullptr}; - MySitMapIinit *m_situationMapInit{nullptr}; - SituatationFilterAes *m_filterAesDialog{nullptr}; - SituatationFilterSymbolAppearance *m_filterSymbolAppearanceDialog{nullptr}; - SituatationFilterCollapseExpand *m_filterCollapseExpandDialog{nullptr}; - SituatationFilterTypes *m_filterTypesDialog{nullptr}; - SituationFilterBuildingComponent *m_filterBuildingComponentDialog{nullptr}; - - std::shared_ptr m_aesDisplayFilter; - std::shared_ptr m_symbolAppaearanceSettings; - std::shared_ptr m_buildingComponentSettings; - -}; -} // namespace THP diff --git a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_zoom_slider.cpp b/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_zoom_slider.cpp deleted file mode 100755 index 397fa4d61..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_zoom_slider.cpp +++ /dev/null @@ -1,237 +0,0 @@ -/** - * @RDE_HEADER@ - * A special slider for zooming - * $Id$ - * $HeadURL$ - * $Author$ - */ - -#include "thp_zoom_slider.h" -#include -#include -#include -#include - -namespace THP -{ - -ZoomSlider::ZoomSlider(QWidget *parent) - : QWidget(parent) - , m_InternalMin(0.1) - , m_InternalMax(100) - , m_LowerThreshold(1) - , m_UpperThreshold(10) - , m_MinRange(0) - , m_MaxRange(280) - , m_Slider(nullptr) - , m_lbl(nullptr) - , m_text(nullptr) - , m_ZoomValue(-1) - , m_curSliderVal(-1) -{ - setShowDescriptionLabel(true); - setShowValueLabel(true); - m_Slider = new QSlider(this); - - connect(m_Slider, &QSlider::valueChanged, this, &ZoomSlider::calcZoomFromSlider); - connect(this, &ZoomSlider::valueChanged, this, &ZoomSlider::updateLabel); - - m_Slider->setRange(m_MinRange, m_MaxRange); - m_Slider->setSingleStep(1); - m_Slider->setPageStep(1); - - setOrientation(Qt::Horizontal); - //Initial calculation - calcZoomFromSlider(m_Slider->value()); - -} - -void ZoomSlider::setZoomValue(double zoomValue) -{ - if (qFuzzyCompare(m_ZoomValue, zoomValue)) - return; - //ignore values outside Min/Max boundaries. - if (zoomValue < m_InternalMin || zoomValue > m_InternalMax) - return; - m_ZoomValue = zoomValue; - - if (zoomValue < m_LowerThreshold) - { - //Range is 0..50% - double l_Range = (m_MaxRange - m_MinRange) / 2; - - double l_ValToSet = l_Range / static_cast(m_LowerThreshold - m_InternalMin) * (zoomValue - m_InternalMin); - //qDebug() << "Value1 = " << l_ValToSet; - m_curSliderVal = static_cast(l_ValToSet); - - } - else if (zoomValue < m_UpperThreshold) - { - //Range is 50%..75% - double l_Range = (m_MaxRange - m_MinRange) / 4; - double l_ValToSet = l_Range / static_cast(m_UpperThreshold - m_LowerThreshold) * (zoomValue - m_LowerThreshold); - l_ValToSet += l_Range * 2; - //qDebug() << "Value2 = " << l_ValToSet; - m_curSliderVal = static_cast(l_ValToSet); - - } - else - { - //Range is 75%..100% - double l_Range = (m_MaxRange - m_MinRange) / 4; - double l_ValToSet = l_Range / static_cast(m_InternalMax - m_UpperThreshold) * (zoomValue - m_UpperThreshold); - l_ValToSet += l_Range * 3; - //qDebug() << "Value3 = " << l_ValToSet; - m_curSliderVal = static_cast(l_ValToSet); - - } - m_Slider->setValue(m_curSliderVal); - updateLabel(m_ZoomValue); -} - -double ZoomSlider::getZoomValue() const -{ - return m_ZoomValue; -} - -void ZoomSlider::setOrientation(Qt::Orientation a_orientation) -{ - if (!m_Slider) - return; - - m_Slider->setOrientation(a_orientation); - QBoxLayout *l_Layout; - if (a_orientation == Qt::Horizontal) - { - m_Slider->setMinimumWidth(40); - m_Slider->setMinimumHeight(0); - l_Layout = new QHBoxLayout; - } - else - { - m_Slider->setMinimumWidth(0); - m_Slider->setMinimumHeight(40); - l_Layout = new QVBoxLayout; - } - l_Layout->setContentsMargins(0, 0, 0, 0); - if (m_text) - l_Layout->addWidget(m_text); - if (m_Slider) - l_Layout->addWidget(m_Slider); - if (m_lbl) - l_Layout->addWidget(m_lbl); - delete layout(); - setLayout(l_Layout); -} - -Qt::Orientation ZoomSlider::getOrientation() const -{ - if (m_Slider) - return m_Slider->orientation(); - return Qt::Horizontal; -} - -bool ZoomSlider::getShowDescriptionLabel() const -{ - return (m_text != nullptr); -} - -void ZoomSlider::setShowDescriptionLabel(bool bVisible) -{ - if (getShowDescriptionLabel() == bVisible) - return; - if (bVisible) - { - m_text = new QLabel(this); - m_text->setText(tr("Zoom:")); - } - else - { - delete m_text; - m_text = nullptr; - } - setOrientation(getOrientation()); -} - -bool ZoomSlider::getShowValueLabel() const -{ - return (m_lbl != nullptr); -} - -void ZoomSlider::setShowValueLabel(bool bVisible) -{ - if (getShowValueLabel() == bVisible) - return; - if (bVisible) - m_lbl = new QLabel(this); - else - { - delete m_lbl; - m_lbl = nullptr; - } - setOrientation(getOrientation()); - updateLabel(m_ZoomValue); -} - - -void ZoomSlider::calcZoomFromSlider(int a_value) -{ - if (m_curSliderVal == a_value) - return; - m_curSliderVal = a_value; - - if (a_value < (m_MaxRange - m_MinRange) / 2) - { - //Range 0% - 50% - double l_R1 = (m_MaxRange - m_MinRange) / 2; - double l_R2 = (m_LowerThreshold - m_InternalMin); - double l_ValToSet = l_R2 / l_R1 * a_value; - l_ValToSet += m_InternalMin; - //qDebug() << "Value4 = " << l_ValToSet; - m_ZoomValue = l_ValToSet; - } - else if (a_value < 3 * (m_MaxRange - m_MinRange) / 4) - { - //Range 50% - 75% - double l_R1 = (m_MaxRange - m_MinRange) / 4; - double l_R2 = (m_UpperThreshold - m_LowerThreshold); - double l_SliderVal = a_value - (m_MaxRange - m_MinRange) / 2; - double l_ValToSet = l_R2 / l_R1 * l_SliderVal; - l_ValToSet += static_cast(m_LowerThreshold); - //qDebug() << "Value5 = " << l_ValToSet; - m_ZoomValue = l_ValToSet; - } - else - { - //Range 75% - 100% - double l_R1 = (m_MaxRange - m_MinRange) / 4; - double l_R2 = (m_InternalMax - m_UpperThreshold); - double l_SliderVal = a_value - (m_MaxRange - m_MinRange) / 4 * 3; - double l_ValToSet = l_R2 / l_R1 * l_SliderVal; - - l_ValToSet += static_cast(m_UpperThreshold); - //qDebug() << "Value6 = " << l_ValToSet; - m_ZoomValue = l_ValToSet; - } - emit valueChanged(m_ZoomValue); -} - -void ZoomSlider::updateLabel(double newValue) -{ - if (!m_lbl) - return; - m_lbl->setText(formatValue(newValue)); -} - -QString ZoomSlider::formatValue(double value) const -{ - if (value < m_LowerThreshold) - return QStringLiteral("%1x").arg(value, 4, 'f', 2); - if (value < m_UpperThreshold) - return QStringLiteral("%1x").arg(value, 4, 'f', 1); - - return QStringLiteral("%1x").arg(value, 4, 'f', 0); -} - -} // namespace THP - diff --git a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_zoom_slider.h b/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_zoom_slider.h deleted file mode 100755 index a36098674..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_zoom_slider.h +++ /dev/null @@ -1,152 +0,0 @@ -/** - * @RDE_HEADER@ - * A special slider for zooming - * $Id$ - * $HeadURL$ - * $Author$ - */ - -#pragma once - -#include - -class QLabel; -class QSlider; - -namespace THP -{ -/** - * An specialized QSlider - * This slider has a special, fixed range from 0.1 - 100 which is mapped to - * suitable map scales used in the GUEZ. - * The scale is not linear - instead it has a model behind. in smaller scales - - * slider's going to 0.1 - it's resolution is finer than on larger scales - - * slider's going to 100. - * The slider accpets only values within the range 0.1....100. Other values are ignored. - */ -class ZoomSlider : public QWidget -{ - Q_OBJECT - Q_PROPERTY(Qt::Orientation Orientation READ getOrientation WRITE setOrientation) - Q_PROPERTY(bool showDescriptionLabel READ getShowDescriptionLabel WRITE setShowDescriptionLabel) - Q_PROPERTY(bool showValueLabel READ getShowValueLabel WRITE setShowValueLabel) - -public: - - /** - * constructor - */ - explicit ZoomSlider(QWidget *parent = nullptr); - - /** - * get the actual Zoom value. - * @return float with the zoom value - */ - double getZoomValue() const; - - /** - * Sets the Orientation. - * @param a_orientation The slider's orientation. - */ - void setOrientation(Qt::Orientation a_orientation); - - /** - * - */ - Qt::Orientation getOrientation() const; - - bool getShowDescriptionLabel() const; - void setShowDescriptionLabel(bool bVisible); - - bool getShowValueLabel() const; - void setShowValueLabel(bool bVisible); - - /** - * format the given value as it would be shown in the zoom label - */ - QString formatValue(double value) const; - -public Q_SLOTS: - /** - * set the slider's actual zoom value. This is a QT-Slot. - * The slider accpet only values within it's range 0.1...100. - * Other values are ignored. - * @param a_zoomValue the new zoom value. - */ - void setZoomValue(double zoomValue); - -Q_SIGNALS: - /** - * A QT-Signal which is emitted whenever the slider's value has changed. - * The newly set zoom value is delivered as argument. - */ - void valueChanged(double a_value); - - -private Q_SLOTS: - /** - * Update the label text - */ - void updateLabel(double newValue); -private: - - /** - * Contains the slider's minimum zoom value - */ - const double m_InternalMin; - /** - * Contains the slider's maximum zoom value - */ - const double m_InternalMax; - /** - * Contains the slider's lower threshold value. - * The lower threshold is at 50% of the sliders range. - */ - const int m_LowerThreshold; - /** - * Contains the slider's upper threshold value. - * The upper threshold is at 75% of the sliders range. - */ - const int m_UpperThreshold; - /** - * Contains the slider's range minimum value - */ - const int m_MinRange; - /** - * Contains the slider's range maximum value - */ - const int m_MaxRange; - - /** - * The QSlider - */ - QSlider *m_Slider; - - /** - * The label for showing the exact slider value. - */ - QLabel *m_lbl; - - /** - * The label for showing the 'zoom' text - */ - QLabel *m_text; - - /** - * contains the zoom value - */ - double m_ZoomValue; - - /** - * The current value of the slider to avoid loops - */ - int m_curSliderVal; - -private slots : - /** - * Calculates the zoom value from the slider's position - */ - void calcZoomFromSlider(int a_value); - -}; -} // namespace THP diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/CMakeLists.txt b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/CMakeLists.txt deleted file mode 100755 index 1fa8960f3..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/CMakeLists.txt +++ /dev/null @@ -1,91 +0,0 @@ -# -# $Id$ -# $HeadURL$ -# $Author$ -# -# Created by Mike Wille, SLSE, 2016-03-17 -# - -# Make ${Qt6_Widgets} optional -if(QT6_GUI_AVAILABLE AND TARGET Qt6::Widgets) - set(Qt6_Widgets ${Qt6_Widgets}) -else() - set(Qt6_Widgets "") -endif() - - -SET(pre_script_gui_SRCS - pre_script_gui_plugin.cpp - pre_script_gui_plugin.h - pre_script_dialog.h - pre_script_dialog.cpp - pre_storyboard.cpp - pre_storyboard.h - pre_journal_types.h - pre_journal_types.cpp - pre_journal_dialog.h - pre_journal_dialog.cpp - pre_screen.h - pre_screen.cpp - filter_topic.h - filter_topic.cpp -) - -QT5_WRAP_UI(pre_script_gui_SRCS - pre_storyboard.ui - pre_script_dialog.ui - pre_journal_dialog.ui -) - -NGL_ADD_LIBRARY(WS PreScriptGuiPlugin MODULE ${pre_script_gui_SRCS}) -if(QT6_GUI_AVAILABLE) - NGL_TARGET_LINK_LIBRARIES(PreScriptGuiPlugin - NGLLogger - LtsSession - PreDataPluginInterface - PrePresentationGuiPluginInterface - PreGuiCommon - PreGuiScriptCommon - svcPreCommon - ${Qt6_Widgets} - LtsWidgets - LtsDataView - LtsUtilsGuiDds - LtsSessionData - ProjectConfig - LtsScriptTimeline - LtsMultiMonitor - - LtsAppManager # start replay app - LtsSessionData # set partition preset for replay app - TopicEditorInterface - TopicEditorBase - LtsPluginManager # manipulate apps - - # for Topics - EvlGuiPluginInterface - - - SrmDataPluginInterface # start playback - LtsPrinting - SituationMapGuiPluginInterface - - # Script Player Controls: - SrpGuiPluginInterface - - # file topic - FlmExplorerGuiPluginInterface - # building topic - BdvViewerGuiPluginInterface - # report topic - RepGuiPluginInterface - LtsReportDisplay - MrkCommon # for ApplyFilter @ SitmapFilter - LtsUtilsSettings - ngltools # DTG - situationMap # set time string on map - ExportBdvTopicSetting - ) -endif() - -NGL_INSTALL_TARGET(PreScriptGuiPlugin) diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/filter_topic.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/filter_topic.cpp deleted file mode 100755 index 435a8493d..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/filter_topic.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include "filter_topic.h" - - -namespace PresentationManagement -{ -FilterTopic::~FilterTopic() -{ - -} - - -FilterTopic::FilterTopic(const FilterTopic &other) -{ - mainTopicId = other.mainTopicId; - filterTopic = other.filterTopic; -} -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/filter_topic.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/filter_topic.h deleted file mode 100755 index 5f807ba81..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/filter_topic.h +++ /dev/null @@ -1,28 +0,0 @@ -#pragma once - -#include - - -namespace PresentationManagement -{ -class FilterTopic -{ -public: - FilterTopic() - : mainTopicId(-1) - , filterTopic(nullptr) - {} - - FilterTopic(int _mainTopicId, LtsScriptTimeline::TrackEntry *_filterTopic) - : mainTopicId(_mainTopicId) - , filterTopic(_filterTopic) - {} - - FilterTopic(const FilterTopic &other); - - ~FilterTopic(); - - int mainTopicId; - LtsScriptTimeline::TrackEntry *filterTopic; -}; -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_journal_dialog.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_journal_dialog.cpp deleted file mode 100755 index b9bbb8e1b..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_journal_dialog.cpp +++ /dev/null @@ -1,82 +0,0 @@ -#include "pre_journal_dialog.h" -#include -#include "ui_pre_journal_dialog.h" - -#include - - -namespace PresentationManagement -{ - -JournalDialog::JournalDialog(LtsSession::LtsSession *session, QWidget *parent) - : LtsWidgets::LtsDialog(parent) - , m_ui(new Ui::JournalDialog) - , m_journal(nullptr) - , m_session(session) -{ - m_ui->setupUi(this); - - m_buttonBox->connectButton(LtsWidgets::DialogButton::Print, this, &JournalDialog::slotPrint); -} - - -JournalDialog::~JournalDialog() -{ - delete m_ui; -} - - -void JournalDialog::slotPrint() -{ - LtsPrinting::printView(m_session, this, m_ui->listWidget); -} - - -bool JournalDialog::init(MainJournal *journal) -{ - m_journal = journal; - - return true; -} - - -void JournalDialog::retranslate() -{ - translate(m_ui, tr("Script Journal")); - fillJournal(); -} - - -void JournalDialog::fillJournal() -{ - m_ui->listWidget->clear(); - - if (!m_journal) - return; - - m_ui->listWidget->addItem(m_journal->getText()); - for (const Journal *j : std::as_const(m_journal->journalList)) - m_ui->listWidget->addItem(j->getText()); -} - -} - - - - - - - - - - - - - - - - - - - - diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_journal_dialog.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_journal_dialog.h deleted file mode 100755 index c4aaf620f..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_journal_dialog.h +++ /dev/null @@ -1,37 +0,0 @@ -#pragma once - -#include "pre_journal_types.h" - -#include -#include - - -namespace Ui -{ -class JournalDialog; -} - -namespace PresentationManagement -{ - -class JournalDialog : public LtsWidgets::LtsDialog -{ - Q_OBJECT -public: - explicit JournalDialog(LtsSession::LtsSession *session, QWidget *parent); - ~JournalDialog(); - bool init(MainJournal *journal); - void retranslate() override final; - -private slots: - void slotPrint(); - -private: - void fillJournal(); - - Ui::JournalDialog *m_ui; - MainJournal *m_journal; - LtsSession::LtsSession *m_session; -}; - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_journal_dialog.ui b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_journal_dialog.ui deleted file mode 100755 index 07ae0fb45..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_journal_dialog.ui +++ /dev/null @@ -1,49 +0,0 @@ - - - JournalDialog - - - - 0 - 0 - 707 - 464 - - - - - 0 - 0 - - - - Script Editor - - - - 9 - - - 9 - - - 9 - - - 9 - - - 9 - - - - - true - - - - - - - - diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_journal_types.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_journal_types.cpp deleted file mode 100755 index 58a41d44e..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_journal_types.cpp +++ /dev/null @@ -1,90 +0,0 @@ -#include "pre_journal_types.h" - -#include -#include - - -namespace PresentationManagement -{ - -QString ttt(qint64 msecsSinceEpoch) -{ - return DTG::toStringMSec(msecsSinceEpoch); -} - - -QString pttt(int presentationTime) -{ - return QTime::fromMSecsSinceStartOfDay(presentationTime * 1000).toString(); -} - - -Journal::Journal() - : m_started(QDateTime::currentMSecsSinceEpoch()) -{} - - -QString Journal::started() const -{ - return ttt(m_started); -} - - -MainJournal::~MainJournal() -{ - qDeleteAll(journalList); -} - - -QString MainJournal::getText() const -{ - return Journal::tr("Script Player started on %1").arg(ttt(started)); -} - - -NextTopicJournal::NextTopicJournal(int presentationTime, bool isFilter, const QString &topicTypeName, int length) - : Journal() - , m_isFilter(isFilter) - , m_topicTypeName(topicTypeName) - , m_length(length) - , m_presentationTime(presentationTime) -{} - - -QString NextTopicJournal::getText() const -{ - return Journal::tr("%1 '%2' started at %3 for %4 seconds on %5").arg(m_isFilter ? tr("FilterTopic") : tr("Topic"), - m_topicTypeName, pttt(m_presentationTime)).arg(m_length).arg(started()); -} - - -QString PlayJournal::getText() const -{ - return Journal::tr("Started / resumed script at %1 on %2").arg(pttt(m_presentationTime), started()); -} - - -QString PauseJournal::getText() const -{ - return Journal::tr("Paused script at %1 on %2").arg(pttt(m_presentationTime), started()); -} - - -QString EndedJournal::getText() const -{ - return Journal::tr("Script ended at %1 on %2").arg(pttt(m_presentationTime), started()); -} - - -QString StopJournal::getText() const -{ - return Journal::tr("Script stopped at %1 on %2").arg(pttt(m_presentationTime), started()); -} - - -QString SetTimeJournal::getText() const -{ - return Journal::tr("Position time set to %1 on %2").arg(pttt(m_toPresentationTime), started()); -} - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_journal_types.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_journal_types.h deleted file mode 100755 index a1868dd6c..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_journal_types.h +++ /dev/null @@ -1,131 +0,0 @@ -#pragma once - -#include -#include - - -namespace PresentationManagement -{ - -class Journal -{ - Q_DECLARE_TR_FUNCTIONS(Journal) - -public: - Journal(); - virtual ~Journal() = default; - QString started() const; - virtual QString getText() const = 0; - qint64 m_started; -}; - - -class MainJournal -{ -public: - ~MainJournal(); - QString getText() const; - - qint64 started = 0; - QVector journalList; -}; - - -class NextTopicJournal : public Journal -{ -public: - NextTopicJournal(int presentationTime, bool isFilter, const QString &topicTypeName, int length); - QString getText() const override final; - - bool m_isFilter; - - QString m_topicTypeName; - int m_length; - int m_presentationTime; -}; - - -class PlayJournal : public Journal -{ -public: - explicit PlayJournal(int presentationTime) - : Journal() - , m_presentationTime(presentationTime) - {} - - QString getText() const override final; - - int m_presentationTime; -}; - - -class PauseJournal : public Journal -{ -public: - explicit PauseJournal(int presentationTime) - : Journal() - , m_presentationTime(presentationTime) - {} - - QString getText() const override final; - - int m_presentationTime; -}; - - -class EndedJournal : public Journal -{ -public: - explicit EndedJournal(int presentationTime) - : Journal() - , m_presentationTime(presentationTime) - {} - - QString getText() const override final; - - int m_presentationTime; -}; - - -class StopJournal : public Journal -{ -public: - explicit StopJournal(int presentationTime) - : Journal() - , m_presentationTime(presentationTime) - {} - - QString getText() const override final; - - int m_presentationTime; -}; - - -class SetTimeJournal : public Journal -{ -public: - explicit SetTimeJournal(int toPresentationTime) - : Journal() - , m_toPresentationTime(toPresentationTime) - {} - - QString getText() const override final; - - int m_toPresentationTime; -}; - -} - - - - - - - - - - - - - - diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_screen.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_screen.cpp deleted file mode 100755 index 2f8ade837..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_screen.cpp +++ /dev/null @@ -1,35 +0,0 @@ -#include "pre_screen.h" - -#include -#include - - -Screen::Screen() - : QWidget() -{ - setBgColor(QColor("black")); - setContentsMargins(0, 0, 0, 0); -} - - -Screen::~Screen() -{ - const auto p1Widgets = findChildren(QString(), Qt::FindDirectChildrenOnly); - for (QWidget *w : p1Widgets) - w->setParent(nullptr); -} - - -void Screen::setBgColor(const QColor &color) -{ - setStyleSheet(QStringLiteral("Screen { background: %1; background-color: %1; }").arg(color.name())); -} - - -void Screen::paintEvent(QPaintEvent *) -{ - QStyleOption opt; - opt.init(this); - QPainter p(this); - style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_screen.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_screen.h deleted file mode 100755 index 83fe5e51f..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_screen.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include - - -class Screen : public QWidget -{ - Q_OBJECT - -public: - Screen(); - virtual ~Screen(); - - void setBgColor(const QColor &color); - -private: - void paintEvent(QPaintEvent *) override; -}; diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_script_dialog.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_script_dialog.cpp deleted file mode 100755 index e1d2e39a4..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_script_dialog.cpp +++ /dev/null @@ -1,3351 +0,0 @@ - - - - - - -#include "pre_script_dialog.h" -#include -#include "ui_pre_script_dialog.h" -#include "pre_journal_dialog.h" -#include "pre_screen.h" -#include "pre_storyboard.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#include -#include - - -#include -#include -#include - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -using namespace LtsScriptTimeline; - - -namespace PresentationManagement -{ -class BoolHelper -{ -public: - BoolHelper(bool *myBool) - : m_myBool(myBool) - { - if (m_myBool) - *m_myBool = true; - } - - ~BoolHelper() - { - if (m_myBool) - *m_myBool = false; - } - -private: - bool *m_myBool; -}; - -ScriptDialog::ScriptDialog(const QString &menuGroup, QWidget *parent) - : LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::OkApplyCancel, false ) - , m_ui(new Ui::ScriptDialog) - , m_essentialsViewSession(nullptr) - , m_menuGroup(menuGroup) - , m_requestHelper(nullptr) - , m_selectedTeId(-1) - , m_currentTopicEditor(nullptr) - , m_scriptId(0) - , m_essentialsViewApp(nullptr) - , m_exportProcess(nullptr) - , m_exerciseSession(nullptr) - , m_replaySession(nullptr) - , m_presentationTimer(new QTimer(this)) - , m_lowestTime(-1) - , m_highestTime(-1) - , m_positionTime(-1) - , m_duration(-1) - , m_nextPauseTime(-1) - , m_projectionWidget1(nullptr) - , m_projectionWidget2(nullptr) - , m_scriptsExerciseId(0) - , m_exerciseName(QString()) - , m_sitMapApp(nullptr) - , m_sitMapSession(nullptr) - , m_currentlyFreestandingTopicsScreen1(false) - , m_currentlyFreestandingTopicsScreen2(false) - , m_sitMapTopicIfc(nullptr) - , m_firstPlayAfterStop(true) - , m_enableApply(true) - , m_stopAfterPlayingFilterTopic(false) - , m_previousParentForScreen1(nullptr) - , m_previousParentForScreen2(nullptr) - , m_ignoreTopicForReplay(-1) - , m_currentTopicDesigner(nullptr) - , m_avsVisibilityHackActive(false) - , m_ignoreChanges(false) - , m_scriptRunning(false) - , m_bTimerTickRecursionGuard(false) - , m_isPlayTopicMethodStillRunning(false) -{ - m_ui->setupUi(this); - - connect(m_ui->widget, &ScriptTimeline::signalSave, - this, [this]() - { - QPushButton *b = m_buttonBox->getButton(LtsWidgets::DialogButton::Apply); - if (b->isEnabled()) - b->click(); - else - QApplication::beep(); - }); - - - m_buttonBox->connectButton(LtsWidgets::DialogButton::Export, this, &ScriptDialog::slotShowStoryboard); - m_buttonBox->connectButton(LtsWidgets::DialogButton::Import, this, &ScriptDialog::slotShowJournal); - m_buttonBox->connectButton(LtsWidgets::DialogButton::Hide, this, &ScriptDialog::slotDiscard); - m_buttonBox->connectButton(LtsWidgets::DialogButton::Load, this, &ScriptDialog::slotStartEssentialsView); - m_buttonBox->connectButton(LtsWidgets::DialogButton::Edit, this, &ScriptDialog::slotEditSelectedEntry); - m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Edit, false); - m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Hide, false); - -#ifdef LTS_DEBUG - m_buttonBox->connectButton(LtsWidgets::DialogButton::Show, this, &ScriptDialog::slotAddFakeLegacyPlanTopic); -#endif - - setOnlineHelpFilename(QStringLiteral("Script_Editor-Application")); - - connect(m_ui->widget, &ScriptTimeline::signalTrackEntrySelectionChanged, - this, &ScriptDialog::slotTrackEntrySelectionChanged); - - connect(m_ui->widget, &ScriptTimeline::signalTrackEntryDeleted, - this, &ScriptDialog::slotTrackEntryDeleted); - - connect(m_ui->widget, &ScriptTimeline::signalEditEntry, - this, &ScriptDialog::slotEditEntry); - - connect(m_ui->widget, &ScriptTimeline::signalTrackEntryAdded, - this, [this]() - { - fillTopicVector(); - }); - - connect(m_ui->pbPlay, &QPushButton::clicked, - this, &ScriptDialog::slotPlay); - - connect(m_ui->pbPause, &QPushButton::clicked, - this, &ScriptDialog::slotPause); - - connect(m_ui->pbStop, &QPushButton::clicked, - this, &ScriptDialog::slotStop); - - connect(m_ui->posSlider, &QSlider::sliderMoved, - this, [this]() - { - setPositionTime(m_ui->posSlider->value(), true); - }); - - connect(m_ui->widget, &ScriptTimeline::signalHeaderIndicatorTimeUserChanged, - this, [this](int time) - { - setPositionTime(time, true); - }); - - connect(m_ui->widget, &ScriptTimeline::signalChangesMade, - this, &ScriptDialog::slotChangesWereMade); - - - m_ui->replayControls->setChecked(false); - m_ui->replayControlsWidget->setVisible(false); - - connect(m_ui->replayControls, &QGroupBox::toggled, - this, [this](bool toggled) - { - m_ui->replayControlsWidget->setVisible(toggled); - }); - - m_ui->lblPos->setText(toReadableTime(0)); -} - - -ScriptDialog::~ScriptDialog() -{ - LtsSessionData::LtsSessionData::getInstance()->setScriptIdPreset(-1); - - deleteProjectionWidget(&m_projectionWidget1); - deleteProjectionWidget(&m_projectionWidget2); - - - for (const FilterTopic &ft : std::as_const(m_filterTopicVector)) - delete ft.filterTopic; - - delete m_sitMapTopicIfc; - - for (const TopicAssignment &ta : std::as_const(m_trackEntryAssignments)) - ta.m_topicEditorIfc->finishTopicEditor(); - - if (m_essentialsViewApp != nullptr) - m_essentialsViewApp->deleteLater(); - - if (m_sitMapApp != nullptr) - m_sitMapApp->deleteLater(); - - if (m_replaySession != nullptr) -#ifdef MIKE_CODE - m_replaySession->slotClose(); -#else - emit m_replaySession->signalClose(); -#endif - - delete m_ui; -} - - -void ScriptDialog::aboutToClose() -{ - stop(false, true ); -} - - -void ScriptDialog::retranslate() -{ - translate(m_ui, tr("Script Editor")); - - m_buttonBox->setText(LtsWidgets::DialogButton::Export, tr("Show Storyboard")); - m_buttonBox->setText(LtsWidgets::DialogButton::Import, tr("Show Journal")); - m_buttonBox->setText(LtsWidgets::DialogButton::Hide, tr("Discard")); - m_buttonBox->setText(LtsWidgets::DialogButton::Load, tr("Show Essentials View")); - m_buttonBox->setText(LtsWidgets::DialogButton::Apply, tr("Save")); -} - - -void ScriptDialog::slotChangesMade() -{ - m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Hide, true); - LtsWidgets::LtsDialog::slotChangesMade(); -} - - -void ScriptDialog::slotEditSelectedEntry() -{ - if (m_selectedTeId != -1) - slotEditEntry(m_selectedTeId); -} - - -bool ScriptDialog::importTrackEntries(const QVector &tes) -{ - if (m_scriptRunning) - { - new LtsWidgets::LtsMessageDialogNew(this, tr("Stop replay first.")); - return false; - } - - return m_ui->widget->importTrackEntries(tes); -} - - -void ScriptDialog::slotTrackEntryDeleted(const int topicId) -{ - if (m_selectedTeId == topicId) - m_selectedTeId = -1; - - if (m_currentTopicEditor != nullptr && m_currentTopicEditor->topicId() == topicId) - { - ERROR_LOG(m_logger) << "slotTrackEntryDeleted" << topicId << "editor" << m_currentTopicEditor->topicId(); - m_currentTopicEditor->deleteLater(); - m_currentTopicEditor = nullptr; - } - - fillTopicVector(); -} - - -void ScriptDialog::slotEditEntry(const int topicId) -{ - if (m_currentTopicEditor != nullptr) - m_currentTopicEditor->deleteLater(); - - - QVector tes = m_ui->widget->getTrackEntriesWithFiltersAsEntries(); - - for (TrackEntry *te : std::as_const(tes)) - { - - if (te->m_topicId == topicId) - { - m_currentTopicEditor = createTopicEditor(te); - - if (!m_currentTopicEditor) - { - - return; - } - - addDialog(m_currentTopicEditor, m_menuGroup, QStringLiteral("EditTopic.%1.%2").arg(te->m_topicId).arg((int)te->m_type), - LtsWidgets::LayoutArea::eDialogTab, - true, true ); - - return; - } - } - - ERROR_LOG(m_logger) << "could not find coresponding track entry with id " << topicId; -} - - -void ScriptDialog::slotAddFakeLegacyPlanTopic() -{ - TrackEntry *te = new TrackEntry(m_ui->widget->nextUniqueId(), 0, 30, TrackEntryType::TacticalPlan, QJsonObject({{QStringLiteral("FileId"), 1002}}), QStringLiteral("Screen 1"), QString()); - TrackEntryPreviewWidget *w = new TrackEntryPreviewWidget; - - w->setTopicEnabled(true); - w->setTrackEntry(te); - - layout()->addWidget(w); -} - - -void ScriptDialog::startEssentialsViewStage2(const Core::ReplayPartition &replay) -{ - m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Load, false); - - m_exerciseSession->baseLayout()->setIrreplaceableOnce(); - - bool oldFlagValue = LtsSessionData::LtsSessionData::getInstance()->debugFlagValue(QStringLiteral("DoNotCreateInstant.ReplayControl")).toBool(); - LtsSessionData::LtsSessionData::getInstance()->setDebugFlagValue(QStringLiteral("DoNotCreateInstant.ReplayControl"), true); - LtsSession::DdsConnectionParams params(replay); - m_essentialsViewApp = LtsAppManager::LtsAppManager::getInstance()->createApp(LtsAppDescriptor::App::ScriptEditorEssentialsView, - params); - - if (m_essentialsViewApp == nullptr) - { - LtsSessionData::LtsSessionData::getInstance()->setDebugFlagValue(QStringLiteral("DoNotCreateInstant.ReplayControl"), oldFlagValue); - LtsWidgets::LtsMessageDialog::showMessage(this, tr("Essentials View app could not be started")); - m_exerciseSession->baseLayout()->irreplaceableReset(); - return; - } - - connect(m_essentialsViewApp, &LtsPluginManager::LtsPluginManager::destroyed, - this, [this, params]() - { - if (static_cast(m_essentialsViewApp) == sender()) - { - - - - - - m_essentialsViewApp = nullptr; - m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Load, true); - } - }); - - connect(m_essentialsViewApp, &LtsPluginManager::LtsPluginManager::signalInitializationFinished, - this, [this, params]() - { - disconnect(m_essentialsViewApp, &LtsPluginManager::LtsPluginManager::signalInitializationFinished, - this, nullptr); - - m_essentialsViewSession = m_essentialsViewApp->getSession(params.partitionType, params.partitionId); - - if (m_essentialsViewSession == nullptr) - { - WARNING_LOG(m_logger) << "no session for m_essentialsViewSession"; - LtsWidgets::LtsMessageDialog::showMessage(this, tr("Essentials View was not properly initialized"), tr("Essentials View Session")); - m_essentialsViewApp->deleteLater(); - m_essentialsViewApp = nullptr; - m_exerciseSession->baseLayout()->irreplaceableReset(); - return; - } - - - { - - std::shared_ptr essentialsFltIfc; - - if (m_essentialsViewSession->getForeignGuiInterface(essentialsFltIfc)) - { - std::shared_ptr sitMapFilterIfc; - - if (m_exerciseSession->getForeignGuiInterface(sitMapFilterIfc)) - { - MarkerManagement::MarkerManagementApplyFilter *applyFilterPtr = new MarkerManagement::MarkerManagementApplyFilter(m_essentialsViewSession, essentialsFltIfc); - QPointer applyFilter(applyFilterPtr); - connect(m_exerciseSession, &LtsSession::LtsSession::destroyed, applyFilterPtr, [applyFilter]() { delete applyFilter; }); - connect(m_essentialsViewSession, &LtsSession::LtsSession::destroyed, applyFilterPtr, [applyFilter]() { delete applyFilter; }); - - sitMapFilterIfc->setApplyFilter(applyFilter); - DEBUG_LOG(m_logger) << "set filter topic editor's flt ifc to essentials view's flt ifc"; - } - else - WARNING_LOG(m_logger) << "cannot set filter topic editor's flt ifc to essentials view's flt ifc - cannot find topic editor"; - } - else - WARNING_LOG(m_logger) << "cannot set filter topic editor's flt ifc to essentials view's flt ifc - cannot find essentials view's flt ifc"; - } - - - { - - - std::shared_ptr sitMapGuiIfc; - if (m_essentialsViewSession->getForeignGuiInterface(sitMapGuiIfc)) - { - std::shared_ptr sitMapFilterGuiIfc; - if (m_exerciseSession->getForeignGuiInterface(sitMapFilterGuiIfc)) - { - sitMapFilterGuiIfc->setSitMapGuiIfc(sitMapGuiIfc.get()); - connect(m_essentialsViewSession, &LtsSession::LtsSession::destroyed, this, [sitMapFilterGuiIfc]() - { - sitMapFilterGuiIfc->setSitMapGuiIfc(nullptr); - }); - - DEBUG_LOG(m_logger) << "set sit map filter gui ifc's sit map gui ifc to essential view's sit map gui ifc"; - } - else - WARNING_LOG(m_logger) << "unable to initialize situation map filter gui plugin - sit map filter gui ifc"; - } - else - WARNING_LOG(m_logger) << "unable to initialize situation map filter gui plugin - sit map gui ifc missing!"; - } - - - - - if (m_essentialsViewSession->getForeignGuiInterface(m_essentialsViewsSrpGuiIfc)) - { - std::shared_ptr thisSrpGuiIfc; - if (m_exerciseSession->getForeignGuiInterface(thisSrpGuiIfc)) - { - thisSrpGuiIfc->setSrpIfc(m_essentialsViewsSrpGuiIfc.get()); - connect(m_essentialsViewSession, &LtsSession::LtsSession::destroyed, this, [thisSrpGuiIfc]() { thisSrpGuiIfc->setSrpIfc(nullptr); }); - connect(m_essentialsViewSession, &LtsSession::LtsSession::signalClose, this, [this]() { m_essentialsViewsSrpGuiIfc = nullptr; }); - DEBUG_LOG(m_logger) << "set srp gui ifc's srp gui ifc to essential view's srp gui ifc"; - } - else - WARNING_LOG(m_logger) << "unable to initialize srp gui plugin - this srp gui ifc missing!"; - } - else - WARNING_LOG(m_logger) << "unable to initialize srp gui plugin - essentials view's srp gui ifc missing!"; - - - - std::shared_ptr thisPlanOverlayGuiIfc; - if (m_exerciseSession->getForeignGuiInterface(thisPlanOverlayGuiIfc)) - { - std::shared_ptr essentialsViewPlanOverlaysGuiIfc; - if (m_essentialsViewSession->getForeignGuiInterface(essentialsViewPlanOverlaysGuiIfc)) - { - thisPlanOverlayGuiIfc->setForeignPlanOverlaysGuiIfc(essentialsViewPlanOverlaysGuiIfc.get()); - connect(m_essentialsViewSession, &LtsSession::LtsSession::destroyed, this, [thisPlanOverlayGuiIfc]() { thisPlanOverlayGuiIfc->setForeignPlanOverlaysGuiIfc(nullptr); }); - WARNING_LOG(m_logger) << "set this plan overlay's own gui ifc to essential view's plan overlays gui ifc"; - } - else - WARNING_LOG(m_logger) << "unable to initialize plan overlays gui plugin - essential view's plan overlays gui ifc missing!"; - - - std::shared_ptr essentialsViewSitMapGuiIfc; - if (m_essentialsViewSession->getForeignGuiInterface(essentialsViewSitMapGuiIfc)) - { - thisPlanOverlayGuiIfc->setForeignSitMapGuiIfc(essentialsViewSitMapGuiIfc.get()); - connect(m_essentialsViewSession, &LtsSession::LtsSession::destroyed, this, [thisPlanOverlayGuiIfc]() { thisPlanOverlayGuiIfc->setForeignSitMapGuiIfc(nullptr); }); - DEBUG_LOG(m_logger) << "set this plan overlay's sitMap gui ifc to essential view's sitMap gui ifc"; - } - else - WARNING_LOG(m_logger) << "unable to initialize sitMap gui plugin - essential view's sitMap gui ifc missing!"; - } - else - WARNING_LOG(m_logger) << "unable to initialize plan overlay gui plugin - this plan overlay gui ifc missing!"; - - - - std::shared_ptr bgvIfc; - if (m_essentialsViewSession->getForeignGuiInterface(bgvIfc)) - { - bgvIfc->initTopicEditor(); - DEBUG_LOG(m_logger) << "set bgv gui ifc's session"; - } - else - WARNING_LOG(m_logger) << "unable to set bgv gui ifc's session - essentials view's bgv ifc missing!"; - }); -} - - -void ScriptDialog::slotStartEssentialsView() -{ - if (!m_exerciseSession) - return; - - const int exerciseId = m_exerciseSession->exerciseId(); - - - m_requestHelper = new LtsUtils::RequestHelper(this); - - if (!m_requestHelper->startSingleRequest([this, exerciseId]() -{ - return m_srmForeign->replayPartitionCreateRequest(exerciseId, - LtsSessionData::LtsSessionData::getInstance()->getWorkstationId(), - LtsSessionData::LtsSessionData::getInstance()->getOperatorId(), - Core::ReplayType_def::SituationData, - this); - })) - { - LtsWidgets::LtsMessageDialog::showMessage(this, tr("Cannot start Essentials View because replay partition could not be created")); - return; - } - - int replayId = m_requestHelper->getRepliedId(); - - - m_requestHelper->deleteLater(); - m_requestHelper = nullptr; - - - LtsWidgets::LtsGlobalWaitDialog::getInstance()->wait(tr("Starting essentials view ..")); - QTimer *t = new QTimer(this); - t->setInterval(250); - t->setProperty("tries", 0); - connect(t, &QTimer::timeout, - this, [this, replayId, t]() - { - int tries = t->property("tries").toInt(); - INFO_LOG(m_logger) << "try # " << tries; - - Core::ReplayPartition replay = m_coreDtc->replayPartition(replayId); - - if (replay.id() > 0) - { - LtsWidgets::LtsGlobalWaitDialog::getInstance()->done(); - startEssentialsViewStage2(replay); - t->stop(); - return; - } - - if (tries > 30) - { - LtsWidgets::LtsGlobalWaitDialog::getInstance()->done(); - LtsWidgets::LtsMessageDialog::showMessage(this, tr("Cannot start Essentials View because Replay Partition timed out")); - t->stop(); - return; - } - - t->setProperty("tries", ++tries); - }); - t->start(); -} - - -void ScriptDialog::slotDiscard() -{ - if (LtsWidgets::LtsMessageDialog::showMessage(this, tr("Are you sure you want to discard all unsaved changes?"), tr("Discard unsaved changes?"), - LtsWidgets::Behaviour::Modal, LtsWidgets::Button::Discard | LtsWidgets::Button::Cancel) - == LtsWidgets::Button::Discard) - { - getPresentationContent(); - __unchange__(); - m_ui->widget->setReadonly(false); - m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Hide, false); - } -} - - -bool ScriptDialog::topicTypeOnEssentialsView(TrackEntryType tet) const -{ - switch (tet) - { - case TrackEntryType::Building: - return true; - - default: - break; - } - - return false; -} - - -void ScriptDialog::previewSecond(int time, int ignoreTopicForReplay) -{ - if (!m_enableApply) - { - new LtsWidgets::LtsMessageDialogNew(this, tr("Stop replay first.")); - return; - } - - m_positionTime = time; - m_stopAfterPlayingFilterTopic = true; - m_ignoreTopicForReplay = ignoreTopicForReplay; - - slotPlay(); -} - - -void ScriptDialog::slotSetTopicPosition(QWidget *previewWidget, int ignoreTopicForReplay) -{ - TopicEditorBase::TopicEditor *topicEditor = qobject_cast(sender()); - - if (topicEditor == nullptr) - { - - return; - } - - TrackEntry *te = topicEditor->trackEntry(); - - if (te == nullptr) - { - - return; - } - - int topicId = te->m_topicId; - - - TrackEntry *thaRealTe = m_ui->widget->getTrackEntry(topicId); - int previewTime = -1; - - if (thaRealTe == nullptr) - { - - - thaRealTe = m_ui->widget->getTrackEntryWithFiltersAsEntries(topicId); - - if (thaRealTe == nullptr) - { - ERROR_LOG(m_logger) << "te not found: " << topicId; - return; - } - - previewTime = m_ui->widget->getFilterTrackEntryRealTime(thaRealTe); - } - else - previewTime = thaRealTe->m_startTime; - - previewSecond(previewTime, ignoreTopicForReplay); - - - Screen *screen = getProjectionWidget(identifyProjectionWidget(thaRealTe)); - if (screen == nullptr) - return; - - if (m_currentTopicDesigner != nullptr) - m_currentTopicDesigner->deleteLater(); - - TopicDesigner *td = new TopicDesigner(screen, previewWidget); - td->loadTopicList({ thaRealTe }); - td->selectTopic(te->m_topicId); - td->setGeometry(0, 0, screen->width(), screen->height()); - td->show(); - td->setFocus(); - td->raise(); - - previewWidget->update(); - - connect(td, &TopicDesigner::signalChangesMade, - this, &ScriptDialog::slotChangesMade); - - m_currentTopicDesigner = td; - - connect(topicEditor, &TopicEditorBase::TopicEditor::destroyed, - td, &TopicDesigner::deleteLater); -} - - -void ScriptDialog::slotCheckNewTopicLength(int newLength, LtsUtils::Promise *promise) -{ - TopicEditorBase::TopicEditor *topicEditor = qobject_cast(sender()); - - if (topicEditor == nullptr) - { - new LtsWidgets::LtsMessageDialogNew(this, tr("A check has failed...")); - return; - } - - if (m_ui->widget->checkNewLength(topicEditor->trackEntry(), newLength)) - promise->resolve(); - else - promise->reject(); -} - - -TopicEditorBase::TopicEditor *ScriptDialog::createTopicEditor(TrackEntry *te) -{ - for (const TopicAssignment &ta : std::as_const(m_trackEntryAssignments)) - { - if (ta.m_trackEntryType == te->m_type) - { - if (topicTypeOnEssentialsView(te->m_type) && m_essentialsViewApp == nullptr) - { - LtsWidgets::LtsMessageDialog::showMessage(this, - tr("Please start the Essentials View first to work with this topic", "'Hilfsansicht benoetigt'"), - tr("Unable to start topic editor")); - - return nullptr; - } - - TopicEditorBase::TopicEditor *_newTopicEditor = ta.m_topicEditorIfc->createTopicEditor(te); - if (_newTopicEditor == nullptr) - { - LtsWidgets::LtsMessageDialog::showMessage(this, - tr("Cannot add Topic '%1' as there was an error while initializing the Topic").arg(ta.m_topicName), - tr("Unable to create Topic")); - - return nullptr; - } - - LtsWidgets::LtsDialog *newTopicEditor = qobject_cast(_newTopicEditor); - if (!newTopicEditor) - { - LtsWidgets::LtsMessageDialog::showMessage(this, - tr("Cannot add Topic '%1' as it is invalid").arg(ta.m_topicName), - tr("Unable to create Topic Editor")); - - return nullptr; - } - - connect(newTopicEditor, &LtsWidgets::LtsDialog::destroyed, - this, &ScriptDialog::slotNull); - - connect(_newTopicEditor, &TopicEditorBase::TopicEditor::signalTrackEntryModified, - this, &ScriptDialog::slotTrackEntryModified); - - connect(_newTopicEditor, &TopicEditorBase::TopicEditor::signalSetTopicPosition, - this, &ScriptDialog::slotSetTopicPosition); - - connect(_newTopicEditor, &TopicEditorBase::TopicEditor::signalCheckNewTopicLength, - this, &ScriptDialog::slotCheckNewTopicLength); - - TrackEntryPreviewWidget *tepw = _newTopicEditor->trackEntryPreviewWidget(); - - - if (LtsUtils::OperatorSettings::getInstance()->value(QStringLiteral("Scripts"), QStringLiteral("HideOnDrag"), true) == QVariant(true)) - { - connect(tepw, &TrackEntryPreviewWidget::signalStartDrag, - m_exerciseSession->baseLayout(), &LtsWidgets::LtsBaseLayoutWidget::onHideAnimated); - connect(tepw, &TrackEntryPreviewWidget::signalStopDrag, - m_exerciseSession->baseLayout(), &LtsWidgets::LtsBaseLayoutWidget::onReShowAnimated); - } - - _newTopicEditor->updateData(te); - - return _newTopicEditor; - } - } - - return nullptr; -} - - -void ScriptDialog::slotNull(QObject *obj) -{ - if (static_cast(m_currentTopicEditor) == obj) - m_currentTopicEditor = nullptr; -} - - -void ScriptDialog::slotTrackEntryModified() -{ - m_ui->widget->updateEverything(); - slotChangesMade(); -} - - -TopicEditorBase::TopicEditor *ScriptDialog::createTopic(const TopicAssignment &ta) -{ - TrackEntry *te = new TrackEntry(ta.m_trackEntryType); - te->m_startTime = -1; - te->m_length = 30; - te->m_topicId = m_ui->widget->nextUniqueId(); - te->index = te->m_topicId; - - TopicEditorBase::TopicEditor *diag = createTopicEditor(te); - if (diag) - { - connect(diag, &TopicEditorBase::TopicEditor::addNewTopicEditor, this, &ScriptDialog::createTopicFromTrackEntry); - addDialog(diag, m_menuGroup, QString(), LtsWidgets::LayoutArea::eDialogTab); - } - else - delete te; - - return diag; -} - - -TopicEditorBase::TopicEditor *ScriptDialog::createTopic(const LtsScriptTimeline::TrackEntry &data) -{ - TrackEntry *te = new TrackEntry(data.m_type); - te->m_startTime = data.m_startTime; - te->m_length = data.m_length > 0 ? data.m_length : 30; - te->m_detailData = data.m_detailData; - te->m_topicId = m_ui->widget->nextUniqueId(); - te->index = te->m_topicId; - - TopicEditorBase::TopicEditor *diag = createTopicEditor(te); - if (diag) - { - connect(diag, &TopicEditorBase::TopicEditor::addNewTopicEditor, this, &ScriptDialog::createTopicFromTrackEntry); - addDialog(diag, m_menuGroup, QString(), LtsWidgets::LayoutArea::eDialogTab); - } - else - delete te; - - return diag; -} - - -void ScriptDialog::createTopicFromTrackEntry(TrackEntry *data) -{ - TopicEditorBase::TopicEditor *diag = createTopic(*data); - - diag->updateData(data); - -} - - -void ScriptDialog::getPresentationContent() -{ - LtsWidgets::LtsGlobalWaitDialog::getInstance()->setCustomText(tr("Waiting for script content ...")); - setUnchangeable(true); - m_ui->widget->clear(); - prepareScriptTimeline(m_ui->widget, tr("Screen 1"), tr("Screen 2"), tr("Replay"), tr("Audio")); - - - std::function handlePresentationContent = [this](const Core::FunctionReply & baseReply) - { - const GetPresentationContentReply &reply = static_cast(baseReply); - const dds::core::vector &contentList = reply.content(); - - if (contentList.size() < 1) - { - WARNING_LOG(m_logger) << "No content for Script Id = " << m_scriptId; - setUnchangeable(false); - return; - } - - m_ignoreChanges = true; - - int highestId = 0; - - for (const PresentationManagement::PresentationContent &content : contentList) - { - auto tea = m_trackEntryAssignments.constFind(QString::fromStdString(content.presentationTopicType())); - if (tea == m_trackEntryAssignments.constEnd()) - { - ERROR_LOG(m_logger) << "Invalid content for type " << QString::fromStdString(content.presentationTopicType()); - - continue; - } - - const TopicAssignment &ta = *tea; - int topicId = content.id(); - TrackEntry *te = trackEntryFromContent(content, topicId, ta.m_trackEntryType); - - if (topicId > highestId) - highestId = topicId; - - if (!m_ui->widget->addTopic(te)) - { - WARNING_LOG(m_logger) << "couldn't load topic #" << te->m_topicId; - delete te; - } - } - - m_ignoreChanges = false; - - if (m_ui->widget->nextUniqueId() < highestId) - m_ui->widget->setUniqueIdCounter(highestId + 1); - - fillTopicVector(); - setUnchangeable(false); - }; - - - m_requestHelper = new LtsUtils::RequestHelper(this); - - DEBUG_LOG(m_logger) << "waiting for script content.."; - if (!m_requestHelper->startSingleRequest([this]() -{ - return m_ftc->getPresentationContentRequest(GetPresentationContentRequest(m_scriptId), this); - }, handlePresentationContent)) - { - ERROR_LOG(m_logger) << "Cannot retrieve Presentation Content for ScriptId = " << m_scriptId; - - setUnchangeable(false); - } - - - m_requestHelper->deleteLater(); - m_requestHelper = nullptr; -} - - -bool ScriptDialog::tryAddTopics(QStringList &resultList ) -{ - - if (!tryAddTopic - (TrackEntryType::SituationReplay, resultList, SpecialTopicType::ReplayTopic)) - return false; - - if (!tryAddTopic - (TrackEntryType::TacticalPlan, resultList, SpecialTopicType::FilterTopic)) - return false; - - if (!tryAddTopic - (TrackEntryType::SituationMapFilter, resultList, SpecialTopicType::FilterTopic)) - return false; - - if (!tryAddTopic - (TrackEntryType::Snapshot, resultList, SpecialTopicType::ReplayTopic)) - return false; - - - - - if (!tryAddTopic - (TrackEntryType::SituationMap, resultList)) - return false; - - if (!tryAddTopic - (TrackEntryType::Situation, resultList)) - return false; - - - tryAddTopic - (TrackEntryType::Audio, resultList); - - tryAddTopic - (TrackEntryType::Video, resultList); - - - if (!tryAddTopic - (TrackEntryType::Image, resultList)) - return false; - if (!tryAddTopic - (TrackEntryType::Pdf, resultList)) - return false; - if (!tryAddTopic - (TrackEntryType::Text, resultList)) - return false; - - tryAddTopic - (TrackEntryType::Building, resultList); - - - if (!tryAddTopic - (TrackEntryType::Evaluation, resultList)) - return false; - - if (!tryAddTopic - (TrackEntryType::Report, resultList)) - return false; - - return true; -} - - -void ScriptDialog::startReplaySession() -{ - LtsWidgets::LtsGlobalWaitDialog::getInstance()->setCustomText(tr("Starting replay session ...")); - - - const int partitionId = m_exerciseSession->partitionId(); - - auto success = [this]() - { - - int replayId = m_requestHelper->getRepliedId(); - - - m_requestHelper->deleteLater(); - m_requestHelper = nullptr; - - if (replayId < 1) - { - ERROR_LOG(m_logger) << "replayId < 1"; - initFailed(__LINE__); - return; - } - - - - QTimer *t = new QTimer(this); - t->setInterval(1000); - t->setProperty("tries", 0); - connect(t, &QTimer::timeout, - this, [this, t, replayId]() - { - int tries = t->property("tries").toInt(); - - if (tries > 7) - { - t->stop(); - initFailed(__LINE__); - return; - } - - t->setProperty("tries", tries++); - - - LtsWidgets::LtsGlobalWaitDialog::getInstance()->setCustomText(tr("Waiting for replay session ...")); - - - Core::ReplayPartition rp(m_coreDtc->replayPartition(replayId)); - - if (rp.id() == 0) - return; - - - - t->stop(); - - if (rp.id() != replayId) - { - ERROR_LOG(m_logger) << "Script Player: replay ids do not match!!! cannot start app"; - initFailed(__LINE__); - return; - } - - LtsSession::DdsConnectionParams connParams(rp); - m_replaySession = m_exerciseSession->getSessionManager()->createSession(connParams, true, false, true ); - - if (m_replaySession == nullptr) - { - ERROR_LOG(m_logger) << "m_replaySession == nullptr"; - initFailed(__LINE__); - return; - } - - connect(m_replaySession, &LtsSession::LtsSession::destroyed, - this, [this](QObject * obj) - { - if (m_replaySession == static_cast(obj)) - m_replaySession = nullptr; - }); - - connect(m_replaySession, &LtsSession::LtsSession::signalDoneInitializingSession, - this, [this]() - { - disconnect(m_replaySession, &LtsSession::LtsSession::signalDoneInitializingSession, - this, nullptr); - - QStringList resultList; - bool r = tryAddTopics(resultList); - - QString result(resultList.join(QStringLiteral("
- "))); - - if (r && !result.isEmpty()) - WARNING_LOG(m_logger) << "At least one optional widget & control interface failed to load: " << result; - - if (!r) - { - ERROR_LOG(m_logger) << "At least one widget & control interface failed to load: " << result; - initFailed(__LINE__); - return; - } - - loadScript(); - createSitMapApp(); - }); - }); - t->start(); - }; - - - auto failure = [this]() - { - - m_requestHelper->deleteLater(); - m_requestHelper = nullptr; - - ERROR_LOG(m_logger) << "replayPartitionCreateRequest failed"; - initFailed(__LINE__); - }; - - - m_requestHelper = new LtsUtils::RequestHelper(this, true , success, failure); - - m_requestHelper->startSingleBackgroundRequest([this, partitionId]() - { - return m_srmForeign->replayPartitionCreateRequest(partitionId, - LtsSessionData::LtsSessionData::getInstance()->getWorkstationId(), - LtsSessionData::LtsSessionData::getInstance()->getOperatorId(), - Core::ReplayType::SituationData, - this); - }); - - -} - - -void ScriptDialog::initFailed(int reason) -{ - LtsWidgets::LtsGlobalWaitDialog::getInstance()->done(); - connect(new LtsWidgets::LtsMessageDialogNew(this, tr("Scripts app could not be initialized. Reason id: %1").arg(QString::number(reason, 16 )), tr("Initialization failed")), &LtsWidgets::LtsMessageDialogNew::destroyed, - this, [this]() - { -#ifdef MIKE_CODE - m_exerciseSession->slotClose(); -#else - emit m_replaySession->signalClose(); -#endif - }); -} - - -void ScriptDialog::loadScript() -{ - m_scriptsExerciseId = m_scriptId; - m_scriptName = QString::fromStdString(m_dtc->presentation(m_scriptId).name()); - int ownerId = m_dtc->presentation(m_scriptId).operatorId(); - m_scriptOwner = QString::fromStdString(m_opmDtc->user(ownerId).name()); - m_lastModified = m_dtc->presentation(m_scriptId).lastModified(); - m_exerciseName = m_exerciseSession->exerciseData()->exName; - - m_exerciseSession->baseLayout()->setCustomText(tr("Script: %1").arg(m_scriptName)); - - QJsonObject savegame = m_exerciseSession->getSavegame(); - savegame[QStringLiteral("ScriptId")] = m_scriptId; - m_exerciseSession->setSavegame(savegame); - - getPresentationContent(); -} - - -bool ScriptDialog::init(LtsSession::LtsSession *session, - const int scriptId, - const std::shared_ptr &dtc, - const std::shared_ptr &ftc, - const std::shared_ptr &srmForeign, - const std::shared_ptr &coreDtc, - const std::shared_ptr &opmDtc) -{ - LtsWidgets::LtsGlobalWaitDialog::getInstance()->wait(tr("Initializing script ...")); - - m_exerciseSession = session; - m_dtc = dtc; - m_ftc = ftc; - m_srmForeign = srmForeign; - m_coreDtc = coreDtc; - m_scriptId = scriptId; - m_opmDtc = opmDtc; - - startReplaySession(); - - connect(m_presentationTimer, &QTimer::timeout, - this, &ScriptDialog::slotTimerTick); - - m_presentationTimer->setInterval(1024 ); - - - - m_ui->pbInitScr1->setEnabled(true); - connect(m_ui->pbInitScr1, &QPushButton::clicked, - this, [this]() - { - initProjectionWidget(&m_projectionWidget1); - }); - - - m_ui->pbInitScr2->setEnabled(true); - connect(m_ui->pbInitScr2, &QPushButton::clicked, - this, [this]() - { - initProjectionWidget(&m_projectionWidget2); - }); - - m_ui->pbNextTopic->setEnabled(false); - connect(m_ui->pbNextTopic, &QPushButton::clicked, - this, &ScriptDialog::slotToNextTopic); - - m_ui->pbPreviousTopic->setEnabled(false); - connect(m_ui->pbPreviousTopic, &QPushButton::clicked, - this, &ScriptDialog::slotToPreviousTopic); - - connect(m_ui->pbUntilNextTopic, &QPushButton::clicked, - this, &ScriptDialog::slotPlayUntilNextTopic); - - - m_ui->pbPlay->setEnabled(true); - - - QTimer *duration = new QTimer(this); - duration->setInterval(1000); - connect(duration, &QTimer::timeout, - this, [this] - { - m_duration++; - m_ui->lblDuration->setText(toReadableTime(m_duration)); - }); - duration->start(); - - - - - - - m_journal.started = QDateTime::currentMSecsSinceEpoch(); - - - { - LtsWidgets::PluginData data; - data.menuGroup = m_menuGroup; - data.identifier = QLatin1String("PresentationManagement.ScriptDialog.ExportScript"); - data.menuIcon = QIcon(QLatin1String("icon:export_documents.svg")); - data.menuText = tr("Export Script"); - data.operatorRight = OperatorRights::ScriptEditorEdit; - data.directFunc = [this](const LtsWidgets::PluginData &) - { - return slotExportScript(); - }; - data.createWidgetFunc = nullptr; - - m_exerciseSession->addAction(data); - } - - { - LtsWidgets::PluginData data; - data.menuGroup = m_menuGroup; - data.identifier = QLatin1String("PresentationManagement.ScriptDialog.LoadScript"); - data.menuIcon = QIcon(QLatin1String("icon:import_documents.svg")); - data.menuText = tr("Load Script"); - data.operatorRight = OperatorRights::ScriptEditorEdit; - data.directFunc = [this](const LtsWidgets::PluginData &) - { - return slotLoadScript(); - }; - data.createWidgetFunc = nullptr; - - m_exerciseSession->addAction(data); - } - - return true; -} - - -void ScriptDialog::createSitMapApp() -{ - LtsWidgets::LtsGlobalWaitDialog::getInstance()->setCustomText(tr("Starting replay app ...")); - - - - bool oldFlagValue = LtsSessionData::LtsSessionData::getInstance()->debugFlagValue(QStringLiteral("DoNotCreateInstant.ReplayControl")).toBool(); - LtsSessionData::LtsSessionData::getInstance()->setDebugFlagValue(QStringLiteral("DoNotCreateInstant.ReplayControl"), true); - m_sitMapApp = LtsAppManager::LtsAppManager::getInstance()->createApp(LtsAppDescriptor::App::Situation, - m_replaySession->connParams(), QString(), true ); - if (m_sitMapApp == nullptr) - { - LtsSessionData::LtsSessionData::getInstance()->setDebugFlagValue(QStringLiteral("DoNotCreateInstant.ReplayControl"), oldFlagValue); - ERROR_LOG(m_logger) << "createApp returned nullptr for m_sitMapApp"; - initFailed(__LINE__); - return; - } - - if (m_sitMapApp != nullptr) - { - connect(m_sitMapApp, &LtsPluginManager::LtsPluginManager::destroyed, - this, [this](QObject * obj) - { - if (static_cast(m_sitMapApp) == obj) - m_sitMapApp = nullptr; - }); - - connect(m_sitMapApp, &LtsPluginManager::LtsPluginManager::signalInitializationFinished, - this, [this]() - { - LtsWidgets::LtsGlobalWaitDialog::getInstance()->setCustomText(tr("Getting interfaces from replay app ...")); - - disconnect(m_sitMapApp, &LtsPluginManager::LtsPluginManager::signalInitializationFinished, this, nullptr); - - LtsSession::LtsSession *appSession = m_sitMapApp->getSession(m_replaySession->partitionType(), m_replaySession->partitionId()); - - if (appSession != nullptr) - { - - - - m_sitMapSession = appSession; - - m_sitMapSession->baseLayout()->collapseMenu(); - -#ifndef LTS_DEBUG - m_sitMapSession->baseLayout()->setTopBarVisible(false); -#endif - - connect(m_sitMapSession, &LtsSession::LtsSession::destroyed, - this, [this](QObject * obj) - { - if (static_cast(m_sitMapSession) == obj) - m_sitMapSession = nullptr; - }); - - - - - std::shared_ptr sitMapIfc; - if (m_sitMapSession->getForeignGuiInterface(sitMapIfc)) - { - - std::shared_ptr sitMapFilterIfc; - if (m_replaySession->getForeignGuiInterface(sitMapFilterIfc)) - { - SituationMap::ForeignGuiInterface *sitMapIfcPtr = sitMapIfc.get(); - sitMapFilterIfc->setSitMapGuiIfc(sitMapIfcPtr); - } - else - { - ERROR_LOG(m_logger) << "setting SitMapFilterIfc's SitMapPtr to this SitMapIfc failed, because the SitMapFilterIfc could not be found !!"; - initFailed(__LINE__); - return; - } - - - - std::shared_ptr replayControlIfc; - if (m_replaySession->getForeignGuiInterface(replayControlIfc)) - { - SituationMap::ForeignGuiInterface *sitMapIfcPtr = sitMapIfc.get(); - replayControlIfc->setSitMapIfc(sitMapIfcPtr); - } - else - { - ERROR_LOG(m_logger) << "setting ReplayControlIfc's SitMapPtr to this SitMapIfc failed, because the ReplayControlIfc could not be found !!"; - initFailed(__LINE__); - return; - } - } - else - { - ERROR_LOG(m_logger) << "setting SitMapFilterIfc's SitMapPtr to this SitMapIfc failed, because the SitMapIfc could not be found !!"; - initFailed(__LINE__); - return; - } - - - - - - - { - std::shared_ptr fltIfc; - if (m_sitMapSession->getForeignGuiInterface(fltIfc)) - { - MarkerManagement::MarkerManagementApplyFilter *applyFilterPtr = new MarkerManagement::MarkerManagementApplyFilter(m_sitMapSession, fltIfc); - QPointer applyFilter(applyFilterPtr); - connect(m_replaySession, &LtsSession::LtsSession::destroyed, applyFilterPtr, [applyFilter]() { delete applyFilter; }); - connect(m_sitMapSession, &LtsSession::LtsSession::destroyed, applyFilterPtr, [applyFilter]() { delete applyFilter; }); - - - std::shared_ptr sitMapFilterGuiIfc; - if (m_replaySession->getForeignGuiInterface(sitMapFilterGuiIfc)) - { - sitMapFilterGuiIfc->setApplyFilter(applyFilter); - DEBUG_LOG(m_logger) << "set sit map filter ifc's apply filter"; - } - else - WARNING_LOG(m_logger) << "cannot set sit map filter ifc's apply filter - cannot find filter topic's ifc"; - - - std::shared_ptr sitRepIfc; - if (m_replaySession->getForeignGuiInterface(sitRepIfc)) - { - sitRepIfc->setApplyFilter(applyFilter); - DEBUG_LOG(m_logger) << "set sit replay ifc's apply filter"; - } - else - WARNING_LOG(m_logger) << "cannot set sit replay ifc's apply filter - cannot find filter topic's ifc"; - } - else - WARNING_LOG(m_logger) << "cannot set sit map filter ifc's apply filter - cannot find map's flt ifc"; - } - - - - std::shared_ptr planOverlayIfc; - if (m_replaySession->getForeignGuiInterface(planOverlayIfc)) - { - std::shared_ptr sitMapIfc; - if (m_sitMapSession->getForeignGuiInterface(sitMapIfc)) - { - SituationMap::ForeignGuiInterface *sitMapIfcPtr = sitMapIfc.get(); - planOverlayIfc->setForeignSitMapGuiIfc(sitMapIfcPtr); - } - else - { - DEBUG_LOG(m_logger) << "setting planOverlayIfc's SitMapPtr to this SitMapIfc failed, because the SitMapIfc could not be found !!"; - initFailed(__LINE__); - return; - } - } - else - { - DEBUG_LOG(m_logger) << "setting planOverlayIfc's SitMapPtr to this SitMapIfc failed, because the SitMapFilterIfc could not be found !!"; - initFailed(__LINE__); - return; - } - - - - std::shared_ptr thisMrkIfc; - if (m_replaySession->getForeignGuiInterface(thisMrkIfc)) - { - std::shared_ptr sitMapMrkIfc; - if (m_sitMapSession->getForeignGuiInterface(sitMapMrkIfc)) - thisMrkIfc->setScriptsMrkIfc(sitMapMrkIfc.get()); - else - { - DEBUG_LOG(m_logger) << "setting mrkIfc redirection failed - sitMap mrkIfc not found !"; - initFailed(__LINE__); - return; - } - } - else - { - DEBUG_LOG(m_logger) << "setting mrkIfc redirection failed - this mrkIfc not found !"; - initFailed(__LINE__); - return; - } - - - - m_ui->widget->updateEverything(); - LtsWidgets::LtsGlobalWaitDialog::getInstance()->done(); - changelogCheck(); - } - else - { - ERROR_LOG(m_logger) << "could not start situation map app !!"; - initFailed(__LINE__); - return; - } - }); - } - else - { - ERROR_LOG(m_logger) << "Failed to start Situation App!"; - initFailed(__LINE__); - return; - } -} - - -void ScriptDialog::changelogCheck() -{ - - return; - - LtsUtils::OperatorSettings *opSettings = LtsUtils::OperatorSettings::getInstance(); - - bool ok = false; - static QString key(QStringLiteral("ScriptEditor")); - static QString val(QStringLiteral("LastChangeLog")); - int lastChangelog = opSettings->value(key, val).toInt(&ok); - - static int currentChangelog = 2; - if (!ok || lastChangelog < currentChangelog) - { - opSettings->setValue(key, val, currentChangelog); - - - new LtsWidgets::LtsMessageDialogNew(this, tr("New topic available: 'Situation'
" - "You can now have a replay, a map and a map filter inside one single topic,
" - "instead of creating all three topics separately.
" - "
" - "To simplify naming, the 'Situation Map' topic is now the 'Map' topic.
" - "The 'Situation Replay' topic becomes the 'Replay' topic.
" - "For clarification: the 'Map Filter' topic stays the same.")); - } -} - - -void ScriptDialog::slotChangesWereMade() -{ - fillTopicVector(); - slotChangesMade(); - - if (m_currentTopicEditor == nullptr) - return; - - TrackEntry *te = m_ui->widget->getTrackEntryWithFiltersAsEntries(m_currentTopicEditor->topicId()); - - if (te == nullptr) - return; - - m_currentTopicEditor->updateLength(te->m_length); -} - - -bool ScriptDialog::topicStringToType(const QString &typeName, TrackEntryType &tet) const -{ - for (const TopicAssignment &tea : m_trackEntryAssignments) - { - if (tea.m_topicName == typeName) - { - tet = tea.m_trackEntryType; - return true; - } - } - return false; -} - - -int ScriptDialog::getCurrentScriptEndTime() const -{ - return m_ui->widget->getCurrentScriptEndTime(); -} - - -bool ScriptDialog::isEssentialsViewOpened() const -{ - return !m_buttonBox->isButtonEnabled(LtsWidgets::DialogButton::Load); -} - - -TrackEntry *ScriptDialog::trackEntryFromContent(const PresentationManagement::PresentationContent &content, - int topicId, - TrackEntryType trackType) -{ - TrackEntry *te = new TrackEntry; - - te->m_topicId = topicId; - te->m_startTime = content.startTime(); - te->m_length = content.duration(); - te->m_type = trackType; - te->index = content.index(); - - te->x = content.x(); - te->y = content.y(); - te->h = content.height(); - te->w = content.width(); - - te->m_detailData = QJsonDocument::fromJson(QByteArray(content.attributes().c_str(), content.attributes().size())).object(); - te->m_channelName = QString::fromStdString(content.channel()); - te->m_description = QString::fromStdString(content.description()); - - return te; -} - - -bool ScriptDialog::apply() -{ - if (m_scriptRunning) - { - new LtsWidgets::LtsMessageDialogNew(this, tr("Stop replay first.")); - return false; - } - - int32_t opId = LtsSessionData::LtsSessionData::getInstance()->getOperatorId(); - int64_t lastModified = QDateTime::currentMSecsSinceEpoch(); - - PresentationManagement::Presentation p = m_dtc->presentation(m_scriptId); - QString name = QString::fromStdString(p.name()); - QString description = QString::fromStdString(p.description()); - if (p.operatorId() != opId) - { - bool notSave = (LtsWidgets::Button::No == LtsWidgets::LtsMessageDialog::showMessage(this - , tr("Do you want to save a copy of the existing script from another user?
Yes: Copy script and save the changes
No: Cancel and give up changes") - , tr("Copy script") - , LtsWidgets::Behaviour::Modal - , LtsWidgets::Button::Yes | LtsWidgets::Button::No)); - if (notSave) - return false; - else - { - ERROR_LOG(m_logger) << "Creating a copy of script " << m_scriptId; - m_scriptId = 0; - name = tr("Copy of ")+ name; - } - - } - if (p.id() < 1) - { - LtsWidgets::LtsMessageDialog::showMessage(this, tr("Unknown script!")); - return false; - } - - int32_t id = m_scriptId; - - const QMap > trackList = m_ui->widget->getTrackEntriesWithFilters(); - - int size = 0; - - for (const auto &trackEntryList : std::as_const(trackList)) - size += trackEntryList.count(); - - PresentationModifyRequest req; - auto &content = req.content(); - content.resize(size); - - size_t cp = 0; - for (auto i1 = trackList.constBegin(); i1 != trackList.constEnd(); ++i1) - { - const QVector &trackEntryList = *i1; - const QString &trackName = i1.key(); - - for (const TrackEntry *te : trackEntryList) - { - QString typeName = trackEntryTypeName(te->m_type); - if (!typeName.size()) - { - LtsWidgets::LtsMessageDialog::showMessage(this, tr("Unknown topic type!")); - return false; - } - - PresentationManagement::PresentationContent &pc = content.at(cp++); - - pc.id(te->m_topicId); - pc.presentationId(m_scriptId); - pc.presentationTopicType(typeName.toStdString()); - pc.channel(trackName.toStdString()); - pc.startTime(te->m_startTime); - pc.duration(te->m_length); - - - - const QByteArray detailData = QJsonDocument(te->m_detailData).toJson(QJsonDocument::Compact); - pc.attributes(detailData.data()); - pc.description(te->m_description.toStdString()); - pc.x(te->x); - pc.y(te->y); - pc.height(te->h); - pc.width(te->w); - } - } - - req.id(id); - req.name(name.toStdString()); - req.description(description.toStdString()); - req.operatorId(opId); - req.lastModified(lastModified); - req.fileStatus(FileStatus::Valid); - req.content(content); - - - m_requestHelper = new LtsUtils::RequestHelper(this); - - bool result = m_requestHelper->startSingleRequest([req, this]() - { - return m_ftc->presentationModifyRequest(req, this); - }); - - m_scriptId = m_requestHelper->getRepliedId(); - - - m_requestHelper->deleteLater(); - m_requestHelper = nullptr; - - if (result) - m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Import, true); - - fillTopicVector(); - - m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Hide, false); - - return result; -} - - -void ScriptDialog::slotTrackEntrySelectionChanged(TrackEntry *) -{ - QVector selectedTrackEntries(m_ui->widget->getTrackEntries(true)); - selectedTrackEntries += m_ui->widget->getSelectedFilterEntries(); - int count = selectedTrackEntries.count(); - - if (count == 1) - { - TrackEntry *te = selectedTrackEntries.at(0); - int time = te->m_startTime; - - m_ui->widget->setIndicatorTime(time); - m_positionTime = time; - m_selectedTeId = te->m_topicId; - } - else - m_selectedTeId = -1; - - m_buttonBox->getButton(LtsWidgets::DialogButton::Edit)->setEnabled(count == 1); - - return; -} - - -void ScriptDialog::setPositionTime(int positionTime, bool setByUser) -{ - m_positionTime = positionTime; - m_ui->posSlider->setValue(m_positionTime); - m_ui->widget->setIndicatorTime(m_positionTime); - m_ui->lblPos->setText(toReadableTime(m_positionTime)); - - if (setByUser) - { - if (!m_presentationTimer->isActive()) - m_journal.journalList.append(new SetTimeJournal(m_positionTime)); - } - - m_ui->pbPreviousTopic->setEnabled(hasPreviousTopic()); - m_ui->pbNextTopic->setEnabled(hasNextTopic()); -} - - -void ScriptDialog::slotShowJournal() -{ - addDialog(LtsWidgets::initDialog(new JournalDialog(m_exerciseSession, this), &m_journal), - m_menuGroup, QStringLiteral("ScriptPlayer.Journal")); -} - - -void ScriptDialog::setPositionTimeActive(int positionTime, bool setByUser) -{ - setPositionTime(positionTime, setByUser); - - if (!m_presentationTimer->isActive()) - return; - - m_presentationTimer->start(); - slotTimerTick(); -} - - -int ScriptDialog::nextTopicTime() const -{ - const auto &topicMap = m_topicMap; - - auto nextTopicIter = topicMap.upperBound(m_positionTime); - if (nextTopicIter == topicMap.constEnd()) - { - DEBUG_LOG(m_logger) << "There is no next topic!"; - return -1; - } - - return nextTopicIter.key(); -} - - -void ScriptDialog::slotToNextTopic() -{ - int topicTime = nextTopicTime(); - - if (topicTime < 0) - return; - - if (m_presentationTimer->isActive()) - { - topicTime -= 1; - - if (topicTime < 0) - topicTime = 0; - } - - setPositionTimeActive(topicTime); -} - - -void ScriptDialog::slotPlayUntilNextTopic() -{ - if (!m_presentationTimer->isActive()) - slotPlay(); - - int topicTime = nextTopicTime(); - - if (topicTime < 0) - { - DEBUG_LOG(m_logger) << "There is no next topic to play until!"; - return; - } - - m_nextPauseTime = topicTime; -} - - -int ScriptDialog::previousTopicTime() const -{ - if (m_topicMap.isEmpty()) - { - DEBUG_LOG(m_logger) << "There are no topics while checking for previous topic!"; - return -1; - } - - const auto &topicMap = m_topicMap; - auto prevTopicIter = topicMap.lowerBound(m_positionTime); - if (prevTopicIter == topicMap.constEnd()) - { - - prevTopicIter = topicMap.lowerBound(topicMap.lastKey()); - - if (prevTopicIter == topicMap.constEnd()) - { - Q_ASSERT(prevTopicIter != topicMap.constEnd()); - return -1; - } - } - - if (prevTopicIter == topicMap.constBegin()) - { - DEBUG_LOG(m_logger) << "There is no previous topic! (1)"; - return -1; - } - - prevTopicIter--; - - if (prevTopicIter == topicMap.constEnd()) - { - DEBUG_LOG(m_logger) << "There is no previous topic! (2)"; - return -1; - } - - return prevTopicIter.key(); -} - - -void ScriptDialog::slotToPreviousTopic() -{ - int topicTime = previousTopicTime(); - - if (topicTime < 0) - return; - - if (m_presentationTimer->isActive()) - { - topicTime -= 1; - - if (topicTime < 0) - topicTime = 0; - } - - setPositionTimeActive(topicTime); -} - - -bool ScriptDialog::isFilter(TrackEntryType tet) -{ - return (tet == TrackEntryType::TacticalPlan || - tet == TrackEntryType::SituationMapFilter); -} - - -Screen *ScriptDialog::getProjectionWidget(const ScriptDialog::ProjectionWidget &projectionWidget) -{ - switch (projectionWidget) - { - case ScriptDialog::ProjectionWidget::Unknown: - return nullptr; - case ScriptDialog::ProjectionWidget::Screen1: - return m_projectionWidget1; - case ScriptDialog::ProjectionWidget::Screen2: - return m_projectionWidget2; - } - Q_ASSERT(false); - return nullptr; -} - - -ScriptDialog::ProjectionWidget ScriptDialog::identifyProjectionWidget(TrackEntry *topic) const -{ - DEBUG_LOG(m_logger) << "identifyProjectionWidget: channel name: " << topic->m_channelName << ", filter parent channel name: " << topic->m_filterParentChannel; - - if (topic->m_channelName == QStringLiteral("Screen 2")) - return ProjectionWidget::Screen2; - if (topic->m_channelName == QStringLiteral("Screen 1")) - return ProjectionWidget::Screen1; - - - if (topic->m_filterParentChannel == QStringLiteral("Screen 2")) - return ProjectionWidget::Screen2; - if (topic->m_filterParentChannel == QStringLiteral("Screen 1")) - return ProjectionWidget::Screen1; - - return ProjectionWidget::Unknown; -} - - -bool ScriptDialog::_tryAddTopic(TrackEntryType trackEntryType, - const std::shared_ptr &topicEditorIfc, - const std::shared_ptr &topicReplayFactory, - const std::shared_ptr &topicExportFactory, - QStringList &resultList, - const SpecialTopicType &specialTopicType) -{ - QString typeName = trackEntryTypeName(trackEntryType); - - TopicAssignment ta; - ta.m_topicName = typeName; - ta.m_trackEntryType = trackEntryType; - - ta.m_topicEditorIfc = topicEditorIfc; - ta.m_topicReplayFactory = topicReplayFactory; - ta.m_topicExportFactory = topicExportFactory; - - - if (ta.m_topicEditorIfc != nullptr) - { - if (!ta.m_topicEditorIfc->initTopicEditor()) - { - ERROR_LOG(m_logger) << "Cannot add topic type " << typeName << " since 'initTopicEditor' failed"; - resultList.append(typeName); - return false; - } - } - - m_trackEntryAssignments.insert(typeName, ta); - m_trackEntryToTopicAssignment.insert(trackEntryType, ta); - - if (topicEditorIfc) - { - - std::function f = [this](const LtsWidgets::PluginData & pd) - { - QString ident = pd.identifier; - ident.remove(QStringLiteral("AddTopic.")); - - auto teaIt = m_trackEntryAssignments.constFind(ident); - - if (teaIt == m_trackEntryAssignments.constEnd()) - { - LtsWidgets::LtsMessageDialog::showMessage(this, tr("Topic '%1' not found!").arg(ident)); - return; - } - - const TopicAssignment &tea = *teaIt; - - createTopic(tea); - }; - - - LtsWidgets::PluginData plData; - - switch (specialTopicType) - { - case SpecialTopicType::FilterTopic: - { - plData.menuGroup = tr("Filter Topics"); - break; - } - - case SpecialTopicType::ReplayTopic: - { - plData.menuGroup = tr("Replay Topics"); - break; - } - - default: - { - plData.menuGroup = tr("Display Topics"); - break; - } - } - - plData.menuText = tr("Add %1 Topic").arg(translateTrackEntryType(trackEntryType)); - plData.identifier = QStringLiteral("AddTopic.%1").arg(typeName); - plData.menuIcon = appToIcon(trackEntryType); - plData.directFunc = f; - - m_exerciseSession->addAction(plData); - } - - return true; -} - - -bool ScriptDialog::usesAvsWindow(TrackEntryType trackEntryType) const -{ - return - trackEntryType == TrackEntryType::Video; -} - - -void ScriptDialog::setReplayWidgetPosition(PlayingTopic *playingTopic) -{ - ScriptDialog::ProjectionWidget projectionWidgetType = identifyProjectionWidget(playingTopic->topic); - QWidget *projectionWidget = getProjectionWidget(projectionWidgetType); - - if (projectionWidget == nullptr) - { - ERROR_LOG(m_logger) << "screen for topic #" << playingTopic->topic->m_topicId << " not found"; - return; - } - - int projectionWidth = projectionWidget->width(); - int projectionHeight = projectionWidget->height(); - - DEBUG_LOG(m_logger) << "projection w: " << projectionWidth << ", h: " << projectionHeight; - - TrackEntry *topic = playingTopic->topic; - - - - - - - - int x = 0; - int y = 0; - - if (isScreenFreestanding(projectionWidgetType)) - { - QPoint pos2(projectionWidget->mapToGlobal(projectionWidget->pos())); - x = pos2.x(); - y = pos2.y(); - } - - QWidget *replayWidget = playingTopic->replayWidget; - - if (replayWidget == nullptr) - { - WARNING_LOG(m_logger) << "no replay widget for topic" << topic->m_topicId; - return; - } - - - if ((topic->x <= 0 && topic->w <= 0 && topic->y <= 0 && topic->h <= 0) - || (topic->x < 0 || topic->w < 0 || topic->y < 0 || topic->h < 0)) - { - replayWidget->setGeometry(x, y, projectionWidth, projectionHeight); - ERROR_LOG(m_logger) << "set geo of replay widget !! #1 x" << x << "y" << y; - } - else - { - double projectionX = projectionWidth; projectionX *= topic->x; - double projectionY = projectionHeight; projectionY *= topic->y; - double projectionW = projectionWidth; projectionW *= topic->w; - double projectionH = projectionHeight; projectionH *= topic->h; - - replayWidget->setGeometry(x + qRound(projectionX), y + qRound(projectionY), qRound(projectionW), qRound(projectionH)); - } - - DEBUG_LOG(m_logger) << "final widget geo: " << replayWidget->geometry().x() - << ", " << replayWidget->geometry().y() - << ", " << replayWidget->geometry().width() - << ", " << replayWidget->geometry().height(); - - replayWidget->show(); -} - - -void ScriptDialog::setReplayWidgetFreestanding(PlayingTopic *playingTopic, bool freestanding) -{ - QWidget *replayWidget = playingTopic->replayWidget; - - if (replayWidget == nullptr) - return; - - QWidget *projectionWidget = getProjectionWidget(identifyProjectionWidget(playingTopic->topic)); - - if (projectionWidget == nullptr) - { - ERROR_LOG(m_logger) << "screen for topic #" << playingTopic->topic->m_topicId << " not found"; - return; - } - - if (freestanding) - { - replayWidget->setParent(nullptr); - replayWidget->hide(); - - replayWidget->setWindowFlags(Qt::Window | Qt::FramelessWindowHint); - replayWidget->setWindowModality(Qt::WindowModality::NonModal); - - replayWidget->show(); - replayWidget->activateWindow(); - } - else - replayWidget->setParent(projectionWidget); - - - - replayWidget->setContentsMargins(0, 0, 0, 0); - - replayWidget->show(); - replayWidget->raise(); - - setReplayWidgetPosition(playingTopic); -} - - -void ScriptDialog::avsVisibilityHack(QWidget *parentForScreen, bool visible) -{ - bool wasAlreadyActive = (visible != m_avsVisibilityHackActive); - - if (!wasAlreadyActive && parentForScreen != nullptr) - { - parentForScreen->setVisible(visible); - if (parentForScreen->parentWidget()) - { - parentForScreen->parentWidget()->setVisible(visible); - if (parentForScreen->parentWidget()->parentWidget()) - parentForScreen->parentWidget()->parentWidget()->setVisible(visible); - } - } - - m_avsVisibilityHackActive = !visible; - - if (!wasAlreadyActive && m_avsVisibilityHackActive && m_currentTopicDesigner != nullptr && m_currentTopicDesigner->parentWidget() != nullptr) - { - QWidget *widget = new QWidget(nullptr); - widget->activateWindow(); - - QRect geo(m_currentTopicDesigner->parentWidget()->geometry()); - QSize s(geo.size()); - QPoint pos(m_currentTopicDesigner->parentWidget()->mapToGlobal(geo.topLeft())); - - widget->setGeometry(QRect(pos, s)); - ERROR_LOG(m_logger) << "geo x" << widget->geometry().x() << "geo y" << widget->geometry().y() << "geo h" << widget->geometry().height() << "geo w" << widget->geometry().width(); - - - widget->setWindowFlags(Qt::FramelessWindowHint); - widget->setAttribute(Qt::WA_TranslucentBackground); - - - widget->setWindowFlag(Qt::WindowStaysOnTopHint); - widget->setWindowFlag(Qt::X11BypassWindowManagerHint); - - widget->show(); - widget->raise(); - - connect(m_currentTopicDesigner.data(), &TopicDesigner::destroyed, - widget, &QWidget::deleteLater); - - - QTimer *t = new QTimer(widget); - t->setInterval(500); - connect(t, &QTimer::timeout, - this, [widget]() - { - widget->raise(); - }); - t->start(); - - m_currentTopicDesigner->setParent(widget); - m_currentTopicDesigner->show(); - - ERROR_LOG(m_logger) << "made freestanding"; - } -} - - -void ScriptDialog::avsFreestandingHack(bool freestanding, QWidget *projectionWidget, QWidget **parentForScreen) -{ - if (freestanding && projectionWidget) - { - (*parentForScreen) = projectionWidget->parentWidget(); - - connect((*parentForScreen), &QWidget::destroyed, - this, [parentForScreen](QObject * obj) - { - if (static_cast((*parentForScreen)) == obj) - (*parentForScreen) = nullptr; - }); - - avsVisibilityHack(*parentForScreen, false); - } - else - avsVisibilityHack(*parentForScreen, true); -} - - -void ScriptDialog::setFreestanding(bool freestanding, const ProjectionWidget &pw) -{ - switch (pw) - { - case ProjectionWidget::Screen1: - { - m_currentlyFreestandingTopicsScreen1 = freestanding; - avsFreestandingHack(freestanding, m_projectionWidget1, &m_previousParentForScreen1); - break; - } - - case ProjectionWidget::Screen2: - { - m_currentlyFreestandingTopicsScreen2 = freestanding; - avsFreestandingHack(freestanding, m_projectionWidget2, &m_previousParentForScreen2); - break; - } - - case ProjectionWidget::Unknown: - { - ERROR_LOG(m_logger) << "trying to set freestanding with unknown projection widget - cannot set freestanding"; - return; - } - } - - for (PlayingTopic *playingTopic : std::as_const(m_currentlyPlayingTopics)) - { - if (identifyProjectionWidget(playingTopic->topic) != pw) - continue; - - setReplayWidgetFreestanding(playingTopic, freestanding); - } -} - - -bool ScriptDialog::isScreenFreestanding(const ProjectionWidget &pw) const -{ - switch (pw) - { - case ProjectionWidget::Screen1: - return m_currentlyFreestandingTopicsScreen1; - case ProjectionWidget::Screen2: - return m_currentlyFreestandingTopicsScreen2; - case ProjectionWidget::Unknown: - ERROR_LOG(m_logger) << "projection widget unknown"; - return false; - } - return true; -} - - -void ScriptDialog::addReplayWidget(PlayingTopic *playingTopic, QWidget *replayWidget) -{ - playingTopic->replayWidget = replayWidget; - - bool alreadyAdded = false; - bool freestandingTopic = usesAvsWindow(playingTopic->trackEntryType); - ProjectionWidget projectionWidgetType = identifyProjectionWidget(playingTopic->topic); - - switch (projectionWidgetType) - { - case ProjectionWidget::Screen1: - { - if (m_currentlyFreestandingTopicsScreen1 == false && - freestandingTopic == true) - { - setFreestanding(true, projectionWidgetType); - alreadyAdded = true; - } - - break; - } - - case ProjectionWidget::Screen2: - { - if (m_currentlyFreestandingTopicsScreen2 == false && - freestandingTopic == true) - { - setFreestanding(true, projectionWidgetType); - alreadyAdded = true; - } - - break; - } - - case ProjectionWidget::Unknown: - { - ERROR_LOG(m_logger) << "projection widget unknown - cannot add replay widget"; - return; - } - } - - if (alreadyAdded) - return; - - setReplayWidgetFreestanding(playingTopic, isScreenFreestanding(projectionWidgetType)); -} - - -bool ScriptDialog::enableFireEventFlash(bool enable) -{ - bool success = false; - std::shared_ptr sitMapIfc; - if (m_sitMapSession->getForeignGuiInterface(sitMapIfc)) - success = sitMapIfc->enableFireEventFlashing(enable); - else - WARNING_LOG(m_logger) << Q_FUNC_INFO << " Cannot execute enableFireEventFlashing with enable=" << enable; - return success; -} - - -void ScriptDialog::playTopic(TrackEntry *topic) -{ - if (m_ignoreTopicForReplay == topic->m_topicId) - return; - - if (m_isPlayTopicMethodStillRunning) - return; - - BoolHelper bh(&m_isPlayTopicMethodStillRunning); - - std::shared_ptr sitMapIfc; - - if (topic->m_type == TrackEntryType::Snapshot || - topic->m_type == TrackEntryType::SituationReplay || - topic->m_type == TrackEntryType::Situation) - m_sitMapSession->getForeignGuiInterface(sitMapIfc); - SituationMap::SitMapUpdatesEnabledHelper sitMapHelper(sitMapIfc); - - PlayingTopic *playingTopic = new PlayingTopic(); - playingTopic->topic = topic; - playingTopic->isFilter = isFilter(topic->m_type); - if (topic->m_type == TrackEntryType::Situation) - playingTopic->isFilter = true; - - m_currentlyPlayingTopics.append(playingTopic); - - for (const TopicAssignment &ta : std::as_const(m_trackEntryAssignments)) - { - DEBUG_LOG(m_logger) << Q_FUNC_INFO << " ta.m_topicName = " << ta.m_topicName; - - if (topic->m_type == ta.m_trackEntryType) - { - DEBUG_LOG(m_logger) << Q_FUNC_INFO << " createInterface"; - - playingTopic->topicTypeName = ta.m_topicName; - playingTopic->trackEntryType = ta.m_trackEntryType; - playingTopic->topicReplayIfc = ta.m_topicReplayFactory->createInterface(playingTopic->trackEntryType); - } - } - - if (playingTopic->topicTypeName.isEmpty() || playingTopic->topicReplayIfc == nullptr) - { - WARNING_LOG(m_logger) << "Topic could not be assigned!! type name: " << playingTopic->topicTypeName << "replay ifc: " << (void *)playingTopic->topicReplayIfc; - - return; - } - - DEBUG_LOG(m_logger) << Q_FUNC_INFO << " playingTopic->trackEntryType " << playingTopic->trackEntryType; - - if (playingTopic->trackEntryType == TrackEntryType::SituationMap || - playingTopic->trackEntryType == TrackEntryType::Situation) - { - DEBUG_LOG(m_logger) << Q_FUNC_INFO << " addReplayWidget"; - - m_sitMapSession->baseLayout()->setAutoFillBackground(true); - addReplayWidget(playingTopic, m_sitMapSession->baseLayout()); - - if (sitMapIfc || m_sitMapSession->getForeignGuiInterface(sitMapIfc)) - sitMapIfc->forceUpdate(); - else - WARNING_LOG(m_logger) << "Cannot force update on Situation Map - map might be stuck!"; - - if (playingTopic->trackEntryType == TrackEntryType::Situation) - { - DEBUG_LOG(m_logger) << Q_FUNC_INFO << " Situation -> ENable FireEventFlashing"; - if (!enableFireEventFlash(true)) - WARNING_LOG(m_logger) << Q_FUNC_INFO << " Cannot enableFireEventFlashing at Situation Map"; - } - } - else - { - DEBUG_LOG(m_logger) << Q_FUNC_INFO << " non-sitmap"; - - - - - if (playingTopic->trackEntryType == TrackEntryType::Snapshot) - { - DEBUG_LOG(m_logger) << Q_FUNC_INFO << " Snapshot -> DISable FireEventFlashing"; - if (!enableFireEventFlash(false)) - WARNING_LOG(m_logger) << Q_FUNC_INFO << " Cannot disableFireEventFlashing at Situation Map"; - } - else if (playingTopic->trackEntryType == TrackEntryType::SituationReplay) - { - DEBUG_LOG(m_logger) << Q_FUNC_INFO << " SituationReplay -> ENable FireEventFlashing"; - if (!enableFireEventFlash(true)) - WARNING_LOG(m_logger) << Q_FUNC_INFO << " Cannot enableFireEventFlashing at Situation Map"; - } - - - bool isAvs = usesAvsWindow(playingTopic->trackEntryType); - ProjectionWidget projectionWidgetType = identifyProjectionWidget(playingTopic->topic); - bool isProjectionWidgetAvailable = (getProjectionWidget(projectionWidgetType) != nullptr); - - QWidget *replayWidget = nullptr; - - if (!isAvs || (isAvs && isProjectionWidgetAvailable)) - replayWidget = playingTopic->topicReplayIfc->createWidget(); - - if (replayWidget != nullptr) - { - addReplayWidget(playingTopic, replayWidget); - - - - if (topic->m_type == TrackEntryType::Building) - { - QTimer::singleShot(100, this, [this, playingTopic, replayWidget]() - { - addReplayWidget(playingTopic, replayWidget); - }); - } - } - else - WARNING_LOG(m_logger) << "topic #" << playingTopic->topic->m_topicId << " has no widget to show on presentation screen"; - } - - - - if (topic->m_detailData.isEmpty()) - { - WARNING_LOG(m_logger) << "Note: Topic id " << topic->m_topicId << " has no JSON data"; - - - } - - QString descriptionText; - if (!topic->m_description.isEmpty()) - descriptionText = tr("\n Description: %1").arg(topic->m_description); - - - QJsonObject obj = topic->m_detailData; - obj[QStringLiteral("scriptsExerciseId")] = m_scriptsExerciseId; - obj[QStringLiteral("exerciseId")] = m_exerciseName; - - if (!playingTopic->topicReplayIfc->playbackInit(obj)) - { - WARNING_LOG(m_logger) << "Playing topic # " << topic->m_topicId << " playback init failed! Playback of this topic failed!"; - - return; - } - - - - static int initCnt = 4; - - if (initCnt && (topic->m_type == TrackEntryType::Building)) - { - --initCnt; - QTimer::singleShot(500, this, [obj, playingTopic]() - { - playingTopic->topicReplayIfc->playbackInit(obj); - }); - } - - DEBUG_LOG(m_logger) << "playbackStart at offset" << m_positionTime - topic->m_startTime; - if (!playingTopic->topicReplayIfc->playbackStart(m_positionTime - topic->m_startTime )) - WARNING_LOG(m_logger) << "Playing topic # " << topic->m_topicId << " playback start failed! Playback of this topic failed!"; - - m_journal.journalList.append(new NextTopicJournal(m_positionTime, playingTopic->isFilter, playingTopic->topicTypeName, topic->m_length)); -} - - -void ScriptDialog::deletePlayingTopic(PlayingTopic *playingTopic) -{ - std::shared_ptr sitMapIfc; - - if (playingTopic->topic->m_type == TrackEntryType::Snapshot || - playingTopic->topic->m_type == TrackEntryType::SituationReplay) - m_sitMapSession->getForeignGuiInterface(sitMapIfc); - SituationMap::SitMapUpdatesEnabledHelper sitMapHelper(sitMapIfc); - - - - - - if (playingTopic->replayWidget != nullptr) - { - if (usesAvsWindow(playingTopic->trackEntryType)) - { - ProjectionWidget projectionWidgetType = identifyProjectionWidget(playingTopic->topic); - - if (isScreenFreestanding(projectionWidgetType)) - setFreestanding(false, projectionWidgetType); - } - - playingTopic->replayWidget->hide(); - playingTopic->replayWidget->setParent(nullptr); - - playingTopic->replayWidget = nullptr; - } - - delete playingTopic; - printCurrentlyPlayingTopics(); -} - - -void ScriptDialog::slotTimerTick() -{ - if (!m_scriptRunning) - return; - - if (m_bTimerTickRecursionGuard) - return; - BoolHelper bh(&m_bTimerTickRecursionGuard); - - if (m_positionTime == -1) - m_positionTime = 0; - - - { - - QMutableVectorIterator i(m_currentlyPlayingTopics); - - while (i.hasNext()) - { - PlayingTopic *playingTopic = i.next(); - - - - if (m_positionTime < (playingTopic->topic->m_startTime + playingTopic->topic->m_length)) - continue; - - - i.remove(); - deletePlayingTopic(playingTopic); - } - } - - - - for (TrackEntry *topic : std::as_const(m_topicVector)) - { - - bool found = false; - for (const PlayingTopic *pt : std::as_const(m_currentlyPlayingTopics)) - { - if (pt->topic->m_topicId == topic->m_topicId) - { - found = true; - break; - } - } - if (found) - continue; - - if (m_positionTime >= topic->m_startTime && m_positionTime < (topic->m_startTime + topic->m_length)) - { - - DEBUG_LOG(m_logger) << "Playing topic id " << topic->m_topicId << " with description " << topic->m_description; - playTopic(topic); - } - } - - - - if (m_firstPlayAfterStop) - m_firstPlayAfterStop = false; - else - { - - for (const FilterTopic &filterTopic : std::as_const(m_filterTopicVector)) - { - TrackEntry *filterTe = filterTopic.filterTopic; - - bool found = false; - for (const PlayingTopic *pt : std::as_const(m_currentlyPlayingTopics)) - { - if (pt->topic->m_topicId == filterTe->m_topicId) - { - found = true; - break; - } - } - - if (found) - continue; - - int realFilterTime = filterTe->m_startTime; - if (m_positionTime >= (realFilterTime + 1) && m_positionTime <= (realFilterTime + filterTe->m_length)) - { - DEBUG_LOG(m_logger) << "Playing filter topic id " << filterTe->m_topicId << " with description " << filterTe->m_description; - - - playTopic(filterTe); - } - } - - if (m_stopAfterPlayingFilterTopic) - { - slotPause(); - m_stopAfterPlayingFilterTopic = false; - } - } - - - if ((m_positionTime + 1) > m_highestTime) - { - m_journal.journalList.append(new EndedJournal(m_positionTime)); - stop(true); - return; - } - - if (m_nextPauseTime > 0 && (m_nextPauseTime <= m_positionTime + 1)) - { - m_nextPauseTime = -1; - m_journal.journalList.append(new PauseJournal(m_positionTime)); - slotPause(); - } - - setPositionTime(m_positionTime + 1); - printCurrentlyPlayingTopics(); -} - - -void ScriptDialog::printCurrentlyPlayingTopics() -{ - m_ui->lwStatus->clear(); - - for (const PlayingTopic *playingTopic : std::as_const(m_currentlyPlayingTopics)) - { - if (!playingTopic->topicTypeName.isEmpty() && playingTopic->topicReplayIfc != nullptr) - { - QString status = tr("Playing topic '%1' from second %2 to second %3 %4").arg(translateTrackEntryType(playingTopic->trackEntryType)) - .arg(playingTopic->topic->m_startTime).arg(playingTopic->topic->m_startTime + playingTopic->topic->m_length) - .arg(playingTopic->topic->m_description); - - m_ui->lwStatus->addItem(status); - } - } -} - - -void ScriptDialog::slotPlay() -{ - if (qobject_cast(sender()) == m_ui->pbPlay) - m_ignoreTopicForReplay = -1; - - - - - - - - - - - if (m_currentlyPlayingTopics.isEmpty()) - fillTopicVector(); - - if (m_currentTopicEditor != nullptr) - { - if (m_currentTopicEditor->hasUnsavedChanges()) - { - new LtsWidgets::LtsMessageDialogNew(this, tr("Please apply changes of the selected topic before playing the script.")); - m_stopAfterPlayingFilterTopic = false; - return; - } - } - - if (m_currentTopicDesigner != nullptr) - m_currentTopicDesigner->deleteLater(); - - m_enableApply = false; - - m_ui->widget->slotUnselectAll(); - m_ui->widget->setReadonly(true); - m_ui->widget->lockIndicator(true); - - m_ui->pbPlay->setEnabled(false); - m_ui->pbPause->setEnabled(true); - m_ui->pbStop->setEnabled(true); - m_ui->posSlider->setEnabled(false); - m_ui->pbPreviousTopic->setEnabled(false); - m_ui->pbNextTopic->setEnabled(false); - m_ui->pbUntilNextTopic->setEnabled(false); - m_ui->pbInitScr1->setEnabled(false); - m_ui->pbInitScr2->setEnabled(false); - - - if (!m_currentlyPlayingTopics.isEmpty()) - { - - QMutableVectorIterator i(m_currentlyPlayingTopics); - - while (i.hasNext()) - { - PlayingTopic *pt = i.next(); - TrackEntry *topic = pt->topic; - - if (m_positionTime < topic->m_startTime || m_positionTime > (topic->m_startTime + topic->m_length)) - { - - - - i.remove(); - deletePlayingTopic(pt); - } - - - } - - - - - - for (const PlayingTopic *playingTopic : std::as_const(m_currentlyPlayingTopics)) - { - if (playingTopic->topicReplayIfc != nullptr && m_ignoreTopicForReplay != playingTopic->topic->m_topicId) - { - DEBUG_LOG(m_logger) << "playbackStart (resume) at offset" << m_positionTime - playingTopic->topic->m_startTime; - if (!playingTopic->topicReplayIfc->playbackStart(m_positionTime - playingTopic->topic->m_startTime - )) - WARNING_LOG(m_logger) << "Playing topic # " << playingTopic->topic->m_topicId << " playback start failed! Re-playback of this topic failed!"; - } - - - - - if (playingTopic->trackEntryType == TrackEntryType::Snapshot) - { - DEBUG_LOG(m_logger) << Q_FUNC_INFO << " Snapshot -> DISable FireEventFlashing"; - if (!enableFireEventFlash(false)) - WARNING_LOG(m_logger) << Q_FUNC_INFO << " Cannot disableFireEventFlashing at Situation Map"; - } - else if (playingTopic->trackEntryType == TrackEntryType::SituationReplay) - { - DEBUG_LOG(m_logger) << Q_FUNC_INFO << " Snapshot -> ENable FireEventFlashing"; - if (!enableFireEventFlash(true)) - WARNING_LOG(m_logger) << Q_FUNC_INFO << " Cannot enableFireEventFlashing at Situation Map"; - } - - - } - - m_nextPauseTime = -1; - } - - - LtsWidgets::LtsGlobalWaitDialog::getInstance()->setVisible(false); - - m_presentationTimer->start(); - - m_journal.journalList.append(new PlayJournal(m_positionTime)); - - m_buttonBox->getButton(LtsWidgets::DialogButton::Hide)->setEnabled(false); - m_buttonBox->getButton(LtsWidgets::DialogButton::Edit)->setEnabled(false); - - - - - - - - - m_scriptRunning = true; -} - - -void ScriptDialog::slotPause() -{ - m_firstPlayAfterStop = true; - m_ui->pbPlay->setEnabled(true); - m_ui->pbPause->setEnabled(false); - m_ui->posSlider->setEnabled(true); - m_ui->widget->lockIndicator(false); - m_ui->pbPreviousTopic->setEnabled(hasPreviousTopic()); - m_ui->pbNextTopic->setEnabled(hasNextTopic()); - m_ui->pbUntilNextTopic->setEnabled(true); - - LtsWidgets::LtsGlobalWaitDialog::getInstance()->setVisible(true); - - m_presentationTimer->stop(); - - pausePlayingTopics(); - - m_journal.journalList.append(new PauseJournal(m_positionTime)); - - std::shared_ptr sitMapIfc; - if (m_sitMapSession->getForeignGuiInterface(sitMapIfc)) - sitMapIfc->enableFireEventFlashing(false); - else - WARNING_LOG(m_logger) << "Cannot update sit map fire event flashing"; -} - - -void ScriptDialog::stop(bool ended, bool ignoreFireEventFlashing) -{ - if (m_isPlayTopicMethodStillRunning) - return; - - m_scriptRunning = false; - m_presentationTimer->stop(); - - m_enableApply = true; - m_firstPlayAfterStop = true; - m_ui->pbPlay->setEnabled(true); - m_ui->pbPause->setEnabled(false); - m_ui->pbStop->setEnabled(false); - m_ui->posSlider->setEnabled(true); - m_ui->widget->lockIndicator(false); - m_ui->pbInitScr1->setEnabled(true); - m_ui->pbInitScr2->setEnabled(true); - - m_ignoreTopicForReplay = -1; - - LtsWidgets::LtsGlobalWaitDialog::getInstance()->setVisible(true); - - - QMutableVectorIterator i(m_currentlyPlayingTopics); - while (i.hasNext()) - { - PlayingTopic *pt = i.next(); - i.remove(); - deletePlayingTopic(pt); - } - - setPositionTime(-1); - m_ui->lblPos->setText(toReadableTime(0)); - - if (ended) - m_journal.journalList.append(new EndedJournal(m_positionTime)); - else - m_journal.journalList.append(new StopJournal(m_positionTime)); - - m_buttonBox->getButton(LtsWidgets::DialogButton::Edit)->setEnabled(true); - m_buttonBox->getButton(LtsWidgets::DialogButton::Hide)->setEnabled(true); - - m_ui->widget->setReadonly(false); - - - if (!ignoreFireEventFlashing && m_sitMapSession != nullptr) - { - std::shared_ptr sitMapIfc; - if (m_sitMapSession->getForeignGuiInterface(sitMapIfc)) - sitMapIfc->enableFireEventFlashing(true); - else - WARNING_LOG(m_logger) << "Cannot update sit map fire event flashing"; - } -} - - -void ScriptDialog::slotStop() -{ - stop(); -} - - -void ScriptDialog::pausePlayingTopics() -{ - m_ui->lwStatus->clear(); - - for (PlayingTopic *playingTopic : std::as_const(m_currentlyPlayingTopics)) - { - if (playingTopic->topicReplayIfc != nullptr) - { - DEBUG_LOG(m_logger) << "Pause topic: " << playingTopic->topicTypeName; - playingTopic->topicReplayIfc->playbackPause(); - - QString status = tr("Currently paused topic '%1' %2") - .arg(translateTrackEntryType(playingTopic->trackEntryType), playingTopic->topic->m_description); - - m_ui->lwStatus->addItem(status); - } - else - DEBUG_LOG(m_logger) << "Topic not paused: " << playingTopic->topicTypeName; - } -} - - -void ScriptDialog::slotShowStoryboard() -{ - if (m_currentlyPlayingTopics.isEmpty()) - fillTopicVector(); - - static QString id(QStringLiteral("ScriptPlayer.StoryBoard")); - - if (m_exerciseSession->baseLayout()->focusTab(m_menuGroup, id, LtsWidgets::LayoutArea::eDialogTab)) - return; - - StoryboardDialog *dialog = LtsWidgets::initDialog(new StoryboardDialog(this, m_exerciseSession), m_topicVector, m_filterTopicVector, m_scriptName, m_scriptOwner, m_lastModified, toReadableTime(m_highestTime) ); - m_storyboardDialog = dialog; - m_exerciseSession->addWidget(dialog, m_menuGroup, id, LtsWidgets::LayoutArea::eDialogTab); -} - - -QString ScriptDialog::toReadableTime(qint64 seconds) -{ - return QTime::fromMSecsSinceStartOfDay(seconds * 1000).toString(); -} - - -void ScriptDialog::deleteProjectionWidget(Screen **pointerToWidgetPointer) -{ - if (*pointerToWidgetPointer == nullptr) - return; - - - const auto p1Widgets = (*pointerToWidgetPointer)->findChildren(QString(), Qt::FindDirectChildrenOnly); - - for (QWidget *w : p1Widgets) - w->setParent(nullptr); - - (*pointerToWidgetPointer)->deleteLater(); - *pointerToWidgetPointer = nullptr; -} - - -void ScriptDialog::initProjectionWidget(Screen **pointerToWidgetPointer) -{ - if (*pointerToWidgetPointer != nullptr) - deleteProjectionWidget(pointerToWidgetPointer); - - Screen *projWindow = new Screen(); - projWindow->setWindowTitle(tr("Playback")); - projWindow->setObjectName(QStringLiteral("Playback")); - projWindow->resize(1280, 900); - - - connect(projWindow, &QWidget::destroyed, - this, [this, pointerToWidgetPointer] - { - if (static_cast(*pointerToWidgetPointer) == sender()) - *pointerToWidgetPointer = nullptr; - INFO_LOG(m_logger) << "a projection windows was destroyed"; - }); - - *pointerToWidgetPointer = projWindow; - - m_exerciseSession->baseLayout()->setIrreplaceableOnce(); - LtsMultiMonitor::LtsMultiMonitor::getInstance()->selectScreen(*pointerToWidgetPointer); -} - - -void ScriptDialog::fillTopicVector() -{ - if (m_ignoreChanges) - return; - - for (const LtsScriptTimeline::TrackEntry *trackEntry : std::as_const(m_topicVector)) - { - DEBUG_LOG(m_logger) << "m_topicVector index=" << trackEntry->index - << " topicId=" << trackEntry->m_topicId - << " type=" << trackEntry->m_type; - - } - - - - - - - - - - - - - - - - - for (const FilterTopic &filterTopic : std::as_const(m_filterTopicVector)) - { - const LtsScriptTimeline::TrackEntry *trackEntry = filterTopic.filterTopic; - DEBUG_LOG(m_logger) << "m_filterTopicVector mainTopicId=" << filterTopic.mainTopicId - << " index=" << trackEntry->index - << " topicId=" << trackEntry->m_topicId - << " type=" << trackEntry->m_type - << " isSet=" << trackEntry->isSet - - << " startTime=" << trackEntry->m_startTime - << " length=" << trackEntry->m_length - << " filterParentChannel=" << trackEntry->m_filterParentChannel; - } - - Q_ASSERT(m_currentlyPlayingTopics.isEmpty()); - - m_topicVector.clear(); - - for (const FilterTopic &ft : std::as_const(m_filterTopicVector)) - delete ft.filterTopic; - m_filterTopicVector.clear(); - - m_topicMap.clear(); - m_ui->lwStatus->clear(); - - const QMap > trackList = m_ui->widget->getTrackEntriesWithFilters(); - - for (const QVector &trackEntryList : std::as_const(trackList)) - { - m_topicVector += trackEntryList; - for (TrackEntry *te : trackEntryList) - m_topicMap.insert(te->m_startTime, nullptr); - } - - m_highestTime = -1; - - if (!m_topicVector.isEmpty()) - { - m_ui->lwStatus->addItem(tr("Initialized with %1 Entries").arg(m_topicVector.count())); - - for (const TrackEntry *topic : std::as_const(m_topicVector)) - { - if (topic->m_startTime < m_lowestTime || m_lowestTime == -1) - m_lowestTime = topic->m_startTime; - - int end = topic->m_startTime + topic->m_length; - if (end > m_highestTime) - m_highestTime = end; - } - - if (m_lowestTime < 0 || m_highestTime < 1 || m_highestTime <= m_lowestTime) - m_ui->lwStatus->addItem(tr("ERROR: At least one available topic has invalid timing !")); - - for (const TrackEntry *topic : std::as_const(m_topicVector)) - { - - - - - - - - if (topic->m_detailData.isEmpty()) - continue; - - - - const QJsonArray filterLines = topic->m_detailData.value(QStringLiteral("Filters")).toArray(); - - - if (filterLines.isEmpty()) - continue; - - - - for (const QJsonValue &filterLineValue : filterLines) - { - const QJsonArray filterLine = filterLineValue.toArray(); - - for (const QJsonValue &filter : filterLine) - { - TrackEntry *filterTe = new TrackEntry; - filterTe->fromJson(filter.toObject()); - - filterTe->m_startTime = filterTe->m_startTime + topic->m_startTime; - filterTe->m_filterParentChannel = topic->m_channelName; - - - m_filterTopicVector.append(FilterTopic( topic->m_topicId, filterTe)); - } - } - } - } - else - m_ui->lwStatus->addItem(tr("INFO: This Presentation has no content !")); - - - m_ui->posSlider->setMaximum(m_highestTime); - m_ui->lblPos->setText(toReadableTime(0)); - m_ui->lblMax->setText(toReadableTime(m_highestTime)); - - if (m_storyboardDialog) - { - m_storyboardDialog->init(m_topicVector, m_filterTopicVector, m_scriptName, m_scriptOwner, m_lastModified, toReadableTime(m_highestTime)); - m_storyboardDialog->fillStoryboard(); - } -} - - - - - -void ScriptDialog::exportPresentationContent(const Core::FunctionReply &baseReply) -{ - const GetPresentationContentReply &reply = static_cast(baseReply); - const dds::core::vector &contentList = reply.content(); - - if (contentList.size() < 1) - { - ERROR_LOG(m_logger) << "No Presentation Content for Script Id " << reply.id(); - LtsWidgets::LtsMessageDialog::showMessage(this, tr("No presentation content, nothing to export!")); - return; - } - - - if (!isEssentialsViewOpened()) - { - - for (const PresentationManagement::PresentationContent &content : contentList) - { - TrackEntryType tet = TrackEntryType::INVALID; - - if (!topicStringToType(QString::fromStdString(content.presentationTopicType()), tet) || tet == TrackEntryType::INVALID) - { - ERROR_LOG(m_logger) << "Topic ignored at export - invalid topic type for presentation's content id " << content.id(); - continue; - } -#ifndef EXPORT_BDV_TOPIC_AS_JSON - if (tet == TrackEntryType::Building) - { - LtsWidgets::LtsMessageDialog::showMessage(this, tr("Please start the Essentials View which is required for export with building topics.")); - return; - } -#endif - } - } - else - { - - disableSessionDialog(eVSession(), true); - - - std::shared_ptr bgvIfc; - if (eVSession()->getForeignGuiInterface(bgvIfc)) - { - GuiPluginBase::Interface *pBaseGuiIfc = dynamic_cast(bgvIfc.get()); - if (pBaseGuiIfc) - eVSession()->baseLayout()->focusTab(pBaseGuiIfc->menuGroup(), QStringLiteral("bdvShowBdv"), LtsWidgets::LayoutArea::eMainTab); - } - else - ERROR_LOG(m_logger) << "Fetching ForeignGuiInterface of BuildingViewer failed!"; - } - - - QProgressDialog *pProgressDlg = new QProgressDialog(tr("Export in progress..."), tr("Cancel"), 0, 0, this); - - - m_exportProcess = new TakeHomePackageGenerator::ExportProcess(m_exerciseSession, - getReplayGuiIfc(), - pProgressDlg, - m_scriptName, - m_exerciseName, - m_scriptId, - contentList, - m_trackEntryAssignments, - this); - - - - QTimer::singleShot(1500, m_exportProcess, &TakeHomePackageGenerator::ExportProcess::slotStartExport); - QObject::connect(m_exportProcess, &TakeHomePackageGenerator::ExportProcess::exportSuccessful, this, &ScriptDialog::slotExportSuccessful); - - pProgressDlg->setWindowModality(Qt::WindowModal); - pProgressDlg->show(); -} - -void ScriptDialog::slotExportSuccessful(const QString &path, const QString &failedTopics) -{ - Q_UNUSED(path) - m_exportProcess->disconnect(); - m_exportProcess->deleteLater(); - - if (failedTopics.isEmpty()) - new LtsWidgets::LtsMessageDialogNew(this, tr("Export was successful."), tr("Success")); - else - new LtsWidgets::LtsMessageDialogNew(this, tr("The following topics failed to export:
%1").arg(failedTopics), tr("Failed Topics")); - - if (isEssentialsViewOpened()) - disableSessionDialog(eVSession(), false); -} - -void ScriptDialog::slotBurnDvD(const QString &strExportPath) -{ - m_exportProcess->disconnect(); - m_exportProcess->deleteLater(); - - if (LtsWidgets::LtsMessageDialog::showMessage(this, - tr("Do you want to burn the takehome package on DVD?"), - tr("Start burning DVD?"), - LtsWidgets::Behaviour::Modal, - LtsWidgets::Button::Yes | LtsWidgets::Button::No) == LtsWidgets::Button::Yes) - { - if (isEssentialsViewOpened()) - disableSessionDialog(eVSession(), true); - - - TakeHomePackageGenerator::DVDWriter *pWriter = new TakeHomePackageGenerator::DVDWriter(strExportPath, this); - QObject::connect(pWriter, &TakeHomePackageGenerator::DVDWriter::signalBurningFinished, - this, [this, pWriter](bool success) - { - slotBurningFinished(success); - delete pWriter; - }, Qt::QueuedConnection); - QTimer::singleShot(0, pWriter, &TakeHomePackageGenerator::DVDWriter::slotWriteDVD); - } - else - { - if (isEssentialsViewOpened()) - disableSessionDialog(eVSession(), false); - } -} - - -void ScriptDialog::slotBurningFinished(bool success) -{ - Q_UNUSED(success); - if (isEssentialsViewOpened()) - disableSessionDialog(eVSession(), false); - -} - - -void ScriptDialog::disableSessionDialog(LtsSession::LtsSession *pSession, bool disable) -{ - if (disable) - { - pSession->baseLayout()->getMenu()->hide(); - pSession->baseLayout()->onHideAnimated(); - pSession->baseLayout()->setEnabled(false); - } - else - { - pSession->baseLayout()->getMenu()->show(); - pSession->baseLayout()->onReShowAnimated(); - pSession->baseLayout()->setEnabled(true); - } -} - - -void ScriptDialog::slotLoadScript() -{ - if (m_scriptRunning) - { - new LtsWidgets::LtsMessageDialogNew(this, tr("Stop replay first.")); - return; - } - - auto load = [this]() - { - std::shared_ptr opmDtc; - if (!m_exerciseSession->getDtc(opmDtc)) - { - ERROR_LOG(m_logger) << "opm dtc missing for script chooser ..."; - return; - } - - ScriptChooser *scriptChooser = new ScriptChooser(m_dtc, opmDtc, false); - scriptChooser->setAttribute(Qt::WA_DeleteOnClose); - - connect(scriptChooser, &ScriptChooser::signalSelectScript, - this, [this](int scriptId) - { - m_scriptId = scriptId; - loadScript(); - }, Qt::QueuedConnection); - - connect(scriptChooser, &ScriptChooser::signalNewScript, - this, [this, opmDtc]() - { - PresentationEditDialog *dialog = new PresentationEditDialog(nullptr); - if (!dialog->init(-1 , m_dtc, m_ftc, opmDtc)) - { - delete dialog; - return; - } - - QObject::connect(dialog, &PresentationEditDialog::rejected, dialog, &PresentationEditDialog::deleteLater); - - dialog->show(); - }); - - if (!LtsSessionData::LtsSessionData::getInstance()->isTablet()) - scriptChooser->setModal(true); - - scriptChooser->show(); - }; - - - if (hasUnsavedChanges()) - connect(new LtsWidgets::LtsMessageDialogNew(this, tr("There are unsaved changes. \nDo you really want to discard these changes and load another script?"), tr("Unsaved changes"), LtsWidgets::Behaviour::Modal, LtsWidgets::Button::Yes | LtsWidgets::Button::No), - &LtsWidgets::LtsMessageDialogNew::yes, - this, load); - else - load(); -} - - -void ScriptDialog::slotExportScript() -{ - PresentationManagement::Presentation preSource = m_dtc->presentation(m_scriptId); - - if (preSource.id() < 1) - return; - - QString exportPath = TakeHomePackageGenerator::ExportProcess::exportPath(m_exerciseSession->exerciseId()) + QString::number(m_scriptId); - DEBUG_LOG(m_logger) << "exportPath: " << exportPath; - - QDir dir(exportPath); - if (!dir.exists()) - { - if (!dir.mkpath(exportPath)) - { - LtsWidgets::LtsMessageDialog::showMessage(this, - tr("Can not create temporary directory '%1'").arg(exportPath), - tr("Export Script"), - LtsWidgets::Behaviour::Modal, - LtsWidgets::Button::Ok); - return; - } - } - - if (dir.exists() && !dir.isEmpty()) - { - INFO_LOG(m_logger) << "slotExportScript: dir.exists() && !dir.isEmpty()" ; - LtsWidgets::Button button = LtsWidgets::LtsMessageDialog::showMessage(this, - tr("Specified folder already exists and is not empty. Do you want to overwrite this folder?"), - tr("Information: %1").arg(dir.absolutePath()), - LtsWidgets::Behaviour::Modal, LtsWidgets::Button::Yes | LtsWidgets::Button::No); - - if (button == LtsWidgets::Button::Yes) - dir.removeRecursively(); - else - return; - } - - - std::function exportLambda = [&](const Core::FunctionReply & baseReply) - { - exportPresentationContent(baseReply); - }; - - m_requestHelper = new LtsUtils::RequestHelper(this); - - if (!m_requestHelper->startSingleRequest([this]() -{ - return m_ftc->getPresentationContentRequest(GetPresentationContentRequest(m_scriptId), this); - }, exportLambda)) - { - LtsWidgets::LtsMessageDialog::showMessage(this, tr("There is no content to export for this script.")); - } - - - m_requestHelper->deleteLater(); - m_requestHelper = nullptr; -} - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_script_dialog.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_script_dialog.h deleted file mode 100755 index d53ce2188..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_script_dialog.h +++ /dev/null @@ -1,392 +0,0 @@ - - - -#pragma once - -#include "pre_screen.h" -#include "pre_journal_types.h" -#include "pre_storyboard.h" -#include "filter_topic.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - - -#include -#include - -#include -#include -#include -#include -#include - - -namespace TakeHomePackageGenerator -{ -class ExportProcess; -} -namespace Ui -{ -class ScriptDialog; -} -namespace LtsScriptTimeline -{ -class TrackEntry; -} -namespace SituationReplayManagement -{ -class ForeignDataInterface; -} -namespace LtsPluginManager -{ -class LtsPluginManager; -} -namespace Ui -{ -class ScriptPlayerDialog; -} -namespace LtsScriptTimeline -{ -class TrackEntry; -} -namespace LtsUtils -{ -class Promise; -} - - -namespace PresentationManagement -{ -class TopicDesigner; - -namespace Interface -{ -class Ftc; -} - - -class ScriptDialog : public LtsWidgets::LtsDialog - , protected PresentationManagement::Interface::Ftc::PresentationModifyReplyHandler - , protected PresentationManagement::Interface::Ftc::GetPresentationContentReplyHandler - , protected SituationReplayManagement::Interface::Ftc::ReplayPartitionCreateReplyHandler - , protected SituationReplayManagement::Interface::Ftc::ReplayPartitionRemoveReplyHandler -{ -public: - Q_OBJECT - -public: - explicit ScriptDialog(const QString &menuGroup, QWidget *parent = nullptr); - ~ScriptDialog(); - - LtsSession::LtsSession *eVSession() { return m_essentialsViewSession; } - - bool init(LtsSession::LtsSession *session, - const int scriptId, - const std::shared_ptr &dtc, - const std::shared_ptr &ftc, - const std::shared_ptr &srmForeign, - const std::shared_ptr &coreDtc, - const std::shared_ptr &opmDtc); - - void loadScript(); - TopicEditorBase::TopicEditor *createTopic(const TopicAssignment &ta); - TopicEditorBase::TopicEditor *createTopic(const LtsScriptTimeline::TrackEntry &data); - void createTopicFromTrackEntry(LtsScriptTimeline::TrackEntry *data); - - bool topicStringToType(const QString &typeName, LtsScriptTimeline::TrackEntryType &tet) const; - int getCurrentScriptEndTime() const; - bool isEssentialsViewOpened() const; - - static LtsScriptTimeline::TrackEntry *trackEntryFromContent(const PresentationManagement::PresentationContent &content, - int topicId, - LtsScriptTimeline::TrackEntryType trackType); - - bool importTrackEntries(const QVector &tes); - - std::shared_ptr getReplayGuiIfc() const - { - return m_essentialsViewsSrpGuiIfc; - } - -private: - enum class ProjectionWidget - { - Unknown = 0, - Screen1, - Screen2, - }; - - - enum class SpecialTopicType - { - NonSpecial = 0, - ReplayTopic, - FilterTopic, - }; - - - class PlayingTopic - { - public: - PlayingTopic() = default; - - ~PlayingTopic() - { - if (topicReplayIfc != nullptr) - { - topicReplayIfc->playbackStop(); - delete topicReplayIfc; - } - - - } - - QString topicTypeName; - LtsScriptTimeline::TrackEntry *topic = nullptr; - TopicReplay::Interface *topicReplayIfc = nullptr; - QWidget *replayWidget = nullptr; - LtsScriptTimeline::TrackEntryType trackEntryType = LtsScriptTimeline::TrackEntryType::INVALID; - bool isFilter = false; - }; - - - void onPresentationModifyReply(const Core::FunctionReplyObject &replyObject) override { if (m_requestHelper != nullptr) m_requestHelper->requestReply(replyObject); } - void onGetPresentationContentReply(const GetPresentationContentReply &reply) override { if (m_requestHelper != nullptr) m_requestHelper->requestReply(reply); } - void onReplayPartitionCreateReply(const Core::FunctionReplyObject &reply) override { if (m_requestHelper != nullptr) m_requestHelper->requestReply(reply); } - void onReplayPartitionRemoveReply(const Core::FunctionReplyObject &) override { } - - void retranslate() override; - bool apply() override; - void aboutToClose() override; - void getPresentationContent(); - TopicEditorBase::TopicEditor *createTopicEditor(LtsScriptTimeline::TrackEntry *te); - bool topicTypeOnEssentialsView(LtsScriptTimeline::TrackEntryType tet) const; - void startEssentialsViewStage2(const Core::ReplayPartition &replay); - bool tryAddTopics(QStringList &resultList); - void fillTopicVector(); - void createSitMapApp(); - void startReplaySession(); - void exportPresentationContent(const Core::FunctionReply &baseReply); - void disableSessionDialog(LtsSession::LtsSession *pSession, bool disable); - void deletePlayingTopic(PlayingTopic *playingTopic); - static QString toReadableTime(qint64 seconds); - ProjectionWidget identifyProjectionWidget(LtsScriptTimeline::TrackEntry *topic) const; - bool usesAvsWindow(LtsScriptTimeline::TrackEntryType trackEntryType) const; - void playTopic(LtsScriptTimeline::TrackEntry *topic); - bool enableFireEventFlash(bool enable); - void pausePlayingTopics(); - static bool isFilter(LtsScriptTimeline::TrackEntryType tet); - void initProjectionWidget(Screen **pointerToWidgetPointer); - void deleteProjectionWidget(Screen **pointerToWidgetPointer); - bool _tryAddTopic(LtsScriptTimeline::TrackEntryType trackEntryType, - const std::shared_ptr &topicEditorIfc, - const std::shared_ptr &topicReplayFactory, - const std::shared_ptr &topicExportFactory, - QStringList &resultList, - const SpecialTopicType &specialTopicType = SpecialTopicType::NonSpecial); - void initFailed(int reason); - void setFreestanding(bool freestanding, const ProjectionWidget &pw); - void setReplayWidgetFreestanding(PlayingTopic *playingTopic, bool freestanding); - void printCurrentlyPlayingTopics(); - void addReplayWidget(PlayingTopic *playingTopic, QWidget *replayWidget); - Screen *getProjectionWidget(const ScriptDialog::ProjectionWidget &projectionWidget); - bool isScreenFreestanding(const ProjectionWidget &pw) const; - void previewSecond(int time, int ignoreTopicForReplay = -1); - void setReplayWidgetPosition(PlayingTopic *playingTopic); - void avsFreestandingHack(bool freestanding, QWidget *projectionWidget, QWidget **parentForScreen); - void avsVisibilityHack(QWidget *parentForScreen, bool visible); - void stop(bool ended = false, bool ignoreFireEventFlashing = false); - void changelogCheck(); - int previousTopicTime() const; - bool hasPreviousTopic() const { return previousTopicTime() > -1; } - int nextTopicTime() const; - bool hasNextTopic() const { return nextTopicTime() > -1; } - void setPositionTime(int positionTime, bool setByUser = false); - void setPositionTimeActive(int positionTime, bool setByUser = false); - - - template - std::shared_ptr getTopicEditorIfc(LtsScriptTimeline::TrackEntryType trackEntryType) - { - std::shared_ptr topicEditorIfc; - - if (!m_exerciseSession->interfaceFromGui(topicEditorIfc)) - { - ERROR_LOG(m_logger) << "getTopicEditorIfc failed: Cannot add topic type " - << LtsScriptTimeline::trackEntryTypeName(trackEntryType) - << " because topic editor ifc is missing."; - return nullptr; - } - - return topicEditorIfc; - } - - - template - std::shared_ptr getTopicReplayFactory(LtsScriptTimeline::TrackEntryType trackEntryType) - { - std::shared_ptr topicReplayFactory; - - if (!m_replaySession->interfaceFromGui(topicReplayFactory)) - { - ERROR_LOG(m_logger) << "getTopicIfcFactory failed: Cannot add topic type " - << LtsScriptTimeline::trackEntryTypeName(trackEntryType) - << " because topic ifc factory is missing."; - return nullptr; - } - - return topicReplayFactory; - } - - - template - bool tryAddTopic(LtsScriptTimeline::TrackEntryType trackEntryType, - QStringList &resultList, - const SpecialTopicType &specialTopicType = SpecialTopicType::NonSpecial) - { - std::shared_ptr topicEditorIfc; - std::shared_ptr topicReplayFactory; - std::shared_ptr topicExportFactory; - - if (!std::is_same::value) - { - topicEditorIfc = getTopicEditorIfc(trackEntryType); - - if (topicEditorIfc == nullptr) - { - resultList.append(LtsScriptTimeline::trackEntryTypeName(trackEntryType)); - return false; - } - } - - if (!std::is_same::value) - { - topicReplayFactory = getTopicReplayFactory(trackEntryType); - - if (topicReplayFactory == nullptr) - { - resultList.append(LtsScriptTimeline::trackEntryTypeName(trackEntryType)); - return false; - } - } - - if (!std::is_same::value) - { - topicExportFactory = getTopicReplayFactory(trackEntryType); - - if (topicExportFactory == nullptr) - { - resultList.append(LtsScriptTimeline::trackEntryTypeName(trackEntryType)); - return false; - } - } - else - topicExportFactory = topicReplayFactory; - - return _tryAddTopic(trackEntryType, topicEditorIfc, topicReplayFactory, topicExportFactory, resultList, specialTopicType); - } - - - Ui::ScriptDialog *m_ui; - LtsSession::LtsSession *m_essentialsViewSession; - std::shared_ptr m_essentialsViewsSrpGuiIfc; - std::shared_ptr m_dtc; - std::shared_ptr m_ftc; - std::shared_ptr m_srmForeign; - std::shared_ptr m_coreDtc; - std::shared_ptr m_opmDtc; - QString m_menuGroup; - LtsUtils::RequestHelper *m_requestHelper; - int m_selectedTeId; - TopicEditorBase::TopicEditor *m_currentTopicEditor; - int m_scriptId; - QMap m_trackEntryAssignments; - QMap m_trackEntryToTopicAssignment; - LtsPluginManager::LtsPluginManager *m_essentialsViewApp; - QString m_scriptName; - QString m_scriptOwner; - qint64 m_lastModified = 0; - QVector m_topicVector; - QMultiMap m_topicMap; - QVector m_filterTopicVector; - TakeHomePackageGenerator::ExportProcess *m_exportProcess; - LtsSession::LtsSession *m_exerciseSession; - LtsSession::LtsSession *m_replaySession; - QTimer *m_presentationTimer; - int m_lowestTime; - int m_highestTime; - int m_positionTime; - int m_duration; - int m_nextPauseTime; - QVector m_currentlyPlayingTopics; - Screen *m_projectionWidget1; - Screen *m_projectionWidget2; - MainJournal m_journal; - int m_scriptsExerciseId; - QString m_exerciseName; - LtsPluginManager::LtsPluginManager *m_sitMapApp; - LtsSession::LtsSession *m_sitMapSession; - bool m_currentlyFreestandingTopicsScreen1; - bool m_currentlyFreestandingTopicsScreen2; - TopicReplay::Interface *m_sitMapTopicIfc; - bool m_firstPlayAfterStop; - bool m_enableApply; - bool m_stopAfterPlayingFilterTopic; - QWidget *m_previousParentForScreen1; - QWidget *m_previousParentForScreen2; - int m_ignoreTopicForReplay; - QPointer m_currentTopicDesigner; - bool m_avsVisibilityHackActive; - QPointer m_storyboardDialog; - bool m_ignoreChanges; - bool m_scriptRunning; - bool m_bTimerTickRecursionGuard; - bool m_isPlayTopicMethodStillRunning; -private slots: - void slotEditEntry(const int topicId); - void slotTrackEntrySelectionChanged(LtsScriptTimeline::TrackEntry *); - void slotChangesWereMade(); - void slotTrackEntryModified(); - void slotNull(QObject *obj); - void slotDiscard(); - void slotStartEssentialsView(); - void slotLoadScript(); - void slotExportScript(); - void slotExportSuccessful(const QString &path, const QString &failedTopics); - void slotBurnDvD(const QString &strExportPath); - void slotBurningFinished(bool success); - void slotPlay(); - void slotPause(); - void slotStop(); - void slotTimerTick(); - void slotShowStoryboard(); - void slotShowJournal(); - void slotToNextTopic(); - void slotToPreviousTopic(); - void slotPlayUntilNextTopic(); - void slotSetTopicPosition(QWidget *previewWidget, int ignoreTopicForReplay); - void slotTrackEntryDeleted(const int topicId); - void slotEditSelectedEntry(); - void slotCheckNewTopicLength(int newLength, LtsUtils::Promise *promise); - void slotAddFakeLegacyPlanTopic(); - - void slotChangesMade(); -}; - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_script_dialog.ui b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_script_dialog.ui deleted file mode 100755 index 04303c1a0..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_script_dialog.ui +++ /dev/null @@ -1,320 +0,0 @@ - - - ScriptDialog - - - - 0 - 0 - 1010 - 587 - - - - - 0 - 0 - - - - Script Editor - - - - 0 - - - 9 - - - 9 - - - 9 - - - 9 - - - - - - 0 - 0 - - - - - - - - Replay Controls - - - true - - - - - - - - - - - - - - - false - - - Set Screen 1 - - - - - - - false - - - Set Screen 2 - - - - - - - - - false - - - Stop - - - - - - - false - - - Pause - - - - - - - false - - - Play - - - - - - - - - - - Play Until Next Topic - - - - - - - Previous Topic - - - - - - - Next Topic - - - - - - - - - - - 9 - - - 9 - - - 9 - - - 9 - - - 9 - - - 9 - - - - - Presentation duration: - - - - - - - - - - - - - - - Pos: - - - - - - - false - - - - 0 - 0 - - - - Qt::Horizontal - - - QSlider::TicksBelow - - - true - - - - - - - Current position: - - - - - - - - - 0 - - - - - - - / - - - - - - - 0 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - - Status: - - - - - - - - 0 - 0 - - - - QAbstractScrollArea::AdjustToContentsOnFirstShow - - - QAbstractItemView::NoEditTriggers - - - false - - - true - - - QAbstractItemView::NoSelection - - - QAbstractItemView::ScrollPerPixel - - - QListView::Free - - - false - - - - - - - - - - - - - - - - LtsScriptTimeline::ScriptTimeline - QWidget -
LtsScriptTimeline/script_timeline.h
- 1 -
-
- - -
diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_script_gui_plugin.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_script_gui_plugin.cpp deleted file mode 100755 index 5cd372f5f..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_script_gui_plugin.cpp +++ /dev/null @@ -1,369 +0,0 @@ - - - -#include "pre_script_gui_plugin.h" -#include "pre_script_dialog.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - - -namespace PresentationManagement -{ -std::shared_ptr GuiPlugin::createGuiInterface(LtsSession::LtsSession *session) -{ - return std::make_shared(session); -} - - -InterfaceImpl::InterfaceImpl(LtsSession::LtsSession *session) - : GuiPluginBase::Interface(session, getLogger("Plugins.Gui.Pre.Script")) - , m_dtc(nullptr) - , m_opmDtc(nullptr) - , m_ftc(nullptr) - , m_repForeign(nullptr) - , m_scriptDialog(nullptr) - , m_scriptId(0) - , m_requestHelper(new LtsUtils::RequestHelper(this)) -{ - connect(this, &InterfaceImpl::signalSuccess, m_session, &LtsSession::LtsSession::slotExecuteNextPayload, Qt::QueuedConnection); -} - - -QVector InterfaceImpl::getActions() -{ - QVector ret; - { - LtsWidgets::PluginData data; - data.menuGroup = menuGroup(); - data.identifier = QStringLiteral("PresentationManagement.ScriptDialog"); - data.menuText = tr("Show Script Editor"); - - if (getFlags().testFlag(LtsAppDescriptor::PluginInfo::Flag::MAIN)) - { - data.layoutArea = LtsWidgets::LayoutArea::eMainTab; - data.createInstant = LtsWidgets::CreateInstantType::CreateInstantAndDiscardAction; - data.closable = false; - } - else - { - data.layoutArea = LtsWidgets::LayoutArea::eDialogTab; - } - data.operatorRight = OperatorRights::ScriptEditorShow; - data.createWidgetFunc = [this](QWidget *parent) - { - return onShowScriptDialog(parent); - }; - - ret.append(data); - } - - { - LtsWidgets::PluginData data; - data.menuGroup = menuGroup(); - data.identifier = QLatin1String("PresentationManagement.ScriptDialog.ImportScript"); - data.menuIcon = QIcon(QLatin1String("icon:import_documents.svg")); - data.menuText = tr("Insert Script"); - data.operatorRight = OperatorRights::ScriptEditorEdit; - data.directFunc = [this](const LtsWidgets::PluginData &) - { - return onImportScript(); - }; - data.createWidgetFunc = nullptr; - - ret.append(data); - } - - return ret; -} - - -bool InterfaceImpl::fetchInterfaces() -{ - if (!m_session->getDtc(m_dtc)) - { - DEBUG_LOG(m_logger) << "getDtc for PresentationManagement::DataInterface failed."; - return false; - } - if (!m_session->getFtc(m_ftc)) - { - DEBUG_LOG(m_logger) << "getFtc for PresentationManagement::DataInterface failed."; - return false; - } - if (!m_session->getDtc(m_opmDtc)) - { - DEBUG_LOG(m_logger) << "getDtc for OperatorManagement::DataInterface failed."; - return false; - } - if (!m_session->getDtc(m_coreDtc)) - { - DEBUG_LOG(m_logger) << "getDtc for SituationReplayManagement::DataInterface failed."; - return false; - } - if (!m_session->getForeignDataInterface(m_repForeign)) - { - WARNING_LOG(m_logger) << "getForeignDataInterface for SituationReplayManagement::DataInterface failed."; - return false; - } - - return true; -} - - -void InterfaceImpl::clearInterfaces() -{ - m_repForeign = nullptr; - m_coreDtc = nullptr; - m_opmDtc = nullptr; - m_ftc = nullptr; - m_dtc = nullptr; -} - - -QString InterfaceImpl::menuGroup() const -{ - return tr("Presentation"); -} - - -LtsWidgets::LtsDialog *InterfaceImpl::onShowScriptDialog(QWidget *parent) -{ - m_scriptDialog = new ScriptDialog(menuGroup(), parent); - - if (!m_scriptDialog->init(m_session, m_scriptId, m_dtc, m_ftc, m_repForeign, m_coreDtc, m_opmDtc)) - { - m_scriptDialog->deleteLater(); - m_scriptDialog = nullptr; - - - emit m_session->signalClose(); - } - - return m_scriptDialog.data(); -} - - -void InterfaceImpl::onImportScript() -{ - ScriptChooser *scriptChooser = new ScriptChooser(m_dtc, m_opmDtc, false, true); - scriptChooser->setAttribute(Qt::WA_DeleteOnClose); - - connect(scriptChooser, &ScriptChooser::signalSelectScript, - this, &InterfaceImpl::slotImportScript, Qt::QueuedConnection); - - connect(scriptChooser, &ScriptChooser::signalQuit, - m_session, &LtsSession::LtsSession::signalQuit); - - if (!LtsSessionData::LtsSessionData::getInstance()->isTablet()) - scriptChooser->setModal(true); - scriptChooser->show(); -} - - -void InterfaceImpl::slotNewScript() -{ - - PresentationModifyRequest req; - req.name(tr("New Script").toStdString()); - req.description(tr("No description available.").toStdString()); - req.operatorId(LtsSessionData::LtsSessionData::getInstance()->getOperatorId()); - req.lastModified(QDateTime::currentMSecsSinceEpoch()); - req.fileStatus(FileStatus::Valid); - - if (m_requestHelper->startSingleRequest([this, req]() - { - return m_ftc->presentationModifyRequest(req, this); -})) - { - - } -} - - -void InterfaceImpl::slotAddScript() -{ - PresentationEditDialog *dialog = new PresentationEditDialog(nullptr); - if (!dialog->init(-1 , m_dtc, m_ftc, m_opmDtc)) - { - delete dialog; - return; - } - - QObject::connect(dialog, &PresentationEditDialog::rejected, dialog, &PresentationEditDialog::deleteLater); - - dialog->show(); -} - - -void InterfaceImpl::executePayload(LtsWidgets::LtsBackgroundWidget *mainBackground) -{ - Q_UNUSED(mainBackground); - - if (m_session->partitionType() != IDL::PartitionType::Exercise) - { - emit signalSuccess(); - return; - } - - int scriptId = m_session->getSavegame()[QStringLiteral("ScriptId")].toInt(); - if (scriptId > 0) - { - slotSelectScript(scriptId); - return; - } - - ScriptChooser *scriptChooser = new ScriptChooser(m_dtc, m_opmDtc, false, false, mainBackground); - scriptChooser->setAttribute(Qt::WA_DeleteOnClose); - - connect(scriptChooser, &ScriptChooser::signalSelectScript, - this, &InterfaceImpl::slotSelectScript, Qt::QueuedConnection); - - connect(scriptChooser, &ScriptChooser::signalQuit, - m_session, &LtsSession::LtsSession::signalQuit); - - connect(scriptChooser, &ScriptChooser::signalNewScript, - this, &InterfaceImpl::slotAddScript); - - if (!LtsSessionData::LtsSessionData::getInstance()->isTablet()) - scriptChooser->setModal(true); - - scriptChooser->show(); -} - - -void InterfaceImpl::slotSelectScript(int scriptId) -{ - m_scriptId = scriptId; - - - - - - - - - - - - emit signalSuccess(); -} - - -void InterfaceImpl::slotImportScript(int scriptId) -{ - if (m_scriptId == scriptId) - { - ERROR_LOG(m_logger) << "Not possible to import same script!"; - LtsWidgets::LtsMessageDialog::showMessage(m_session->baseLayout(), tr("Not possible to import same script!")); - return; - } - - if (!importScript(scriptId)) - { - ERROR_LOG(m_logger) << "Failed to import script Id " << scriptId; - LtsWidgets::LtsMessageDialog::showMessage(m_session->baseLayout(), tr("Failed to import Script Id %1").arg(scriptId)); - return; - } - - DEBUG_LOG(m_logger) << "Succesfully imported script Id " << scriptId ; - - -} - - -bool InterfaceImpl::importScript(int idSource) -{ - if (!m_scriptDialog) - { - ERROR_LOG(m_logger) << "no script dialog open for import script"; - return false; - } - - PresentationManagement::Presentation preSource = m_dtc->presentation(idSource); - - if (preSource.id() < 1) - return false; - - - std::function importPresentationContent = [&](const Core::FunctionReply &baseReply) - { - const GetPresentationContentReply &reply = static_cast(baseReply); - const auto &contentList = reply.content(); - - if (contentList.size() < 1) - { - ERROR_LOG(m_logger) << "No Presentation Content for Script Id " << reply.id(); - return; - } - - LtsScriptTimeline::TemporaryPointerVector importedTes; - - for (const PresentationManagement::PresentationContent &content : contentList) - { - LtsScriptTimeline::TrackEntryType tet = LtsScriptTimeline::TrackEntryType::INVALID; - - if (!m_scriptDialog->topicStringToType(QString::fromStdString(content.presentationTopicType()), tet)) - { - ERROR_LOG(m_logger) << "Topic ignored - invalid topic type for presentation's content id " << content.id(); - continue; - } - - importedTes.append(ScriptDialog::trackEntryFromContent(content, 0, tet)); - } - - if (m_scriptDialog->importTrackEntries(importedTes)) - importedTes.setDiscardable(false); - }; - - - GetPresentationContentRequest req(idSource); - req.presentationId(idSource); - - if (!m_requestHelper->startSingleRequest([req, this]() - { - return m_ftc->getPresentationContentRequest(req, this); - }, importPresentationContent)) - { - LtsWidgets::LtsMessageDialog::showMessage(m_session->baseLayout(), tr("There is no content to import for this script.")); - return false; - } - - return true; -} - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_script_gui_plugin.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_script_gui_plugin.h deleted file mode 100755 index 15945fafd..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_script_gui_plugin.h +++ /dev/null @@ -1,93 +0,0 @@ - - - -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#include -#include "pre_script_dialog.h" -#include -#include -#include -#include - - -namespace PresentationManagement -{ -class GuiPlugin final : public QObject, public GuiPluginBase::Plugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID "gui:3:pre.script.edit") - Q_INTERFACES(GuiPluginBase::Plugin) - -public: - explicit GuiPlugin() = default; - ~GuiPlugin() = default; - - QString pluginName() override { return ForeignScriptDialogGuiInterface::pluginName(); } - std::shared_ptr createGuiInterface(LtsSession::LtsSession *session) override; - bool availableInPartition(IDL::PartitionType partition) const override - { return (partition == IDL::PartitionType::Exercise); } -}; - - -class InterfaceImpl final : public QObject, public GuiPluginBase::Interface - , protected PresentationManagement::Interface::Ftc::PresentationModifyReplyHandler - , protected PresentationManagement::Interface::Ftc::GetPresentationContentReplyHandler -{ - Q_OBJECT - -public: - explicit InterfaceImpl(LtsSession::LtsSession *session); - - QVector getActions() override; - QString menuGroup() const override; - bool fetchInterfaces() override; - void clearInterfaces() override; - bool availableInPartition(IDL::PartitionType partition) const override - { return partition == IDL::PartitionType::Exercise; } - - - int executionPriority() const override { return 9999; } - void executePayload(LtsWidgets::LtsBackgroundWidget *mainBackground) override; - -protected: - void onPresentationModifyReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); } - void onGetPresentationContentReply(const GetPresentationContentReply &reply) override { m_requestHelper->requestReply(reply); } - -private: - LtsWidgets::LtsDialog *onShowScriptDialog(QWidget *parent); - void onImportScript(); - bool importScript(int idSource); - - std::shared_ptr m_dtc; - std::shared_ptr m_opmDtc; - std::shared_ptr m_ftc; - std::shared_ptr m_repForeign; - std::shared_ptr m_coreDtc; - - QPointer m_scriptDialog; - int m_scriptId; - LtsUtils::RequestHelper *m_requestHelper; - -signals: - void signalSuccess(); - -private slots: - void slotSelectScript(int scriptId); - void slotNewScript(); - void slotImportScript(int scriptId); - void slotAddScript(); -}; - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_storyboard.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_storyboard.cpp deleted file mode 100755 index 292b6df5d..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_storyboard.cpp +++ /dev/null @@ -1,153 +0,0 @@ -#include "pre_storyboard.h" -#include -#include "ui_pre_storyboard.h" - -#include -#include -#include - -using namespace LtsScriptTimeline; - - -namespace PresentationManagement -{ - -StoryboardDialog::StoryboardDialog(QWidget *parent, LtsSession::LtsSession *session) - : LtsWidgets::LtsDialog(parent) - , m_ui(new Ui::StoryboardDialog) - , m_session(session) - , m_alreadyTranslated(false) -{ - m_ui->setupUi(this); - m_buttonBox->connectButton(LtsWidgets::DialogButton::Print, this, &StoryboardDialog::slotPrint); -} - - -StoryboardDialog::~StoryboardDialog() -{ - delete m_ui; -} - - -void StoryboardDialog::slotPrint() -{ - QString headingHtml = (QStringLiteral("

")); - headingHtml.append (tr("Scriptname:")); - headingHtml.append(m_scriptName); - headingHtml.append(QStringLiteral("

")); - headingHtml.append(QStringLiteral("

")); - headingHtml.append(tr("Script Owner: ")); - headingHtml.append(m_scriptOwner); - headingHtml.append(QStringLiteral("

")); - headingHtml.append(QStringLiteral("

")); - headingHtml.append(tr("Last modified: ")); - headingHtml.append(DTG::toStringMSec(m_lastModified)); - headingHtml.append(QStringLiteral("
")); - headingHtml.append(tr("Duration: ")); - QString durationStr = m_duration; - headingHtml.append(durationStr); - headingHtml.append(QStringLiteral("


")); - - LtsPrinting::printView(m_session, this, m_ui->listWidget, headingHtml); -} - - -bool StoryboardDialog::init(const QVector &topicVector, - const QVector &filterTopicVector, - const QString &scriptName, - const QString &scriptOwner, - const qint64 lastModified, - const QString duration) -{ - m_topicVector = topicVector; - m_filterTopicVector = filterTopicVector; - m_scriptName = scriptName; - m_scriptOwner = scriptOwner; - m_lastModified = lastModified; - m_duration = duration; - - - std::sort(m_topicVector.begin(), m_topicVector.end(), [](const TrackEntry *a, const TrackEntry *b) -> bool - { - return a->m_startTime < b->m_startTime; - }); - - return true; -} - - -void StoryboardDialog::retranslate() -{ - translate(m_ui, tr("Script Storyboard")); - - if (m_alreadyTranslated) - return; - - fillStoryboard(); - m_alreadyTranslated = true; -} - - -void StoryboardDialog::fillStoryboard() -{ - m_ui->listWidget->clear(); - - QVector correspondingFilterTopics; - int ii1 = 1; - for (const LtsScriptTimeline::TrackEntry *te : std::as_const(m_topicVector)) - { - QString itemText = tr("Topic %1: %2 - %3 (%4 seconds)\n Type: %5").arg( - ii1).arg(QTime::fromMSecsSinceStartOfDay(te->m_startTime * 1000).toString(), - QTime::fromMSecsSinceStartOfDay((te->m_startTime + te->m_length) * 1000).toString()).arg( - te->m_length).arg(LtsScriptTimeline::translateTrackEntryType(te->m_type)); - - if (!te->m_description.isEmpty()) - itemText += QStringLiteral("\n ") + tr("Description: %1").arg(te->m_description); - - m_ui->listWidget->addItem(itemText); - - - - correspondingFilterTopics.clear(); - for (const FilterTopic &_ft : std::as_const(m_filterTopicVector)) - { - if (_ft.mainTopicId != te->m_topicId) - continue; - - correspondingFilterTopics.append(_ft); - } - - - - std::sort(correspondingFilterTopics.begin(), correspondingFilterTopics.end(), [](const FilterTopic &a, const FilterTopic &b) -> bool - { - return a.filterTopic->m_startTime < b.filterTopic->m_startTime; - }); - - - int ii2 = 1; - for (const FilterTopic &_ft : std::as_const(correspondingFilterTopics)) - { - if (_ft.mainTopicId != te->m_topicId) - continue; - - const LtsScriptTimeline::TrackEntry *fte = _ft.filterTopic; - - QString filterItemText = tr(" > Filter %1: %2 - %3 (%4 seconds)\n Type: %5").arg( - ii2).arg(QTime::fromMSecsSinceStartOfDay(fte->m_startTime * 1000).toString(), - QTime::fromMSecsSinceStartOfDay((fte->m_startTime + te->m_length) * 1000).toString()).arg( - fte->m_length).arg(LtsScriptTimeline::translateTrackEntryType(te->m_type)); - - if (!fte->m_description.isEmpty()) - filterItemText += QStringLiteral("\n ") + tr("Description: %1").arg(fte->m_description); - - m_ui->listWidget->addItem(filterItemText); - - ii2++; - } - - ii1++; - } -} - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_storyboard.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_storyboard.h deleted file mode 100755 index 522c4d952..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_storyboard.h +++ /dev/null @@ -1,50 +0,0 @@ -#pragma once - -#include "filter_topic.h" - -#include -#include -#include - -#include - - -namespace Ui -{ -class StoryboardDialog; -} - -namespace PresentationManagement -{ - -class StoryboardDialog : public LtsWidgets::LtsDialog -{ - Q_OBJECT -public: - StoryboardDialog(QWidget *parent, LtsSession::LtsSession *session); - ~StoryboardDialog(); - bool init(const QVector &topicVector, - const QVector &filterTopicVector, - const QString &scriptName, - const QString &scriptOwner, - const qint64 lastModified, - const QString duration); - void fillStoryboard(); - void retranslate() override final; - -private: - Ui::StoryboardDialog *m_ui; - QVector m_topicVector; - QVector m_filterTopicVector; - LtsSession::LtsSession *m_session; - QString m_scriptName = QString(); - QString m_scriptOwner = QString(); - qint64 m_lastModified = 0; - QString m_duration = QString(); - bool m_alreadyTranslated; - -public slots: - void slotPrint(); -}; - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_storyboard.ui b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_storyboard.ui deleted file mode 100755 index f3189fd83..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_storyboard.ui +++ /dev/null @@ -1,49 +0,0 @@ - - - StoryboardDialog - - - - 0 - 0 - 707 - 464 - - - - - 0 - 0 - - - - Script Editor - - - - 9 - - - 9 - - - 9 - - - 9 - - - 9 - - - - - true - - - - - - - - diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_topic_designer_dialog.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_topic_designer_dialog.cpp deleted file mode 100755 index e9b4ced2e..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_topic_designer_dialog.cpp +++ /dev/null @@ -1,62 +0,0 @@ - - - -#include "pre_topic_designer_dialog.h" -#include "ui_pre_topic_designer_dialog.h" - - -namespace PresentationManagement -{ - -TopicDesignerDialog::TopicDesignerDialog(QWidget *parent) - : LtsDialog(parent) - , m_ui(new Ui::TopicDesignerDialog) -{ - m_ui->setupUi(this); - setFocusPolicy(Qt::StrongFocus); - - connect(m_ui->widget, &TopicDesigner::signalTopicSelected, - this, &TopicDesignerDialog::signalTopicSelected); - connect(m_ui->widget, &TopicDesigner::signalDeleteTrackEntry, - this, &TopicDesignerDialog::signalDeleteTrackEntry); - connect(m_ui->widget, &TopicDesigner::signalUnselect, - this, &TopicDesignerDialog::signalUnselect); - connect(m_ui->widget, &TopicDesigner::signalChangesMade, - this, &LtsWidgets::LtsDialog::signalChangesMade); - - - -} - - -void TopicDesignerDialog::retranslate() -{ - translate(m_ui, tr("Topic Designer")); -} - - -TopicDesignerDialog::~TopicDesignerDialog() -{ - delete m_ui; -} - - -QVector TopicDesignerDialog::exportTopicList() const -{ - return m_ui->widget->exportTopicList(); -} - - -void TopicDesignerDialog::selectTopic(int topicId) -{ - m_ui->widget->selectTopic(topicId); -} - - -void TopicDesignerDialog::loadTopicList(const QVector &topicsList) -{ - m_ui->widget->loadTopicList(topicsList); -} - -} - diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_topic_designer_dialog.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_topic_designer_dialog.h deleted file mode 100755 index 8dbdb1c35..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_topic_designer_dialog.h +++ /dev/null @@ -1,50 +0,0 @@ - - - -#pragma once - -#include - -#include - - -namespace Ui -{ -class TopicDesignerDialog; -} - -namespace LtsScriptTimeline -{ -class TrackEntry; -} - - -namespace PresentationManagement -{ - -class TopicDesignerDialog : public LtsWidgets::LtsDialog -{ -public: - Q_OBJECT - -public: - explicit TopicDesignerDialog(QWidget *parent = nullptr); - ~TopicDesignerDialog(); - - void loadTopicList(const QVector &topicsList); - QVector exportTopicList() const; - void selectTopic(int topicId); - -signals: - void signalTopicSelected(int topicId); - void signalDeleteTrackEntry(int topicId); - void signalUnselect(); - -private: - void retranslate() override; - - Ui::TopicDesignerDialog *m_ui; - -}; - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_topic_designer_dialog.ui b/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_topic_designer_dialog.ui deleted file mode 100755 index c0c57548d..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/PresentationManagement/Gui/Script/ScriptEditor/pre_topic_designer_dialog.ui +++ /dev/null @@ -1,122 +0,0 @@ - - - TopicDesignerDialog - - - - 0 - 0 - 600 - 338 - - - - - 0 - 0 - - - - Script Editor - - - - 0 - - - 9 - - - 9 - - - 9 - - - 9 - - - - - Some text - - - - - - - - - - - To Front - - - - - - - Inc Idx - - - - - - - Dec Idx - - - - - - - To Back - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - 0 - 0 - - - - - 0 - 300 - - - - - - - - - - - PresentationManagement::TopicDesigner - QWidget -
topic_designer.h
- 1 -
-
- - -
diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/ServiceManagement/CMakeLists.txt b/qt6-after/qt6-migrated-legatus/Lts/Plugins/ServiceManagement/CMakeLists.txt deleted file mode 100755 index a15c4a5c6..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/ServiceManagement/CMakeLists.txt +++ /dev/null @@ -1,28 +0,0 @@ -# -# $Id$ -# $HeadURL$ -# $Author$ -# Created by Mike Wille, SLSE, 2016-03-30 -# - -ADD_SUBDIRECTORY(Data) -ADD_SUBDIRECTORY(Gui) - -# -# Gui Plugin Interface -# -ADD_INTERFACE_LIBRARY(ScmGuiPluginInterface - ${CMAKE_CURRENT_SOURCE_DIR}/scm_gui_plugin_interface.h - ${CMAKE_CURRENT_SOURCE_DIR}/.. - GuiPluginInterface -) - -# -# Data Plugin Interface -# -ADD_INTERFACE_LIBRARY(ScmDataPluginInterface - ${CMAKE_CURRENT_SOURCE_DIR}/scm_data_plugin_interface.h - ${CMAKE_CURRENT_SOURCE_DIR}/.. - DataPluginInterface - svcScmCommon -) diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/ServiceManagement/Data/CMakeLists.txt b/qt6-after/qt6-migrated-legatus/Lts/Plugins/ServiceManagement/Data/CMakeLists.txt deleted file mode 100755 index 9b74c5384..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/ServiceManagement/Data/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# -# $Id$ -# $HeadURL$ -# $Author$ -# Created by Mike Wille, SLSE, 2016-09-06 -# - -# -# Data Plugin -# -NGL_ADD_LIBRARY(WS ScmDataPlugin MODULE scm_data_plugin.cpp scm_data_plugin.h) -set_target_properties(ScmDataPlugin PROPERTIES AUTOMOC ON) -NGL_TARGET_LINK_LIBRARIES(ScmDataPlugin - Qt6::Core - ScmDataPluginInterface - svcScmClient - NGLLogger - LtsSessionDataDds -) -NGL_INSTALL_TARGET(ScmDataPlugin) diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/ServiceManagement/Data/scm_data_plugin.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/ServiceManagement/Data/scm_data_plugin.cpp deleted file mode 100755 index d343471b5..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/ServiceManagement/Data/scm_data_plugin.cpp +++ /dev/null @@ -1,27 +0,0 @@ - - - -#include "scm_data_plugin.h" - -#include -#include - -namespace ServiceManagement -{ -std::shared_ptr DataPlugin::createDataInterface(LtsSession::LtsSessionDataDds *session) -{ - std::shared_ptr dtc; - std::shared_ptr ftc; - if (!session->createTopicClient(dtc, ftc, false ,true)) - return std::shared_ptr(); - return std::make_shared(dtc, ftc); -} - -DataInterfaceImpl::DataInterfaceImpl(const std::shared_ptr &dtc, - const std::shared_ptr &ftc) - : DataInterface() - , m_dtc(dtc) - , m_ftc(ftc) -{} - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/ServiceManagement/Data/scm_data_plugin.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/ServiceManagement/Data/scm_data_plugin.h deleted file mode 100755 index a1ef245e1..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/ServiceManagement/Data/scm_data_plugin.h +++ /dev/null @@ -1,45 +0,0 @@ - - - -#pragma once - -#include - - -namespace ServiceManagement -{ - -class DataPlugin final : public DataPluginBase::Plugin -{ - Q_PLUGIN_METADATA(IID "data:3:scm") - - Q_OBJECT -public: - DataPlugin() = default; - ~DataPlugin() = default; - - QString pluginName() const override { return QStringLiteral("ServiceManagement"); } - std::shared_ptr createDataInterface(LtsSession::LtsSessionDataDds *session) override; - bool availableInPartition(IDL::PartitionType partition) const override - { - return partition == IDL::PartitionType::Global; - } -}; - - -class DataInterfaceImpl final : public DataInterface -{ -public: - explicit DataInterfaceImpl(const std::shared_ptr &dtc, - const std::shared_ptr &ftc); - - std::shared_ptr getDtc() override { return m_dtc; } - std::shared_ptr getFtc() override { return m_ftc; } - -private: - std::shared_ptr m_dtc; - std::shared_ptr m_ftc; -}; - - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/ServiceManagement/Gui/CMakeLists.txt b/qt6-after/qt6-migrated-legatus/Lts/Plugins/ServiceManagement/Gui/CMakeLists.txt deleted file mode 100755 index 9e1a1f77e..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/ServiceManagement/Gui/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -# -# $Id$ -# $HeadURL$ -# $Author$ -# Created by Mike Wille, SLSE, 2016-03-30 -# - -ADD_SUBDIRECTORY(ServiceEdit) diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/ServiceManagement/Gui/ServiceEdit/CMakeLists.txt b/qt6-after/qt6-migrated-legatus/Lts/Plugins/ServiceManagement/Gui/ServiceEdit/CMakeLists.txt deleted file mode 100755 index 7654354f0..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/ServiceManagement/Gui/ServiceEdit/CMakeLists.txt +++ /dev/null @@ -1,48 +0,0 @@ -# -# $Id$ -# $HeadURL$ -# $Author$ -# Created by Mike Wille, SLSE, 2016-03-30 -# - -# Make ${Qt6_Widgets} optional -if(QT6_GUI_AVAILABLE AND TARGET Qt6::Widgets) - set(Qt6_Widgets ${Qt6_Widgets}) -else() - set(Qt6_Widgets "") -endif() - - -SET(scm_edit_gui_SRCS - scm_edit_gui_plugin.cpp - scm_edit_gui_plugin.h - scm_dialog.cpp - scm_dialog.h - scm_dialog_service.cpp - scm_dialog_service.h - scm_dialog_group.cpp - scm_dialog_group.h -) - -NGL_WRAP_UI(scm_edit_gui_SRCS - scm_dialog.ui - scm_dialog_service.ui - scm_dialog_group.ui -) - -NGL_ADD_LIBRARY(WS ScmEditGuiPlugin MODULE ${scm_edit_gui_SRCS}) -if(QT6_GUI_AVAILABLE) - NGL_TARGET_LINK_LIBRARIES(ScmEditGuiPlugin - NGLLogger - ScmGuiPluginInterface - ScmDataPluginInterface - LtsSession - ${Qt6_Widgets} - LtsWidgets - LtsUtilsGuiDds - svcScmCommon - svcExmClient - ) -endif() - -NGL_INSTALL_TARGET(ScmEditGuiPlugin) diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/ServiceManagement/Gui/ServiceEdit/scm_dialog.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/ServiceManagement/Gui/ServiceEdit/scm_dialog.cpp deleted file mode 100755 index 1d63e1d0d..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/ServiceManagement/Gui/ServiceEdit/scm_dialog.cpp +++ /dev/null @@ -1,358 +0,0 @@ - - - - -#include "scm_dialog.h" -#include "ui_scm_dialog.h" - -#include "scm_dialog_group.h" -#include "scm_dialog_service.h" - -#include - -#include - - -namespace ServiceManagement -{ - - - -ServiceManagementDialog::ServiceManagementDialog(QWidget *parent) - : LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::CloseOnly) - , m_requestHelper(new LtsUtils::RequestHelper(this)) - , m_ui(new Ui::ServiceManagementDialog) - , m_dtcExm(nullptr) - , m_dtc(nullptr) - , m_ftc(nullptr) -{ - m_ui->setupUi(this); - - - m_ui->lbGroupsIndicator->hide(); - m_ui->lbExercise->hide(); - m_ui->lbServer->hide(); - m_ui->cbServer->hide(); - m_ui->cbExercise->hide(); - - setOnlineHelpFilename(QStringLiteral("Administrator-Service_Management")); -} - -ServiceManagementDialog::~ServiceManagementDialog() -{ - delete m_ui; -} - - -void ServiceManagementDialog::retranslate() -{ - translate(m_ui, tr("Service Management")); -} - - -bool ServiceManagementDialog::init(const std::shared_ptr &dtc, - const std::shared_ptr &ftc, - const std::shared_ptr &dtcExm) -{ - m_dtc = dtc; - m_ftc = ftc; - m_dtcExm = dtcExm; - - connect(m_dtc.get(), &Interface::Dtc::groupInformationChanged, - this, &ServiceManagementDialog::slotGroupInformationChanged); - - connect(m_dtc.get(), &Interface::Dtc::serviceInformationChanged, - this, &ServiceManagementDialog::slotServiceInformationChanged); - - const QMap groupInfo = m_dtc->groupInformations(); - - if (groupInfo.isEmpty()) - { - INFO_LOG(m_logger) << "initModel - no groups!"; - return true; - } - - m_ui->lbNoServices->hide(); - - INFO_LOG(m_logger) << "initModel - #group information: " << groupInfo.size(); - - - - QVector servicesList; - for (const ServiceManagement::GroupInformation &gi : groupInfo) - { - - - const int server = gi.domainId(); - const int exercise = gi.exercisePartitionId(); - const int32_t replayPartitionId = gi.replayPartitionId(); - const QString groupName = groupEnumToGroupName(gi.type()); - long long timestamp = gi.timestamp(); - - servicesList.clear(); - servicesList.reserve(gi.services().size()); - for (auto service : gi.services()) - servicesList.append(service); - - addGroup(gi.type(), server, exercise, replayPartitionId, groupName, timestamp, servicesList); - } - - - - - auto cbSvc = [this](const ServiceManagement::ServiceInformation & svc) - { - addService(svc); - }; - m_dtc->serviceInformations(cbSvc); - - return true; -} - - -GroupWidget *ServiceManagementDialog::addGroup(const Core::ServiceGroupType &groupType, int server, int exercise, int32_t replayPartitionId, - const QString &groupName, long long timestamp, const QVector &servicesList) -{ - - - QString exName = QString::fromStdString(m_dtcExm.get()->exercise(exercise).name()); - GroupWidget *group = new GroupWidget(groupType, server, exercise, replayPartitionId, exName, timestamp, servicesList); - - QString groupObjectName = craftGroupName(server, exercise, groupName); - group->setObjectName(groupObjectName); - - - connect(group, &GroupWidget::signalRestartGroup, this, &ServiceManagementDialog::slotRestartGroup); - connect(group, &GroupWidget::signalStartGroup, this, &ServiceManagementDialog::slotStartGroup); - connect(group, &GroupWidget::signalStopGroup, this, &ServiceManagementDialog::slotStopGroup); - - QVBoxLayout *l = qobject_cast(m_ui->groupLayoutWidget->layout()); - if (!l) - WARNING_LOG(m_logger) << "ServiceManagementDialog::addGroup: group layout failed, cannot add group"; - else - l->addWidget(group, 0, Qt::AlignTop); - - return group; -} - - -void ServiceManagementDialog::slotRestartService(int serviceID) -{ - const RestartServiceRequest req(serviceID); - m_requestHelper->startSingleRequest([req, this]() - { - return m_ftc->restartServiceRequest(req, this); - }); -} - - -static int s_requestId = 0; -void ServiceManagementDialog::slotRestartGroup(const Core::ServiceGroupType &groupType, int exercise, int server, int32_t replayPartitionId) -{ - const GroupRequest req(groupType, - exercise, - server, - replayPartitionId, - ++s_requestId, - {}); - m_requestHelper->startSingleRequest([req, this]() - { - return m_ftc->restartGroupRequest(req, this); - }); -} - - -void ServiceManagementDialog::slotStartGroup(const Core::ServiceGroupType &groupType, int exercise, int server, int32_t replayPartitionId) -{ - const GroupRequest req(groupType, - exercise, - server, - replayPartitionId, - ++s_requestId, - {}); - m_requestHelper->startSingleRequest([req, this]() - { - return m_ftc->startGroupRequest(req, this); - }); -} - - -void ServiceManagementDialog::slotStopGroup(const Core::ServiceGroupType &groupType, int exercise, int server, int32_t replayPartitionId) -{ - const GroupRequest req(groupType, - exercise, - server, - replayPartitionId, - ++s_requestId, - {}); - m_requestHelper->startSingleRequest([req, this]() - { - return m_ftc->stopGroupRequest(req, this); - }); -} - - - -void ServiceManagementDialog::slotGroupInformationChanged(ServiceManagement::GroupInformation info, DataModification mod) -{ - - - - int server = info.domainId(); - int exercise = info.exercisePartitionId(); - int32_t replayPartitionId = info.replayPartitionId(); - QString groupName = groupEnumToGroupName(info.type()); - long long timestamp = info.timestamp(); - - QString findGroupName = craftGroupName(server, exercise, groupName); - - GroupWidget *gw = m_ui->groupLayoutWidget->findChild(findGroupName); - - if (!gw) - { - - - QVector servicesList; - servicesList.reserve(info.services().size()); - for (auto service : info.services()) - servicesList << service; - - m_ui->lbNoServices->hide(); - addGroup(info.type(), server, exercise, replayPartitionId, groupName, timestamp, servicesList); - } - else - { - switch (mod) - { - case DataModification::eAdded: - case DataModification::eModified: - { - - - m_ui->lbNoServices->hide(); - - gw->setType(info.type()); - gw->setServer(server); - gw->setExercise(exercise); - gw->setTimestamp(timestamp); - break; - } - - case DataModification::eRemoved: - { - - - if (m_ui->groupLayoutWidget->findChildren().isEmpty()) - m_ui->lbNoServices->show(); - - delete gw; - break; - } - } - } -} - - -void ServiceManagementDialog::addService(const ServiceManagement::ServiceInformation &svc) -{ - const int id = svc.id(); - const long long pid = svc.pid(); - const QString name(QString::fromStdString(svc.name())); - const Core::RunningState &state = svc.state(); - const QString errorString(QString::fromStdString(svc.errorString())); - - ServiceWidget *service = new ServiceWidget(id, pid, name, state, errorString); - service->setObjectName(QLatin1String("service.") + QString::number(id)); - connect(service, &ServiceWidget::signalRestartService, this, &ServiceManagementDialog::slotRestartService); - - - const auto groupList = findChildren(); - for (GroupWidget *gw : groupList) - gw->addService(service); -} - - - -void ServiceManagementDialog::slotServiceInformationChanged(ServiceManagement::ServiceInformation info, DataModification mod) -{ - - - - - int32_t serviceId = info.id(); - QString errorString = QString::fromStdString(info.errorString()); - QString serviceName = QString::fromStdString(info.name()); - long long pid = info.pid(); - const Core::RunningState &state = info.state(); - long long timestamp = info.timestamp(); - - QString findServiceName = QLatin1String("service.") + QString::number(serviceId); - - const auto serviceList = findChildren(findServiceName); - - if (serviceList.isEmpty() || mod == DataModification::eAdded) - { - - - addService(info); - } - - for (ServiceWidget *serviceWidget : serviceList) - { - switch (mod) - { - case DataModification::eModified: - { - - - serviceWidget->setErrorString(errorString); - serviceWidget->setName(serviceName); - serviceWidget->setPid(pid); - serviceWidget->setState(state); - serviceWidget->setTimestamp(timestamp); - - break; - } - - case DataModification::eRemoved: - { - - - delete serviceWidget; - serviceWidget = nullptr; - - break; - } - - default: - { - - break; - } - } - } - - - - const auto groupList = findChildren(); - for (GroupWidget *groupWidget : groupList) - groupWidget->checkStatus(); - -} - - - - -} - - - - - - - - - - - - diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/ServiceManagement/Gui/ServiceEdit/scm_dialog.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/ServiceManagement/Gui/ServiceEdit/scm_dialog.h deleted file mode 100755 index 1186968d7..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/ServiceManagement/Gui/ServiceEdit/scm_dialog.h +++ /dev/null @@ -1,94 +0,0 @@ - - - -#pragma once - -#include "scm_dialog_group.h" - -#include -#include -#include -#include -#include -#include - - -namespace Ui -{ -class ServiceManagementDialog; -} - -namespace ServiceManagement -{ - - - - -class ServiceManagementDialog : public LtsWidgets::LtsDialog - , protected ServiceManagement::Interface::Ftc::RestartServiceReplyHandler - , protected ServiceManagement::Interface::Ftc::RestartGroupReplyHandler - , protected ServiceManagement::Interface::Ftc::StartGroupReplyHandler - , protected ServiceManagement::Interface::Ftc::StopGroupReplyHandler -{ - Q_OBJECT - -public: - explicit ServiceManagementDialog(QWidget *parent = nullptr); - ~ServiceManagementDialog(); - - bool init(const std::shared_ptr &dtc, - const std::shared_ptr &ftc, - const std::shared_ptr &dtcExm); - - virtual void onRestartServiceReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); } - virtual void onRestartGroupReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); } - virtual void onStartGroupReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); } - virtual void onStopGroupReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); } - - - static QString groupEnumToGroupName(const Core::ServiceGroupType &type) - { - QMap groupNameMapping; - groupNameMapping.insert(QLatin1String("Master"), Core::ServiceGroupType_def::Master); - groupNameMapping.insert(QLatin1String("Core"), Core::ServiceGroupType_def::Core); - groupNameMapping.insert(QLatin1String("ExercisePreparation"), Core::ServiceGroupType_def::ExercisePreparation); - groupNameMapping.insert(QLatin1String("ExerciseExecution"), Core::ServiceGroupType_def::ExerciseExecution); - groupNameMapping.insert(QLatin1String("ExercisePaused"), Core::ServiceGroupType_def::ExercisePaused); - groupNameMapping.insert(QLatin1String("ExerciseAfterActionReview"), Core::ServiceGroupType_def::ExerciseAfterActionReview); - groupNameMapping.insert(QLatin1String("Playback"), Core::ServiceGroupType_def::Playback); - - return groupNameMapping.key(type.underlying()); - } - -private: - -NGL::INGLLogger &m_logger; - void retranslate() override; - - static QString craftBaseName(const QString &server, const QString &exercise) { return server + QLatin1Char('.') + exercise + QLatin1Char('.'); } - - GroupWidget *addGroup(const Core::ServiceGroupType &groupType, int server, int exercise, int32_t replayPartitionId, - const QString &groupName, long long timestamp, const QVector &servicesList); - void addService(const ServiceInformation &svc); - - LtsUtils::RequestHelper *m_requestHelper; - -public: - static QString craftGroupName(int server, int exercise, const QString &groupName) { return craftBaseName(QString::number(server), QString::number(exercise)) + groupName; } - static QString craftServiceName(int server, int exercise, const QString &groupName, int serviceId) { return craftGroupName(server, exercise, groupName) + QLatin1Char('.') + QString::number(serviceId); } - static QString craftWildcardedServiceName(int serviceId) { return craftBaseName(QLatin1String("*"), QLatin1String("*")) + QString::number(serviceId); } - - Ui::ServiceManagementDialog *m_ui; - std::shared_ptr m_dtcExm; - std::shared_ptr m_dtc; - std::shared_ptr m_ftc; -private slots: - void slotRestartService(int serviceID); - void slotRestartGroup(const Core::ServiceGroupType &groupType, int exercise, int server, int32_t replayPartitionId); - void slotStartGroup(const Core::ServiceGroupType &groupType, int exercise, int server, int32_t replayPartitionId); - void slotStopGroup(const Core::ServiceGroupType &groupType, int exercise, int server, int32_t replayPartitionId); - - void slotGroupInformationChanged(ServiceManagement::GroupInformation, DataModification); - void slotServiceInformationChanged(ServiceManagement::ServiceInformation, DataModification); -}; -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/ServiceManagement/Gui/ServiceEdit/scm_dialog.ui b/qt6-after/qt6-migrated-legatus/Lts/Plugins/ServiceManagement/Gui/ServiceEdit/scm_dialog.ui deleted file mode 100755 index d7d4fb176..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/ServiceManagement/Gui/ServiceEdit/scm_dialog.ui +++ /dev/null @@ -1,95 +0,0 @@ - - - ServiceManagementDialog - - - - 0 - 0 - 600 - 500 - - - - Service Management - - - - - - - - Server: - - - - - - - true - - - - - - - Exercise: - - - - - - - true - - - - - - - - - There are no Services available to view. - - - - - - - Groups of 'Server.Exercise': - - - - - - - QFrame::NoFrame - - - Qt::ScrollBarAlwaysOff - - - true - - - - - 0 - 0 - 588 - 376 - - - - - 25 - - - - - - - - - - diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/ServiceManagement/Gui/ServiceEdit/scm_dialog_group.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/ServiceManagement/Gui/ServiceEdit/scm_dialog_group.cpp deleted file mode 100755 index 766f875be..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/ServiceManagement/Gui/ServiceEdit/scm_dialog_group.cpp +++ /dev/null @@ -1,168 +0,0 @@ -#include "scm_dialog.h" -#include "scm_dialog_group.h" -#include "ui_scm_dialog_group.h" - -#include - - -namespace ServiceManagement -{ -GroupWidget::GroupWidget(const Core::ServiceGroupType &groupType, int server, int exercise, - int32_t replayPartitionId, - const QString &groupName , long long timestamp, - const QVector &neededServices, QWidget *parent) - : QWidget(parent) - , m_ui(new Ui::GroupWidget) - , m_status(ServiceWidget::UNKNOWN) - , m_server(server) - , m_exercise(exercise) - , m_groupName(groupName) - , m_replayPartitionId(replayPartitionId) - , m_neededServices(neededServices) -{ - - m_ui->setupUi(this); - - connect(m_ui->pbRestart, &QToolButton::clicked, this, &GroupWidget::slotRestartGroup); - connect(m_ui->pbStart, &QToolButton::clicked, this, &GroupWidget::slotStartGroup); - connect(m_ui->pbStop, &QToolButton::clicked, this, &GroupWidget::slotStopGroup); - - setType(groupType); - setServer(server); - setExercise(exercise); - setTimestamp(timestamp); - - if (getStatus() != ServiceWidget::STOPPED) - setStatus(ServiceWidget::STARTED); -} - - -GroupWidget::~GroupWidget() -{ - delete m_ui; -} - - -void GroupWidget::addService(ServiceWidget *service) -{ - m_ui->lbNoServices->hide(); - - - - if (m_neededServices.contains(service->id())) - { - - - if (!findChild(service->objectName())) - { - - - m_ui->servicesLayout->addWidget(service); - checkStatus(); - } - } - else - { - - } -} - - -void GroupWidget::checkStatus() -{ - - - m_status = ServiceWidget::UNKNOWN; - - - const QList serviceList = findChildren(); - - if (serviceList.isEmpty()) - m_ui->lbNoServices->show(); - - for (const ServiceWidget *serviceWidget : serviceList) - { - if (serviceWidget->getStatus() != ServiceWidget::STARTED) - setStatus(ServiceWidget::STOPPED); - } - - if (getStatus() != ServiceWidget::STOPPED) - setStatus(ServiceWidget::STARTED); -} - - -ServiceWidget::Status GroupWidget::getStatus() const -{ - return m_status; -} - - -void GroupWidget::setStatus(ServiceWidget::Status status) -{ - m_status = status; - - QString newCss; - switch (m_status) - { - case ServiceWidget::STARTED: - newCss = QLatin1String("background-color: rgb(124, 189, 124);"); - break; - case ServiceWidget::STOPPED: - newCss = QLatin1String("background-color: rgb(189, 106, 98);"); - break; - case ServiceWidget::STARTING: - case ServiceWidget::STOPPING: - case ServiceWidget::UNKNOWN: - break; - } - m_ui->frStatus->setStyleSheet(newCss); -} - - -void GroupWidget::slotRestartGroup() -{ - emit signalRestartGroup(m_groupType, m_exercise, m_server, m_replayPartitionId); -} - - -void GroupWidget::slotStartGroup() -{ - emit signalStartGroup(m_groupType, m_exercise, m_server, m_replayPartitionId); -} - - -void GroupWidget::slotStopGroup() -{ - emit signalStopGroup(m_groupType, m_exercise, m_server, m_replayPartitionId); -} - - -void GroupWidget::setType(Core::ServiceGroupType type) -{ - m_groupType = type; - m_ui->lbGroupName->setText(QStringLiteral("

%1 %2

") - .arg(tr("Services of %1").arg(ServiceManagement::ServiceManagementDialog::groupEnumToGroupName(type)), m_groupName)); -} - -void GroupWidget::setServer(int server) -{ - m_server = server; -} - -void GroupWidget::setExercise(int exercise) -{ - m_exercise = exercise; -} - -void GroupWidget::setTimestamp(long long timestamp) -{ - if (timestamp < 1) - { - m_ui->lbTimestamp->setText(QString()); - return; - } - - m_ui->lbTimestamp->setText(QStringLiteral("

%1:
%2

") - .arg(tr("Last Heartbeat"), QDateTime::fromMSecsSinceEpoch(timestamp).toString())); -} -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/ServiceManagement/Gui/ServiceEdit/scm_dialog_group.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/ServiceManagement/Gui/ServiceEdit/scm_dialog_group.h deleted file mode 100755 index 527aacdfc..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/ServiceManagement/Gui/ServiceEdit/scm_dialog_group.h +++ /dev/null @@ -1,59 +0,0 @@ -#pragma once - -#include "scm_dialog_service.h" - -#include -#include - - -namespace Ui -{ -class GroupWidget; -} - -namespace ServiceManagement -{ -class GroupWidget : public QWidget -{ - Q_OBJECT - -public: - GroupWidget(const Core::ServiceGroupType &groupType, int server, int exercise, - int32_t replayPartitionId, - const QString &groupName, long long timestamp, - const QVector &neededServices, QWidget *parent = nullptr); - ~GroupWidget(); - - void addService(ServiceWidget *service); - - void setType(Core::ServiceGroupType type); - void setServer(int server); - void setExercise(int exercise); - void setTimestamp(long long timestamp); - - ServiceWidget::Status getStatus() const; - void setStatus(ServiceWidget::Status status); - - void checkStatus(); - -private: - Ui::GroupWidget *m_ui; - ServiceWidget::Status m_status; - Core::ServiceGroupType m_groupType; - int m_server; - int m_exercise; - QString m_groupName; - int32_t m_replayPartitionId; - QVector m_neededServices; - -private slots: - void slotRestartGroup(); - void slotStartGroup(); - void slotStopGroup(); - -signals: - void signalRestartGroup(const Core::ServiceGroupType &groupType, int, int, int32_t replayPartitionId); - void signalStartGroup(const Core::ServiceGroupType &groupType, int, int, const int32_t replayPartitionId); - void signalStopGroup(const Core::ServiceGroupType &groupType, int, int, const int32_t replayPartitionId); -}; -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/ServiceManagement/Gui/ServiceEdit/scm_dialog_group.ui b/qt6-after/qt6-migrated-legatus/Lts/Plugins/ServiceManagement/Gui/ServiceEdit/scm_dialog_group.ui deleted file mode 100755 index 6cac5d1e8..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/ServiceManagement/Gui/ServiceEdit/scm_dialog_group.ui +++ /dev/null @@ -1,222 +0,0 @@ - - - GroupWidget - - - - 0 - 0 - 720 - 55 - - - - - 0 - 0 - - - - Form - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 20 - - - 5 - - - 5 - - - 5 - - - - - - 0 - 0 - - - - - 10 - 0 - - - - - 10 - 16777215 - - - - - - - - - 250 - 0 - - - - - - - - - - - - 0 - 0 - - - - - 250 - 0 - - - - - 250 - 16777215 - - - - - - - - - - - - 28 - 28 - - - - - 28 - 28 - - - - <html><head/><body><p>Restart this Group of Services (Restarts every Service inside this Group)</p></body></html> - - - R - - - - :/style/arrow_back.svg:/style/arrow_back.svg - - - - - - - - 28 - 28 - - - - - 28 - 28 - - - - <html><head/><body><p>Start this Group of Services (Starts Services inside this Group, that are currently stopped)</p></body></html> - - - S - - - - :/style/media-play-slower.svg:/style/media-play-slower.svg - - - - - - - - 28 - 28 - - - - - 28 - 28 - - - - <html><head/><body><p>Stop this Group of Services (Stops Services inside this Group, that are currently running / started)</p></body></html> - - - E - - - - :/style/application-exit.svg:/style/application-exit.svg - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - No Services available in this Group. - - - - - - - - - - - - diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/ServiceManagement/Gui/ServiceEdit/scm_dialog_service.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/ServiceManagement/Gui/ServiceEdit/scm_dialog_service.cpp deleted file mode 100755 index bf51df11b..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/ServiceManagement/Gui/ServiceEdit/scm_dialog_service.cpp +++ /dev/null @@ -1,134 +0,0 @@ -#include "scm_dialog_service.h" -#include "ui_scm_dialog_service.h" - -#include - - -namespace ServiceManagement -{ -ServiceWidget::ServiceWidget(int32_t id, long long pid, const QString &name, - const Core::RunningState &state, const QString &errorString, QWidget *parent) - : QWidget(parent) - , m_ui(new Ui::ServiceWidget) - , m_status(ServiceWidget::UNKNOWN) - , m_id(id) -{ - m_ui->setupUi(this); - - connect(m_ui->pbRestart, &QToolButton::clicked, this, &ServiceWidget::slotRestartService); - - setName(name); - setPid(pid); - setErrorString(errorString); - setState(state); -} - - -ServiceWidget::~ServiceWidget() -{ - delete m_ui; -} - - -void ServiceWidget::setName(const QString &name) -{ - m_ui->lbServiceName->setText(name); -} - - -void ServiceWidget::setPid(long long pid) -{ - m_ui->lbPID->setText(QStringLiteral("

%1:
%2

") - .arg(tr("Process ID")).arg(pid)); -} - - -void ServiceWidget::setTimestamp(long long timestamp) -{ - if (timestamp < 1) - { - m_ui->lbTimestamp->setText(QString()); - return; - } - - m_ui->lbTimestamp->setText(QStringLiteral("

%1:
%2

") - .arg(tr("Last Heartbeat"), QDateTime::fromMSecsSinceEpoch(timestamp).toString())); -} - - -void ServiceWidget::setErrorString(const QString &errorString) -{ - if (errorString.isEmpty()) - { - m_ui->lbError->setText(QString()); - return; - } - - m_ui->lbError->setText(QStringLiteral("

%1:
%2

").arg(tr("Error"), errorString)); -} - - -void ServiceWidget::setState(Core::RunningState state) -{ - auto status = ServiceWidget::UNKNOWN; - switch (state.underlying()) - { - - case Core::RunningState::inner_enum::Starting: - status = ServiceWidget::STARTING; - break; - - - case Core::RunningState::inner_enum::Running: - status = ServiceWidget::STARTED; - break; - - - case Core::RunningState::inner_enum::Stopping: - status = ServiceWidget::STOPPING; - break; - - - case Core::RunningState::inner_enum::StartingError: - case Core::RunningState::inner_enum::NotYetStarted: - case Core::RunningState::inner_enum::StoppedNormally: - case Core::RunningState::inner_enum::StoppedError: - status = ServiceWidget::STOPPED; - break; - } - setStatus(status); -} - - -void ServiceWidget::setStatus(const Status status) -{ - m_status = status; - - switch (m_status) - { - case ServiceWidget::STARTED: - m_ui->frStatus->setStyleSheet(greenStyleSheet()); - break; - - case ServiceWidget::STOPPED: - m_ui->frStatus->setStyleSheet(redStyleSheet()); - break; - - default: - m_ui->frStatus->setStyleSheet(orangeStyleSheet()); - break; - } -} - - -ServiceWidget::Status ServiceWidget::getStatus() const -{ - return m_status; -} - - -void ServiceWidget::slotRestartService() -{ - emit signalRestartService(m_id); -} -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/ServiceManagement/Gui/ServiceEdit/scm_dialog_service.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/ServiceManagement/Gui/ServiceEdit/scm_dialog_service.h deleted file mode 100755 index a4b7480b2..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/ServiceManagement/Gui/ServiceEdit/scm_dialog_service.h +++ /dev/null @@ -1,59 +0,0 @@ -#pragma once - -#include - -#include - - -namespace Ui -{ -class ServiceWidget; -} - -namespace ServiceManagement -{ -class ServiceWidget : public QWidget -{ - Q_OBJECT - -public: - enum Status - { - UNKNOWN = 0, - STARTING, - STARTED, - STOPPING, - STOPPED, - }; - - ServiceWidget(int32_t id, long long pid, const QString &name, - const Core::RunningState &state, const QString &errorString, QWidget *parent = nullptr); - ~ServiceWidget(); - - void setPid(long long pid); - void setName(const QString &name); - void setTimestamp(long long timestamp); - void setState(Core::RunningState state); - void setErrorString(const QString &errorString); - - - void setStatus(const Status status); - Status getStatus() const; - int32_t id() const { return m_id; } - -private: - Ui::ServiceWidget *m_ui; - Status m_status; - int32_t m_id; - - static QString greenStyleSheet() { return QLatin1String("background-color: rgb(124, 189, 124);"); } - static QString orangeStyleSheet() { return QLatin1String("background-color: rgb(212, 190, 128);"); } - static QString redStyleSheet() { return QLatin1String("background-color: rgb(202, 122, 122);"); } - -signals: - void signalRestartService(int id); - -private slots: - void slotRestartService(); -}; -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/ServiceManagement/Gui/ServiceEdit/scm_dialog_service.ui b/qt6-after/qt6-migrated-legatus/Lts/Plugins/ServiceManagement/Gui/ServiceEdit/scm_dialog_service.ui deleted file mode 100755 index 7596be987..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/ServiceManagement/Gui/ServiceEdit/scm_dialog_service.ui +++ /dev/null @@ -1,234 +0,0 @@ - - - ServiceWidget - - - - 0 - 0 - 767 - 50 - - - - - 0 - 0 - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 20 - - - 10 - - - 5 - - - 5 - - - 5 - - - - - - 0 - 0 - - - - - 10 - 16777215 - - - - QFrame::NoFrame - - - QFrame::Raised - - - - 8 - - - 2 - - - 8 - - - 2 - - - - - - - - - 0 - 0 - - - - - 250 - 0 - - - - - 250 - 16777215 - - - - - 75 - true - - - - Service Name - - - - - - - - 28 - 28 - - - - - 28 - 28 - - - - <html><head/><body><p>Restart Service</p></body></html> - - - R - - - - :/style/arrow_back.svg:/style/arrow_back.svg - - - Qt::ToolButtonIconOnly - - - - - - - - 0 - 0 - - - - - 250 - 0 - - - - - 250 - 16777215 - - - - <html><head/><body><p><br/></p></body></html> - - - Qt::RichText - - - false - - - false - - - - - - - - 80 - 0 - - - - - 80 - 16777215 - - - - - - - - - - - - 0 - 0 - - - - - 200 - 0 - - - - - 200 - 16777215 - - - - - - - - - - - - - - - - diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/ServiceManagement/Gui/ServiceEdit/scm_edit_gui_plugin.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/ServiceManagement/Gui/ServiceEdit/scm_edit_gui_plugin.cpp deleted file mode 100755 index f6c32bfe7..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/ServiceManagement/Gui/ServiceEdit/scm_edit_gui_plugin.cpp +++ /dev/null @@ -1,81 +0,0 @@ - - - -#include "scm_edit_gui_plugin.h" -#include "scm_dialog.h" - -#include -#include -#include - -namespace ServiceManagement -{ - -std::shared_ptr GuiPlugin::createGuiInterface(LtsSession::LtsSession *session) -{ - return std::make_shared(session); -} - -InterfaceImpl::InterfaceImpl(LtsSession::LtsSession *session) - : GuiPluginBase::Interface(session, getLogger("Plugins.Gui.Scm.Edit")) - , m_dtcExm(nullptr) - , m_dtc(nullptr) - , m_ftc(nullptr) -{} - - -bool InterfaceImpl::fetchInterfaces() -{ - if (!m_session->getDtc(m_dtc)) - return false; - if (!m_session->getFtc(m_ftc)) - return false; - if (!m_session->getDtc(m_dtcExm)) - return false; - return true; -} - -void InterfaceImpl::clearInterfaces() -{ - m_ftc = nullptr; - m_dtc = nullptr; -} - - -QString InterfaceImpl::menuGroup() const -{ - return tr("Services"); -} - - -QVector InterfaceImpl::getActions() -{ - QVector ret; - - LtsWidgets::PluginData plData; - plData.menuGroup = menuGroup(); - plData.menuText = tr("Service Management"); - plData.menuIcon = QIcon(QLatin1String("icon:service.svg")); - plData.identifier = QLatin1String("scmServiceEdit"); - plData.operatorRight = OperatorRights::ServicesEdit; - plData.exercisePart = LtsWidgets::ExercisePart::eSpecial; - plData.createWidgetFunc = [this](QWidget * parent) - { - m_dtc->enableGroupInformation(); - m_dtc->enableServiceInformation(); - - m_ftc->enableRestartService(); - - m_ftc->enableStopGroup(); - m_ftc->enableStartGroup(); - m_ftc->enableRestartGroup(); - - return LtsWidgets::initDialog(new ServiceManagementDialog(parent), - m_dtc, m_ftc, m_dtcExm); - }; - ret.append(plData); - - return ret; -} - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/ServiceManagement/Gui/ServiceEdit/scm_edit_gui_plugin.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/ServiceManagement/Gui/ServiceEdit/scm_edit_gui_plugin.h deleted file mode 100755 index 4165f438b..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/ServiceManagement/Gui/ServiceEdit/scm_edit_gui_plugin.h +++ /dev/null @@ -1,56 +0,0 @@ - - - -#pragma once - -#include - -#include -#include -#include -#include -#include - -#include - - -namespace ServiceManagement -{ - -class GuiPlugin final : public QObject, public GuiPluginBase::Plugin -{ - Q_PLUGIN_METADATA(IID "gui:3:scm") - Q_INTERFACES(GuiPluginBase::Plugin) - - Q_OBJECT -public: - GuiPlugin() = default; - ~GuiPlugin() = default; - - QString pluginName() override { return QStringLiteral("ServiceManagement"); } - std::shared_ptr createGuiInterface(LtsSession::LtsSession *session) override; - bool availableInPartition(IDL::PartitionType partition) const override - { - return (partition == IDL::PartitionType::Global); - } -}; - -class InterfaceImpl final : public QObject, public GuiPluginBase::Interface -{ - Q_OBJECT -public: - explicit InterfaceImpl(LtsSession::LtsSession *session); - - QVector getActions() override; - bool fetchInterfaces() override; - void clearInterfaces() override; - QString menuGroup() const override; - bool availableInPartition(IDL::PartitionType partition) const override { return partition == IDL::PartitionType::Global; } - -private: - std::shared_ptr m_dtcExm; - std::shared_ptr m_dtc; - std::shared_ptr m_ftc; -}; - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/ServiceManagement/scm_data_plugin_interface.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/ServiceManagement/scm_data_plugin_interface.h deleted file mode 100755 index e0222b33f..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/ServiceManagement/scm_data_plugin_interface.h +++ /dev/null @@ -1,23 +0,0 @@ - - - -#pragma once - -#include -#include -#include - -namespace ServiceManagement -{ - - -class DataInterface : public DataPluginBase::Interface -{ -public: - using DataPluginBase::Interface::Interface; - - virtual std::shared_ptr getDtc() = 0; - virtual std::shared_ptr getFtc() = 0; -}; - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/ServiceManagement/scm_gui_plugin_interface.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/ServiceManagement/scm_gui_plugin_interface.h deleted file mode 100755 index c3794f24a..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/ServiceManagement/scm_gui_plugin_interface.h +++ /dev/null @@ -1,15 +0,0 @@ - - - -#pragma once - -namespace ServiceManagement -{ -class ForeignGuiInterface -{ -public: - ForeignGuiInterface() = default; - virtual ~ForeignGuiInterface() = default; -}; - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/CMakeLists.txt b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/CMakeLists.txt deleted file mode 100755 index 6702c5cfd..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -# -# $Id$ -# $HeadURL$ -# $Author$ -# -# Created by Mike Wille, SLTE, 2020-03-23 -# - -ADD_SUBDIRECTORY(Common) -ADD_SUBDIRECTORY(ThpManagement) -ADD_SUBDIRECTORY(ThpUsbManagement) - -ADD_INTERFACE_LIBRARY(TpmGuiPluginInterface - ${CMAKE_CURRENT_SOURCE_DIR}/tpm_gui_plugin_interface.h - ${CMAKE_CURRENT_SOURCE_DIR}/.. - GuiPluginInterface -) diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/Common/CMakeLists.txt b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/Common/CMakeLists.txt deleted file mode 100755 index c3f253719..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/Common/CMakeLists.txt +++ /dev/null @@ -1,43 +0,0 @@ -# -# $Id: CMakeLists.txt 51804 2020-07-31 04:47:28Z fritsche_h $ -# $HeadURL: svn://slssvn/TDS/branches/product/iterations/21_03_salted_caramel/Lts/Plugins/TakeHomePackageManager/CMakeLists.txt $ -# $Author: fritsche_h $ -# -# Created by Mike Wille, SLTE, 2020-03-23 -# - -SET(src - logger.cpp - logger.h - tpm_exported_scripts_model.cpp - tpm_exported_scripts_model.h - tpm_process_dialog.cpp - tpm_process_dialog.h -) - -QT5_WRAP_UI(src - tpm_process_dialog.ui -) - -NGL_ADD_LIBRARY2(WS ThpCommon SHARED ${src}) -NGL_TARGET_INCLUDE_DIRECTORIES(ThpCommon - PUBLIC - ${CMAKE_CURRENT_SOURCE_DIR}/../ - ${CMAKE_CURRENT_BINARY_DIR}/../ # export file -) -NGL_TARGET_LINK_LIBRARIES(ThpCommon - Qt6::Core - Qt6::Concurrent - NGLLogger - LtsSession - AsmDataPluginInterface - ExmDataPluginInterface - #nglcompression - #nglsettings - #ngltools - #LtsSessionData - #httq -) - -NGL_INSTALL_TARGET(ThpCommon) - diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/Common/logger.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/Common/logger.cpp deleted file mode 100755 index 87642bae5..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/Common/logger.cpp +++ /dev/null @@ -1,32 +0,0 @@ - - - -#include "logger.h" - -#include - -namespace TakeHomePackageManager -{ - -LOGGER_T getLogger(const char *name) -{ - static const char ns[] = "TPM.Common."; - std::string loggerName; - const size_t len = strlen(name); - loggerName.reserve(sizeof(ns) + len); - loggerName.append(ns, sizeof(ns) - 1); - loggerName.append(name, len); - - try - { - return NGL::NGLLoggerBootstrap::getNGLRootLogger(). - getNGLLogger(loggerName); - } - catch (const std::exception &ex) - { - fprintf(stderr, "Error retrieving logger: %s", ex.what()); - abort(); - } -} - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/Common/logger.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/Common/logger.h deleted file mode 100755 index 02b407a94..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/Common/logger.h +++ /dev/null @@ -1,17 +0,0 @@ - - - -#pragma once - -#include - -namespace TakeHomePackageManager -{ -typedef NGL::INGLLogger &LOGGER_T; - -LOGGER_T getLogger(const char *name); -inline LOGGER_T getLogger(const QString &loggerName) -{ - return getLogger(loggerName.toUtf8().constData()); -} -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/Common/tpm_exported_scripts_model.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/Common/tpm_exported_scripts_model.cpp deleted file mode 100755 index 519ccc953..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/Common/tpm_exported_scripts_model.cpp +++ /dev/null @@ -1,602 +0,0 @@ - - - -#include "tpm_exported_scripts_model.h" -#include - -#include - -#include -#include -#include -#include -#include -#include -#include - - -namespace TakeHomePackageManager -{ - -ExportedScriptsModel::ExportedScriptsModel(QObject *parent) - : LtsWidgets::LtsAbstractTableModel( - { tr("id"), tr("Exercise"), tr("Name"), tr("Created"), tr("Last downloaded"), tr("Location"), tr("Last uploaded"), tr("Server")}, parent) -{} - -bool ExportedScriptsModel::init(const QString &rootDirectoryToScan) -{ - std::shared_ptr _(nullptr, [this](int *) { endResetModel(); }); - m_rootDirectoryToScan = rootDirectoryToScan; - beginResetModel(); - m_vecData.clear(); - - QVector localExercises; - DEBUG_LOG(m_logger) << "ExportedScriptsModel::init rootDirectoryToScan=" << rootDirectoryToScan - ; - - - - - - { - DEBUG_LOG(m_logger) << "Get all local exercises rootDirectoryToScan=" << rootDirectoryToScan ; - QFile file(rootDirectoryToScan + QDir::separator() + QStringLiteral("exercises.json")); - if (!file.open(QFile::ReadOnly)) - WARNING_LOG(m_logger) << "Cannot open " << file.fileName() << " for read/write: " << file.errorString(); - - const QJsonDocument doc(QJsonDocument::fromJson(file.readAll())); - const QJsonObject obj = doc.object(); - const QJsonArray arr = obj[QStringLiteral("Exercises")].toArray(); - localExercises.reserve(arr.size()); - for (const auto &ele : arr) - localExercises.append(ele.toInt()); - } - - WARNING_LOG(m_logger) << "local exericses: " << localExercises.count(); - - - for (const int exId : std::as_const(localExercises)) - { - const QString baseDir = exercisePath(rootDirectoryToScan, exId); - QFile file(baseDir + QDir::separator() + QStringLiteral("data.json")); - - if (!file.open(QIODevice::ReadOnly)) - { - WARNING_LOG(m_logger) << "Cannot open " << file.fileName() << " for reading: " << file.errorString() << " - not critical"; - - return true; - } - - const QJsonDocument doc(QJsonDocument::fromJson(file.readAll())); - const QJsonObject obj = doc.object(); - const QJsonArray presentations = obj[QStringLiteral("presentations")].toArray(); - - DEBUG_LOG(m_logger) << "exercise: " << exId << ", presentations: " << presentations.size(); - - for (const QJsonValue &val : presentations) - { - ExportedScriptInformation esi = ExportedScriptInformation::fromJson(val); - DEBUG_LOG(m_logger) << "obj=" << QJsonDocument(obj).toJson(QJsonDocument::Compact); - const QJsonObject presentationObj = val.toObject(); - DEBUG_LOG(m_logger) << "presentationObj=" << QJsonDocument(presentationObj).toJson(QJsonDocument::Compact); - if (obj.contains(QStringLiteral("exerciseId"))) - { - esi.exerciseId = obj[QStringLiteral("exerciseId")].toInt(); - esi.exerciseName = obj[QStringLiteral("exerciseName")].toString(); - if (presentationObj.contains(QStringLiteral("name")) ) - esi.scriptName = presentationObj[QStringLiteral("name")].toString(); - if (presentationObj.contains(QStringLiteral("displayName")) ) - esi.scriptName = presentationObj[QStringLiteral("displayName")].toString(); - } - - esi.local = true; - DEBUG_LOG(m_logger) << "push_back " - << " exportTime=" << esi.exportTime - << " scriptId=" << esi.scriptId - << " scriptName=" << esi.scriptName - << " exerciseId=" << esi.exerciseId - << " exerciseName=" << esi.exerciseName - << " local=" << esi.local; - esi.uploaded = ThpUnknownUploadState; - - esi.rootDirectory = rootDirectoryToScan; - - m_vecData.push_back(esi); - } - } - - return true; -} - - - -void ExportedScriptsModel::setServerContent(const QString &jsonArray) -{ - if (jsonArray.isEmpty()) - return; - - - - QMap> exerciseContentScriptIds; - QMap> exerciseScriptIds; - - DEBUG_LOG(m_logger) << "ExportedScriptsModel::setServerContent jsonArray =" << jsonArray; - QJsonParseError err; - const QJsonArray presentations = QJsonDocument::fromJson(jsonArray.toUtf8(), &err).array(); - DEBUG_LOG(m_logger) << "presentations.size() =" << presentations.size(); - - if (err.error != QJsonParseError::NoError) - { - ERROR_LOG(m_logger) << "json array invalid at offset " << err.offset << ": " << err.errorString(); - return; - } - - - for (const auto &data : std::as_const(m_vecData)) - { - exerciseScriptIds[data.exerciseId].append(data.scriptId); - DEBUG_LOG(m_logger) << "exerciseId=" << data.exerciseId - << " modelScriptIds.append: " << data.scriptId; - } - - - for (const QJsonValue &val : presentations) - { - const ExportedScriptInformation esi = ExportedScriptInformation::fromJson(val, false, ThpAlreadyUploaded); - exerciseContentScriptIds[esi.exerciseId].append(esi.scriptId); - } - - - - for (int i = m_vecData.size() - 1; i >= 0; --i) - { - const auto &rowData = m_vecData[i]; - const QVector contentScriptIds = exerciseContentScriptIds.value(rowData.exerciseId); - DEBUG_LOG(m_logger) << "m_vecData.at(" << i << ").scriptId=" << rowData.scriptId - << " exerciseId=" << rowData.exerciseId - << " contentScriptIds.contains=" << contentScriptIds.contains(rowData.scriptId) - << " rowData.local=" << rowData.local - << " contentScriptIds.size()=" << contentScriptIds.size(); - - if (!contentScriptIds.contains(rowData.scriptId)) - { - - if (rowData.local == false) - { - - - DEBUG_LOG(m_logger) << "removeRow(" << i << ")" - << " ScriptId=" << rowData.scriptId - << " ExerciseId=" << rowData.exerciseId; - removeRow(i); - } - else - { - - - setUploadState(i, ThpUploadNotActive, 0, 0); - } - } - } - - - - for (const QJsonValue &val : presentations) - { - ExportedScriptInformation esi = ExportedScriptInformation::fromJson(val, false, ThpAlreadyUploaded); - QVector modelScriptIds = exerciseScriptIds.value(esi.exerciseId); - DEBUG_LOG(m_logger) << " exportTime=" << esi.exportTime - << " scriptId=" << esi.scriptId - << " exerciseId=" << esi.exerciseId - << " exerciseName=" << esi.exerciseName - << " scriptName=" << esi.scriptName - << " fileSize=" << esi.fileSize - << " modelScriptIds.size=" << modelScriptIds.size(); - - - if (!modelScriptIds.contains(esi.scriptId)) - { - DEBUG_LOG(m_logger) << "insertRow()"; - insertRow(esi); - continue; - } - - - for (int i = 0; i < m_vecData.size(); i++) - { - const auto &rowData = m_vecData[i]; - if (rowData.scriptId == esi.scriptId && - rowData.exerciseId == esi.exerciseId) - { - DEBUG_LOG(m_logger) << "setUploadState i=" << i - << " esi.scriptId=" << esi.scriptId - << " esi.exerciseId=" << esi.exerciseId - << " esi.fileSize=" << esi.fileSize - << " esi.uploadTime=" << esi.uploadTime; - setUploadState(i, ThpAlreadyUploaded, esi.uploadTime, esi.fileSize); - break; - } - } - } - - update(); - return; -} - - -qint64 ExportedScriptsModel::downloadTime(const ExportedScriptInformation &val) const -{ - if (!val.local) - return 0; - - QString filename(QStringLiteral("%1/THP-Download/Exercise_%2/%3/index.html").arg(QDir::tempPath()).arg(val.exerciseId).arg(val.scriptId)); - DEBUG_LOG(m_logger) << "downloadTime: filename " << filename; - - QFileInfo fi(filename); - if (!fi.exists()) - return 0; - - return fi.lastModified().toMSecsSinceEpoch(); -} - - -QVariant ExportedScriptsModel::data(const QModelIndex &index, int role) const -{ - if (!indexIsValid(index)) - return QVariant(); - - const ExportedScriptInformation &val = m_vecData[index.row()]; - - switch (role) - { - case Qt::FontRole: - { - if (!m_isOC - - - - || !val.local - - - - || index.column() != ColUploadedTime - - || val.uploadTime <= (downloadTime(val) + (10 * 1000) )) - - - break; - - QFont font; - font.setBold(true); - return font; - } - - case Qt::DisplayRole: - { - switch (index.column()) - { - case ColId: - return val.scriptId; - case ColExercise: - return val.exerciseName; - case ColName: - return val.scriptName; - case ColCreated: - return QDateTime::fromMSecsSinceEpoch(val.exportTime); - case ColDownloaded: - { - qint64 dlTime = downloadTime(val); - if (dlTime == 0) - return QVariant(); - return QDateTime::fromMSecsSinceEpoch(dlTime); - } - case ColUploadedTime: - return QDateTime::fromMSecsSinceEpoch(val.uploadTime); - case ColLocation: - return val.local ? tr("Local") : tr("Server"); - case ColUploaded: - switch (val.uploaded) - { - case ThpConnectToHost: - return tr("Connect to host"); - case ThpUploadActive: - return tr("Upload Active"); - case ThpUploadError: - return tr("Upload Error"); - case ThpUploadNotActive: - return tr("Not uploaded"); - case ThpUnknownUploadState: - return tr("Unknown upload status"); - case ThpAlreadyUploaded: - return tr("Already uploaded"); - } - } - - case Qt::UserRole: - { - return val.scriptId; - break; - } - - break; - } - } - - return QVariant(); -} - -bool ExportedScriptsModel::createDataJson(const QString &rootDirectory, - const std::shared_ptr &exmDtc, - const std::shared_ptr &asmDtc, - int exerciseId) const -{ - const QString baseDir = exercisePath(rootDirectory, exerciseId); - - if (!QDir().mkpath(baseDir)) - { - ERROR_LOG(m_logger) << "Failed to create path " << baseDir; - return false; - } - - QFile file(baseDir + QStringLiteral("data.json")); - DEBUG_LOG(m_logger) << "createDataJson=" << file.fileName(); - if (!file.open(QFile::ReadWrite)) - { - QString msg(tr("Could not open data file in script directory: %1").arg(file.errorString())); - ERROR_LOG(m_logger) << msg << " - " << file.fileName(); - return false; - } - - QJsonDocument doc(QJsonDocument::fromJson(file.readAll())); - QJsonObject obj = doc.object(); - if (obj[QStringLiteral("exerciseId")].toInt() == exerciseId) - { - DEBUG_LOG(m_logger) << baseDir << " exists for exerciseId " << QString::number(exerciseId); - return true; - } - - const ExerciseManagement::Exercise exercise = exmDtc->exercise(exerciseId); - const AssetManagement::TrainingArea ta = asmDtc->trainingArea(exercise.trainingAreaId()); - - obj[QStringLiteral("title")] = QString::fromStdString(exercise.name()); - obj[QStringLiteral("exerciseId")] = exercise.id(); - obj[QStringLiteral("exerciseName")] = QString::fromStdString(exercise.name()); - obj[QStringLiteral("exerciseArea")] = QString::fromStdString(ta.name()); - obj[QStringLiteral("cycleTime")] = QString(QDateTime::fromMSecsSinceEpoch(exercise.beginTime()).toString() + - QStringLiteral(" - ") + QDateTime::fromMSecsSinceEpoch(exercise.endTime()).toString()); - obj[QStringLiteral("exerciseStart")] = exercise.beginTime(); - obj[QStringLiteral("exerciseEnd")] = exercise.endTime(); - obj[QStringLiteral("exercisingForces")] = QString::fromStdString(exercise.forces()); - obj[QStringLiteral("exercisingPurpose")] = QString::fromStdString(exercise.description()); - - file.resize(0); - file.write(QJsonDocument(obj).toJson()); - - return true; -} - - -void ExportedScriptsModel::addDownloadData(const ExportedScriptInformation &esi) -{ - - { - - DEBUG_LOG(m_logger) << "Add exercise to ExportRootPath"; - - if (!QDir(esi.rootDirectory).exists()) - { - ERROR_LOG(m_logger) << "Cannot modify exercises.json as the info's root directory '"<::removeRow(row)) - return false; - - QString baseDir = exercisePath(data.rootDirectory, data.exerciseId); - QString filename = baseDir + QStringLiteral("data.json"); - DEBUG_LOG(m_logger) << "filename= '" << filename << "'"; - QFile file(baseDir + QStringLiteral("data.json")); - - if (!file.open(QIODevice::ReadWrite)) - { - DEBUG_LOG(m_logger) << "!file.open '" << filename << "'" - << " no local scripts"; - return true; - } - - const QJsonDocument doc(QJsonDocument::fromJson(file.readAll())); - QJsonObject obj = doc.object(); - const int exId = obj.value(QStringLiteral("exerciseId")).toInt(); - QJsonArray arr; - - for (const auto &esi : std::as_const(m_vecData)) - { - if (esi.exerciseId == exId) - arr += esi.toJson(); - } - - obj[QStringLiteral("presentations")] = arr; - file.resize(0); - auto content = QJsonDocument(obj).toJson(); - DEBUG_LOG(m_logger) << "content =" << content; - - return file.write(QJsonDocument(obj).toJson()); -} - -QString ExportedScriptsModel::exercisePath(const QString &rootDirectory, const int exerciseId) const -{ - QString path = QStringLiteral("%1/Exercise_%2/").arg(rootDirectory).arg(exerciseId); -#ifndef WIN32 - path.prepend(QStringLiteral("/")); -#endif - return path; -} - - - - -QJsonValue ExportedScriptInformation::toJson() const -{ - return QJsonObject({ - { QStringLiteral("displayName"), scriptName }, - { QStringLiteral("path"), jsonPath }, - { QStringLiteral("scriptId"), scriptId }, - { QStringLiteral("exportTime"), exportTime }, - { QStringLiteral("fileSize"), fileSize }, - { QStringLiteral("uploadTime"), uploadTime }, - { QStringLiteral("exerciseName"), exerciseName }, - { QStringLiteral("exerciseId"), exerciseId } - }); -} - -ExportedScriptInformation ExportedScriptInformation::fromJson(const QJsonValue &val, - const bool local, - const UploadState uploadState) -{ - const QJsonObject obj = val.toObject(); - - ExportedScriptInformation esi; - esi.local = local; - esi.scriptName = obj[QStringLiteral("displayName")].toString(); - if (esi.scriptName.isEmpty()) - esi.scriptName = obj[QStringLiteral("name")].toString(); - esi.jsonPath = obj[QStringLiteral("path")].toString(); - esi.scriptId = obj[QStringLiteral("scriptId")].toInt(); - esi.exportTime = qRound64(obj[QStringLiteral("exportTime")].toDouble()); - esi.fileSize = obj[QStringLiteral("fileSize")].toInt(); - esi.uploaded = uploadState; - esi.uploadTime = qRound64(obj[QStringLiteral("uploadTime")].toDouble()); - esi.exerciseName = obj[QStringLiteral("exerciseName")].toString(); - esi.exerciseId = obj[QStringLiteral("exerciseId")].toInt(); - - Q_ASSERT(esi.scriptId != -1); - Q_ASSERT(esi.exerciseId != -1); - - if (esi.scriptId != -1 && esi.exerciseId != -1) - esi.valid = true; - - return esi; -} - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/Common/tpm_exported_scripts_model.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/Common/tpm_exported_scripts_model.h deleted file mode 100755 index 29b282151..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/Common/tpm_exported_scripts_model.h +++ /dev/null @@ -1,93 +0,0 @@ - - -#pragma once - -#include - -#include -#include -#include -#include "thpcommon_export.h" - - -namespace TakeHomePackageManager -{ - -enum UploadState -{ - ThpUnknownUploadState, - ThpUploadNotActive, - ThpConnectToHost, - ThpUploadActive, - ThpAlreadyUploaded, - ThpUploadError, -}; - -struct ExportedScriptInformation -{ - bool valid { false }; - - QString exerciseName; - QString scriptName; - QString jsonPath; - QString rootDirectory; - qint64 exerciseId = -1; - qint64 exportTime = 0; - qint64 fileSize = 0; - bool local = true; - UploadState uploaded = ThpUnknownUploadState; - qint64 uploadTime = 0; - int scriptId = -1; - - int id() const { return scriptId; } - - QJsonValue toJson() const; - static ExportedScriptInformation fromJson(const QJsonValue &val, - const bool local = true, - const UploadState uploadStates = ThpUnknownUploadState); -}; - - - -class THPCOMMON_EXPORT ExportedScriptsModel : public LtsWidgets::LtsAbstractTableModel -{ - Q_OBJECT -public: - enum Columns - { - ColId, - ColExercise, - ColName, - ColCreated, - ColDownloaded, - ColLocation, - ColUploadedTime, - ColUploaded, - }; - explicit ExportedScriptsModel(QObject *parent = nullptr); - - bool init(const QString &rootDirectoryToScan); - void setServerContent(const QString &jsonArray); - void setOC(bool isOC) { m_isOC = isOC; } - - - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; - bool removeRow(int row) override; - bool setLocalState(const int row, const bool localHost); - bool setUploadState(const int row, const UploadState uploadState, const qint64 uploadTime, const qint64 fileSize); - bool createDataJson(const QString &rootDirectory, const std::shared_ptr &exmDtc, - const std::shared_ptr &asmDtc, - int exerciseId) const; - void addDownloadData(const ExportedScriptInformation &esi); - -private: - -NGL::INGLLogger &m_logger; - QString exercisePath(const QString &rootDirectory, const int exerciseId) const; - qint64 downloadTime(const ExportedScriptInformation &val) const; - -private: - bool m_isOC { false }; - QString m_rootDirectoryToScan; -}; -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/Common/tpm_process_dialog.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/Common/tpm_process_dialog.cpp deleted file mode 100755 index a9f625e97..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/Common/tpm_process_dialog.cpp +++ /dev/null @@ -1,66 +0,0 @@ -#include "tpm_process_dialog.h" -#include "ui_tpm_process_dialog.h" - - -namespace TakeHomePackageManager -{ -ProcessOverlay::ProcessOverlay(QWidget *parent) - : QWidget(parent) - , m_ui(new Ui::ProcessOverlay) -{ - m_ui->setupUi(this); - - connect(m_ui->pbCancel, &QPushButton::clicked, - this, [this]() - { - m_ui->pbCancel->setEnabled(false); - emit signalCancel(); - }); -} - - -ProcessOverlay::~ProcessOverlay() -{ - delete m_ui; -} - - -void ProcessOverlay::setCancelEnabled(bool enabled) -{ - m_ui->pbCancel->setEnabled(enabled); -} - - -void ProcessOverlay::setStatus(const QString &text, qint64 totalFiles, qint64 curFile, qint64 totalSize, qint64 curPos, const QString &curName) -{ - if (!text.isEmpty()) - m_ui->lblStatus->setText(text); - - if (!curName.isEmpty()) - m_ui->lblFilename->setText(curName); - - double progressBytes = (totalSize == 0) ? (double)0 : ((double)curPos / (double)totalSize); - double progressFiles = (((double)curFile - 1) / (double)totalFiles); - double progressTotal = progressFiles + (progressBytes / (double)totalFiles); - - progressBytes = qRound(progressBytes * 100); - progressFiles = qRound(progressFiles * 100); - progressTotal = qRound(progressTotal * 100); - - m_ui->pbarFiles->setValue(progressFiles); - m_ui->pbarBytes->setValue(progressBytes); - m_ui->pbarProgress->setValue(progressTotal); - - QLocale l; - - if (curFile == 0) - m_ui->lblFiles->setText(QStringLiteral(" - ")); - else - m_ui->lblFiles->setText(QStringLiteral("%1 / %2").arg(l.toString(curFile)).arg(l.toString(totalFiles))); - - if (curPos == 0) - m_ui->lblBytes->setText(QStringLiteral(" - ")); - else - m_ui->lblBytes->setText(QStringLiteral("%1 / %2").arg(l.toString(curPos)).arg(l.toString(totalSize))); -} -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/Common/tpm_process_dialog.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/Common/tpm_process_dialog.h deleted file mode 100755 index 147a057fb..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/Common/tpm_process_dialog.h +++ /dev/null @@ -1,32 +0,0 @@ -#pragma once - -#include "thpcommon_export.h" - -#include - - -namespace Ui -{ -class ProcessOverlay; -} - -namespace TakeHomePackageManager -{ -class THPCOMMON_EXPORT ProcessOverlay : public QWidget -{ - Q_OBJECT -public: - ProcessOverlay(QWidget *parent = nullptr); - ~ProcessOverlay(); - - void setStatus(const QString &text = QString(), qint64 totalFiles = 1, qint64 curFile = 1, qint64 totalSize = 0, qint64 curPos = 0, const QString &curName = QString()); - void setCancelEnabled(bool enabled = true); - -signals: - void signalCancel(); - -private: - Ui::ProcessOverlay *m_ui; - bool m_decompressing { false }; -}; -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/Common/tpm_process_dialog.ui b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/Common/tpm_process_dialog.ui deleted file mode 100755 index 5a0ef934d..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/Common/tpm_process_dialog.ui +++ /dev/null @@ -1,174 +0,0 @@ - - - ProcessOverlay - - - - 0 - 0 - 700 - 220 - - - - - 0 - 0 - - - - - 700 - 0 - - - - Form - - - - - - - - - - - - - - Progress - - - - - - - - 0 - 0 - - - - 0 - - - - - - - - - - - - - - - Preparing ... - - - - - - - Files - - - - - - - - 0 - 0 - - - - 0 - - - - - - - 0 - - - - - - 0 - 0 - - - - Cancel - - - - - - - - - - 0 - 0 - - - - Qt::Horizontal - - - - - - - - - - - - - - - Bytes - - - - - - - - 0 - 0 - - - - 0 - - - - - - - Filename - - - - - - - - 0 - 0 - - - - Qt::Horizontal - - - - - - - - diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpManagement/CMakeLists.txt b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpManagement/CMakeLists.txt deleted file mode 100755 index 306a81747..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpManagement/CMakeLists.txt +++ /dev/null @@ -1,65 +0,0 @@ -# -# $Id: CMakeLists.txt 51804 2020-07-31 04:47:28Z fritsche_h $ -# $HeadURL: svn://slssvn/TDS/branches/product/iterations/21_03_salted_caramel/Lts/Plugins/TakeHomePackageManager/CMakeLists.txt $ -# $Author: fritsche_h $ -# -# Created by Gerlinde Rudolphus, NLE, 2019-03-25 -# - -# -# Common -# -# Make ${Qt6_Widgets} optional -if(QT6_GUI_AVAILABLE AND TARGET Qt6::Widgets) - set(Qt6_Widgets ${Qt6_Widgets}) -else() - set(Qt6_Widgets "") -endif() - -# Make ${Qt6_WebSockets} optional -if(QT6_GUI_AVAILABLE AND TARGET Qt6::WebSockets) - set(Qt6_WebSockets ${Qt6_WebSockets}) -else() - set(Qt6_WebSockets "") -endif() - - -SET(thp_SRCS - tpm_gui_plugin.cpp - tpm_gui_plugin.h - tpm_exported_scripts_dialog.cpp - tpm_exported_scripts_dialog.h - logger.cpp - logger.h -) - -QT5_WRAP_UI(thp_SRCS - tpm_exported_scripts_dialog.ui -) - -#TODO: auto-remove "libTakeHomePackageManagerGuiPlugin.so" from lib as this lib replaces it - -NGL_ADD_LIBRARY2(WS ThpManagementGuiPlugin MODULE ${thp_SRCS}) -if(QT6_GUI_AVAILABLE) - NGL_TARGET_LINK_LIBRARIES(ThpManagementGuiPlugin - ThpCommon - TpmGuiPluginInterface - ${Qt6_Widgets} - Qt6::Network - ${Qt6_WebSockets} - NGLLogger - LtsWidgets - LtsSession - LtsDataView - nglcompression - nglsettings - ngltools - AsmDataPluginInterface - ExmDataPluginInterface - LtsSessionData - httq - ) -endif() - -NGL_INSTALL_TARGET(ThpManagementGuiPlugin) - diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpManagement/logger.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpManagement/logger.cpp deleted file mode 100755 index ffd55931c..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpManagement/logger.cpp +++ /dev/null @@ -1,32 +0,0 @@ - - - -#include "logger.h" - -#include - -namespace TakeHomePackageManager -{ - -LOGGER_T getLogger(const char *name) -{ - static const char ns[] = "TPM."; - std::string loggerName; - const size_t len = strlen(name); - loggerName.reserve(sizeof(ns) + len); - loggerName.append(ns, sizeof(ns) - 1); - loggerName.append(name, len); - - try - { - return NGL::NGLLoggerBootstrap::getNGLRootLogger(). - getNGLLogger(loggerName); - } - catch (const std::exception &ex) - { - fprintf(stderr, "Error retrieving logger: %s", ex.what()); - abort(); - } -} - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpManagement/logger.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpManagement/logger.h deleted file mode 100755 index 02b407a94..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpManagement/logger.h +++ /dev/null @@ -1,17 +0,0 @@ - - - -#pragma once - -#include - -namespace TakeHomePackageManager -{ -typedef NGL::INGLLogger &LOGGER_T; - -LOGGER_T getLogger(const char *name); -inline LOGGER_T getLogger(const QString &loggerName) -{ - return getLogger(loggerName.toUtf8().constData()); -} -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpManagement/tpm_exported_scripts_dialog.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpManagement/tpm_exported_scripts_dialog.cpp deleted file mode 100755 index 41f89d019..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpManagement/tpm_exported_scripts_dialog.cpp +++ /dev/null @@ -1,1224 +0,0 @@ - - - - - - -#include "ui_tpm_exported_scripts_dialog.h" -#include "tpm_exported_scripts_dialog.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#ifndef ELOG -#define ELOG ERROR_LOG(m_logger) -#endif - - -namespace TakeHomePackageManager -{ - - -HttpProcess::HttpProcess(ExportedScriptInformation &&esi, QObject *parent) : QObject(parent) - , m_esi(esi) - , m_process(new ProcessOverlay) - , m_nam(new QNetworkAccessManager(this)) - , m_timeout(new QTimer(this)), - m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger()) { - connect(m_process, &ProcessOverlay::signalCancel, - this, [this]() - { - DEBUG_LOG(m_logger) << "m_wasCanceled!!"; - m_wasCanceled = true; - m_process->setCancelEnabled(false); - }); - connect(m_process, &ProcessOverlay::signalCancel, - this, &HttpProcess::signalCancel); - - - - int timeout = 30 * 1000; - QVariant timeoutVar(LtsSessionData::LtsSessionData::getInstance()->debugFlagValue(QStringLiteral("TPM.Timeout"))); - - if (timeoutVar.canConvert(QMetaType::Int)) - { - bool k = false; - int _timeout = timeoutVar.toInt(&k); - - DEBUG_LOG(m_logger) << "TPM.Timeout debug value set! k = " << k << "_timeout = " << _timeout; - - if (k) - { - timeout = _timeout; - DEBUG_LOG(m_logger) << "new timeout set to " << timeout; - } - } - - m_timeout->setInterval(timeout); - m_timeout->setSingleShot(true); - m_timeout->start(); - - connect(m_timeout, &QTimer::timeout, - this, [this]() - { - stopTimeout(); - new LtsWidgets::LtsMessageDialogNew(qobject_cast(this->parent()), tr("Timeout occured during the operation - aborted")); - WARNING_LOG(m_logger) << "Timeout occured during the operation - aborted"; - m_isTimeout = true; - - emit signalTimeout(); - }); -} - - -HttpProcess::~HttpProcess() -{ - DEBUG_LOG(m_logger) << "~HttpProcess"; - delete m_process; - -} - - -void HttpProcess::doConnections(QNetworkReply *r) -{ - connect(r, &QNetworkReply::readyRead, - this, &HttpProcess::slotReadyRead); - -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) - connect(r, &QNetworkReply::errorOccurred, - this, &HttpProcess::slotError); -#else - connect(r, QOverload::of(&QNetworkReply::error), - this, &HttpProcess::slotError); -#endif - - connect(r, &QNetworkReply::finished, - this, &HttpProcess::slotSuccess); - connect(r, &QNetworkReply::uploadProgress, - this, &HttpProcess::resetTimeout); - connect(r, &QNetworkReply::downloadProgress, - this, &HttpProcess::resetTimeout); -} - - -QNetworkRequest HttpProcess::forgeRequest(const QString &path, const QUrlQuery &q, const QString &contentType) -{ - -#ifndef WIN32 - QUrl url(QStringLiteral("http://%1:%2%3").arg(NGL::Connections::hostName(NGL::Connections::eConnection::FLM_THP_SERVER)).arg(NGL::Connections::port(NGL::Connections::eConnection::FLM_THP_SERVER)).arg(path)); -#else - NGL::Settings *s = new NGL::Settings(NGL::findProjectConfigFile()); - const QString hostname = s->getString(QStringLiteral("TabOC"), QStringLiteral("remoteServerHostname"), QStringLiteral("exctds01")); - QUrl url(QStringLiteral("http://%1:%2%3").arg(hostname).arg(NGL::Connections::port(NGL::Connections::eConnection::FLM_THP_SERVER)).arg(path)); - delete s; -#endif - url.setQuery(q); - - QNetworkRequest r; - if (!contentType.isEmpty()) - r.setHeader(QNetworkRequest::KnownHeaders::ContentTypeHeader, contentType); - r.setUrl(url); - - return std::move(r); -} - - -QNetworkReply *HttpProcess::post(const QString &path, QIODevice *data, const QUrlQuery &q, const QString &contentType) -{ - QNetworkReply *r = m_nam->post(forgeRequest(path, q, contentType), data); - doConnections(r); - return r; -} - - -QNetworkReply *HttpProcess::get(const QString &path, const QUrlQuery &q) -{ - QNetworkReply *r = m_nam->get(forgeRequest(path, q)); - doConnections(r); - return r; -} - - -QNetworkReply *HttpProcess::deleteResource(const QString &path, const QUrlQuery &q) -{ - QNetworkReply *r = m_nam->deleteResource(forgeRequest(path, q)); - doConnections(r); - return r; -} - - -void HttpProcess::slotSuccess() -{ - DEBUG_LOG(m_logger) << "success"; - - stopTimeout(); - if (!m_isError && !m_wasCanceled && !m_isTimeout) - emit signalSuccess(); -} - - -void HttpProcess::slotError() -{ - DEBUG_LOG(m_logger) << "error"; - - stopTimeout(); - - if (!m_wasCanceled && !m_isTimeout && !m_isError ) - { - m_isError = true; - - QNetworkReply *r = qobject_cast(sender()); - if (r != nullptr) - { - ELOG << "network error: " << r->errorString(); - new LtsWidgets::LtsMessageDialogNew(qobject_cast(parent()), tr("Operation failed because of a network error")); - } - } - - emit signalError(); -} - - -void HttpProcess::slotReadyRead() -{ - DEBUG_LOG(m_logger) << "readyRead"; - resetTimeout(); - - QNetworkReply *r = qobject_cast(sender()); - if (r == nullptr) - return; - - r->startTransaction(); - - QByteArray data(r->readAll()); - - if (r->attribute(QNetworkRequest::HttpStatusCodeAttribute) == 200) - { - r->rollbackTransaction(); - emit signalReadyRead(); - return; - } - - - m_isError = true; - stopTimeout(); - r->commitTransaction(); - - ELOG << "server error: data = '" << data << "' http status: " << r->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); - - QJsonParseError err; - QJsonDocument doc(QJsonDocument::fromJson(data, &err)); - - if (err.error != QJsonParseError::NoError) - { - ELOG << "didn't receive a valid json from server at " << err.offset << ": " << err.errorString() << " - message was: '" << data << "'"; - return; - } - - QString errorMsg(doc.object()[QStringLiteral("error")].toString()); - - if (errorMsg.isEmpty()) - ELOG << "server sent empty error"; - else - ELOG << "server sent error: " << errorMsg; - - new LtsWidgets::LtsMessageDialogNew(qobject_cast(this->parent()), tr("The server failed to process the operation")); -} - - -void HttpProcess::resetTimeout() -{ - if (m_timeout->isActive()) - m_timeout->start(); -} - - -void HttpProcess::stopTimeout() -{ - m_timeout->stop(); -} - - - - -UploadProcess::UploadProcess(const QString &rootFolder, ExportedScriptInformation &&esi, QObject *parent) - : HttpProcess(std::move(esi), parent) - , m_tempFile(new QTemporaryFile(this)) - , m_compress(new NGL::Compress(this)) - , m_rootDir(rootFolder) -{ - - - m_process->setStatus(tr("Preparing Script upload ...")); - - - connect(m_compress, &NGL::Compress::compressInfoEx, - this, [this](qint64 totalFiles, qint64 curFile, qint64 totalSize, qint64 curPos, const QString &curName, qint64 ) - { - resetTimeout(); - m_process->setStatus(tr("Compressing files ..."), totalFiles, curFile, totalSize, curPos, curName); - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - }); - - connect(m_compress, &NGL::Compress::error, - this, [this](const QString &errStr) - { - stopTimeout(); - new LtsWidgets::LtsMessageDialogNew(qobject_cast(this->parent()), tr("Error during compression of script directory: %1").arg(errStr)); - - abortCompress(); - }); - - connect(this, &UploadProcess::signalTimeout, - this, [this]() - { - abortCompress(); - }); - - connect(this, &UploadProcess::signalCancel, - this, [this]() - { - abortCompress(); - }); - - - if (!m_tempFile->open()) - { - stopTimeout(); - QString msg(tr("Cannot open temporary file: %1").arg(m_tempFile->errorString())); - ELOG << msg << " (" << m_tempFile->fileName() << ")"; - new LtsWidgets::LtsMessageDialogNew(qobject_cast(this->parent()), msg); - deleteLater(); - return; - } - - - QString dstDir(QString::number(m_esi.scriptId)); - QString srcDir(QStringLiteral("%1/%2").arg(ExportedScriptsDialog::getContentFolder(m_rootDir, m_esi.exerciseId), dstDir)); - - - - - DEBUG_LOG(m_logger) << "TPM.TestBigFile? " << LtsSessionData::LtsSessionData::getInstance()->debugFlagValue(QStringLiteral("TPM.TestBigFile")).toString(); - DEBUG_LOG(m_logger) << "TPM.TestBigFile check? " - << (LtsSessionData::LtsSessionData::getInstance()->debugFlagValue(QStringLiteral("TPM.TestBigFile")) == QVariant(true)); - -#ifndef LTS_DEBUG - if (LtsSessionData::LtsSessionData::getInstance()->debugFlagValue(QStringLiteral("TPM.TestBigFile")) == QVariant(true)) -#endif - { - DEBUG_LOG(m_logger) << "TPM.TestBigFile!!"; - - if (QGuiApplication::queryKeyboardModifiers() == Qt::ControlModifier) - { - QFile test(QStringLiteral("%1/%2/big.file").arg(ExportedScriptsDialog::getContentFolder(m_rootDir, m_esi.exerciseId), dstDir)); - DEBUG_LOG(m_logger) << ">>> BIG FILE ACTIVE ("<hasDebugFlag(bigFileSize)) - { - bool k = false; - int _times = LtsSessionData::LtsSessionData::getInstance()->debugFlagValue(bigFileSize).toInt(&k); - - if (!k) - DEBUG_LOG(m_logger) << "Invalid value for " << bigFileSize; - else - { - times = _times; - DEBUG_LOG(m_logger) << "big file size was set to " << times; - } - } - else - DEBUG_LOG(m_logger) << "TPM.TestBigFile.Size not set - using default of " << times; - - - for (int i = 0; i < times; i++) - { - rng.waitForReadyRead(10000); - test.write(rng.read(1024)); - } - - test.flush(); - - m_tempFile->setAutoRemove(false); - DEBUG_LOG(m_logger) << "big compressed file: " << m_tempFile->fileName(); - } - } - - - connect(m_compress, &NGL::Compress::finished, - this, &UploadProcess::compressionDone); - - DEBUG_LOG(m_logger) << "compress called..."; - m_compress->compress(m_tempFile, srcDir, dstDir); - DEBUG_LOG(m_logger) << "...!"; -} - - -void UploadProcess::abortCompress() -{ - m_process->setCancelEnabled(false); - m_compress->abort(); - connect(m_compress, &NGL::Compress::finished, - this, &QObject::deleteLater); -} - - -void UploadProcess::compressionDone() -{ - DEBUG_LOG(m_logger) << "m_wasCanceled = " << m_wasCanceled << ", compress success = " << m_compress->success(); - stopTimeout(); - - if (!m_compress->success() || m_wasCanceled) - { - DEBUG_LOG(m_logger) << "compression aborted"; - deleteLater(); - return; - } - - DEBUG_LOG(m_logger) << "okay"; - - QUrlQuery q; - q.addQueryItem(QStringLiteral("exerciseId"), QString::number(m_esi.exerciseId)); - q.addQueryItem(QStringLiteral("scriptId"), QString::number(m_esi.scriptId)); - q.addQueryItem(QStringLiteral("exerciseName"), m_esi.exerciseName); - q.addQueryItem(QStringLiteral("name"), m_esi.scriptName); - - - DEBUG_LOG(m_logger) << "posting file of size " << m_tempFile->size(); - m_tempFile->seek(0); - - QNetworkReply *rep = post(QStringLiteral("/thp"), m_tempFile, q); - - connect(this, &HttpProcess::signalSuccess, - this, [this]() - { - DEBUG_LOG(m_logger) << "Uploaded script successfully"; - new LtsWidgets::LtsMessageDialogNew(qobject_cast(parent()), tr("Uploaded script successfully")); - deleteLater(); - }); - - - disconnect(this, &UploadProcess::signalCancel, - this, nullptr); - connect(this, &UploadProcess::signalCancel, - rep, &QNetworkReply::abort); - - - disconnect(this, &UploadProcess::signalTimeout, - this, nullptr); - connect(this, &UploadProcess::signalTimeout, - rep, &QNetworkReply::abort); - - - connect(this, &UploadProcess::signalError, - this, &UploadProcess::deleteLater); - - - connect(rep, &QNetworkReply::uploadProgress, - this, [this](qint64 bytesSent, qint64 bytesTotal) - { - - m_process->setStatus(tr("Uploading ..."), 1, 1, bytesTotal, bytesSent); - }); -} - - - - -DownloadProcess::DownloadProcess(const QString &rootFolder, int modelRowId, ExportedScriptInformation &&esi, QObject *parent) - : HttpProcess(std::move(esi), parent) - , m_tempFile(new QTemporaryFile(this)) - , m_modelRowId(modelRowId) - , m_rootFolder(rootFolder) -{ - m_process->setStatus(tr("Preparing Script download ...")); - - if (!m_tempFile->open()) - { - stopTimeout(); - QString msg(tr("Cannot open temporary file: %1 - aborted").arg(m_tempFile->errorString())); - ELOG << msg << " (" << m_tempFile->fileName() << ")"; - new LtsWidgets::LtsMessageDialogNew(qobject_cast(this->parent()), msg); - deleteLater(); - return; - } - - - QUrlQuery q; - q.addQueryItem(QStringLiteral("exerciseId"), QString::number(m_esi.exerciseId)); - q.addQueryItem(QStringLiteral("scriptId"), QString::number(m_esi.scriptId)); - - QNetworkReply *rep = get(QStringLiteral("/thp"), q); - - - connect(this, &HttpProcess::signalReadyRead, - this, [this, rep]() - { - m_tempFile->write(rep->readAll()); - }); - - - connect(rep, &QNetworkReply::downloadProgress, - this, [this](qint64 bytesSent, qint64 bytesTotal) - { - m_process->setStatus(tr("Downloading ..."), 1, 1, bytesTotal, bytesSent); - - }); - - - connect(this, &DownloadProcess::signalCancel, - rep, &QNetworkReply::abort); - - - connect(this, &DownloadProcess::signalTimeout, - rep, &QNetworkReply::abort); - - - connect(this, &DownloadProcess::signalError, - this, &DownloadProcess::deleteLater); - - - connect(this, &DownloadProcess::signalSuccess, - this, &DownloadProcess::downloadFinished); -} - - -void DownloadProcess::downloadFinished() -{ - m_process->setStatus(tr("Preparing Script decompression ...")); - m_compress = new NGL::Compress(this); - - - connect(m_compress, &NGL::Compress::uncompressInfo, - this, [this](qint64 size, qint64 pos, const QString &file) - { - resetTimeout(); - m_process->setStatus(tr("Decompressing ..."), 1, 1, size, pos, file); - - }); - - - connect(m_compress, &NGL::Compress::error, - this, [this](const QString &errStr) - { - stopTimeout(); - new LtsWidgets::LtsMessageDialogNew(qobject_cast(this->parent()), tr("Error during decompression of script directory: %1").arg(errStr)); - - - m_compress->abort(); - connect(m_compress, &NGL::Compress::finished, - this, &QObject::deleteLater); - }); - - - disconnect(this, &DownloadProcess::signalTimeout, - nullptr, nullptr); - connect(this, &DownloadProcess::signalTimeout, - this, [this]() - { - - m_compress->abort(); - connect(m_compress, &NGL::Compress::finished, - this, &QObject::deleteLater); - }); - - - - disconnect(this, &DownloadProcess::signalCancel, - nullptr, nullptr); - connect(this, &DownloadProcess::signalCancel, - this, [this]() - { - - m_compress->abort(); - connect(m_compress, &NGL::Compress::finished, - this, &QObject::deleteLater); - }); - - - connect(m_compress, &NGL::Compress::finished, - this, [this] - { - stopTimeout(); - - DEBUG_LOG(m_logger) << "m_compress->success()? " << m_compress->success() << ", m_wasCanceled? " << m_wasCanceled << ", m_isError? " << m_isError; - if (m_compress->success() && !m_wasCanceled && !m_isError) - { - new LtsWidgets::LtsMessageDialogNew(qobject_cast(parent()), tr("Downloaded script successfully")); - emit signalDone(); - } - - deleteLater(); - }); - - - m_tempFile->seek(0); - m_compress->uncompress(m_tempFile, ExportedScriptsDialog::getContentFolder(m_rootFolder, m_esi.exerciseId)); -} - - - - -RemoveProcess::RemoveProcess(int modelRowId, ExportedScriptInformation &&esi, QObject *parent) - : HttpProcess(std::move(esi), parent) - , m_modelRowId(modelRowId) -{ - m_process->setStatus(tr("Requesting Script deletion on server ...")); - - QUrlQuery q; - q.addQueryItem(QStringLiteral("exerciseId"), QString::number(m_esi.exerciseId)); - q.addQueryItem(QStringLiteral("scriptId"), QString::number(m_esi.scriptId)); - - QNetworkReply *rep = deleteResource(QStringLiteral("/thp"), q); - - - connect(this, &RemoveProcess::signalTimeout, - rep, &QNetworkReply::abort); - - - connect(this, &RemoveProcess::signalCancel, - rep, &QNetworkReply::abort); - - - connect(this, &RemoveProcess::signalError, - this, &RemoveProcess::deleteLater); - - - connect(this, &HttpProcess::signalSuccess, - this, [this]() - { - new LtsWidgets::LtsMessageDialogNew(qobject_cast(this->parent()), tr("Script was removed from server successfully")); - deleteLater(); - }); -} - - - - -ExportedScriptsDialog::ExportedScriptsDialog(QWidget *parent) - : LtsWidgets::LtsDialog(parent) - , m_model(new ExportedScriptsModel(this)) - , m_ui(new Ui::ExportedScriptsDialog) - , m_session(nullptr) - , m_fsWatcher(new QFileSystemWatcher(this)) -{ - m_ui->setupUi(this); - - m_buttonBox->connectButton(LtsWidgets::DialogButton::Remove, this, &ExportedScriptsDialog::removeScriptLocal); - - m_buttonBox->getButton(LtsWidgets::DialogButton::Show)->setEnabled(false); - m_buttonBox->getButton(LtsWidgets::DialogButton::Remove)->setEnabled(false); - m_buttonBox->getButton(LtsWidgets::DialogButton::Save)->setEnabled(false); - m_buttonBox->getButton(LtsWidgets::DialogButton::Import)->setEnabled(false); - - connect(m_ui->ltsDataView, &LtsDataView::LtsDataView::signalSelectionChanged, this, &ExportedScriptsDialog::onSelectionChanged); - - connect(m_fsWatcher, &QFileSystemWatcher::directoryChanged, - this, &ExportedScriptsDialog::initModel); - connect(m_fsWatcher, &QFileSystemWatcher::fileChanged, - this, &ExportedScriptsDialog::initModel); - - - setOnlineHelpFilename(QStringLiteral("Script_Editor-Export_Script_Administration")); -} - - -ExportedScriptsDialog::~ExportedScriptsDialog() -{ - delete m_ui; -} - - -void ExportedScriptsDialog::onSelectionChanged() -{ - const QModelIndexList mil = m_ui->ltsDataView->selectedRows(); - - if (mil.size() != 1) - { - m_buttonBox->getButton(LtsWidgets::DialogButton::Show)->setEnabled(false); - m_buttonBox->getButton(LtsWidgets::DialogButton::Remove)->setEnabled(false); - m_buttonBox->getButton(LtsWidgets::DialogButton::Save)->setEnabled(false); - m_buttonBox->getButton(LtsWidgets::DialogButton::Import)->setEnabled(false); - return; - } - - const ExportedScriptInformation esi = m_model->getRowData(mil.first().row()); - if (m_session->app() != LtsAppDescriptor::App::OC) - { - if (esi.local) - { - m_buttonBox->getButton(LtsWidgets::DialogButton::Remove)->setEnabled(true); - m_buttonBox->getButton(LtsWidgets::DialogButton::Save)->setEnabled(true); - } - else - { - m_buttonBox->getButton(LtsWidgets::DialogButton::Remove)->setEnabled(false); - m_buttonBox->getButton(LtsWidgets::DialogButton::Save)->setEnabled(false); - } - if (esi.uploaded == ThpAlreadyUploaded) - { - m_buttonBox->getButton(LtsWidgets::DialogButton::Import)->setEnabled(true); - } - else - { - m_buttonBox->getButton(LtsWidgets::DialogButton::Import)->setEnabled(false); - } - } - else - { - if (esi.uploaded == ThpAlreadyUploaded) - { - m_buttonBox->getButton(LtsWidgets::DialogButton::Save)->setEnabled(true); - m_buttonBox->getButton(LtsWidgets::DialogButton::Import)->setEnabled(true); - } - else - { - m_buttonBox->getButton(LtsWidgets::DialogButton::Import)->setEnabled(false); - } - if (esi.local) - { - m_buttonBox->getButton(LtsWidgets::DialogButton::Show)->setEnabled(true); - m_buttonBox->getButton(LtsWidgets::DialogButton::Remove)->setEnabled(true); - } - else - { - m_buttonBox->getButton(LtsWidgets::DialogButton::Show)->setEnabled(false); - m_buttonBox->getButton(LtsWidgets::DialogButton::Remove)->setEnabled(false); - } - } -} - - -void ExportedScriptsDialog::retranslate() -{ - translate(m_ui, tr("Manage exported scripts")); - m_buttonBox->getButton(LtsWidgets::DialogButton::Remove)->setText(tr("Remove local")); - - Q_ASSERT(m_session != nullptr); - - if (m_session->app() != LtsAppDescriptor::App::OC) - { - m_buttonBox->getButton(LtsWidgets::DialogButton::Save)->setText(tr("Upload to Server")); - m_buttonBox->getButton(LtsWidgets::DialogButton::Import)->setText(tr("Remove from Server")); - } - else - { - m_buttonBox->getButton(LtsWidgets::DialogButton::Save)->setText(tr("Download from Server")); - } - - setWsConnectionStatusLabel(); -} - - -void ExportedScriptsDialog::setWsConnectionStatus(WsConnectionStatus status) -{ - m_wsStatus = status; - setWsConnectionStatusLabel(); -} - - -void ExportedScriptsDialog::setWsConnectionStatusLabel() -{ - QString str; - QColor color; - - switch (m_wsStatus) - { - case WsConnectionStatus::NotConnected: - { - str = tr("Not connected"); - color = QColor::fromRgb(100, 100, 100); - break; - } - - case WsConnectionStatus::Disconnected: - { - str = tr("Disconnected"); - color = QColor::fromRgb(100, 100, 100); - break; - } - - case WsConnectionStatus::Error: - { - str = tr("Connection error"); - color = QColor::fromRgb(200, 55, 0); - break; - } - - case WsConnectionStatus::Connecting: - { - str = tr("Connecting ..."); - color = QColor::fromRgb(100, 100, 0); - break; - } - - case WsConnectionStatus::Connected: - { - str = tr("Connected"); - color = QColor::fromRgb(50, 200, 50); - break; - } - } - - m_ui->lblWsStatus->setText(QStringLiteral("%1").arg(str, color.name())); -} - - -bool ExportedScriptsDialog::init(LtsSession::LtsSession *session) -{ - m_session = session; - m_exerciseId = m_session->exerciseId(); - - m_fsWatcher->addPath(getRootFolder()); - m_fsWatcher->addPath(getContentFolder(m_session->exerciseId())); - - if (m_session->app() != LtsAppDescriptor::App::OC) - { - m_buttonBox->connectButton(LtsWidgets::DialogButton::Save, this, &ExportedScriptsDialog::uploadScript); - m_buttonBox->connectButton(LtsWidgets::DialogButton::Import, this, &ExportedScriptsDialog::removeScriptFromServer); - } - else - { - m_buttonBox->connectButton(LtsWidgets::DialogButton::Save, this, &ExportedScriptsDialog::downloadScript); - m_buttonBox->connectButton(LtsWidgets::DialogButton::Show, this, &ExportedScriptsDialog::openScript); - } - - - if (!QDir().mkpath(getContentFolder(m_exerciseId))) - { - QString msg(tr("Cannot create script folder at %1").arg(getContentFolder(m_exerciseId))); - ERROR_LOG(m_logger) << msg; - return false; - } - - - - QWebSocket *sock = new QWebSocket(); - sock->setParent(this); - - auto openFn = [this, sock]() - { - setWsConnectionStatus(WsConnectionStatus::Connecting); -#ifndef WIN32 - sock->open(QUrl(QStringLiteral("ws://%1:%2/thp").arg(NGL::Connections::hostName(NGL::Connections::eConnection::FLM_THP_SERVER)).arg(NGL::Connections::port(NGL::Connections::eConnection::FLM_THP_SERVER)))); -#else - NGL::Settings *s = new NGL::Settings(NGL::findProjectConfigFile()); - const QString hostname = s->getString(QStringLiteral("TabOC"), QStringLiteral("remoteServerHostname"), QStringLiteral("exctds01")); - WARNING_LOG(m_logger) << "Hostname used for THP: " << hostname; - sock->open(QUrl(QStringLiteral("ws://%1:%2/thp").arg(hostname).arg(NGL::Connections::port(NGL::Connections::eConnection::FLM_THP_SERVER)))); - delete s; -#endif - }; - - openFn(); - - - connect(sock, &QWebSocket::connected, - this, [this]() - { - setWsConnectionStatus(WsConnectionStatus::Connected); - - }); - - - connect(sock, QOverload::of(&QWebSocket::error), - this, [this, sock]() - { - setWsConnectionStatus(WsConnectionStatus::Error); - ELOG << "ws error: " << sock->errorString(); - - }, Qt::QueuedConnection ); - - - connect(sock, &QWebSocket::disconnected, - this, [this, sock, openFn]() - { - WARNING_LOG(m_logger) << "disconnected from ws... reconnecting in 3..."; - setWsConnectionStatus(WsConnectionStatus::Disconnected); - - QTimer *t = new QTimer(sock); - t->setInterval(3000); - t->setSingleShot(true); - - connect(t, &QTimer::timeout, - sock, [this, t, sock, openFn]() - { - openFn(); - t->deleteLater(); - }); - - t->start(); - }, Qt::QueuedConnection ); - - - connect(sock, &QWebSocket::textMessageReceived, - this, [this](const QString &msg) - { - DEBUG_LOG(m_logger) << "new msg: '" << msg << "'"; - m_lastServerContent = msg; - m_model->setServerContent(msg); - onSelectionChanged(); - }); - - - return initModel(); -} - - -bool ExportedScriptsDialog::initModel() -{ - DEBUG_LOG(m_logger) << "(re)initModel !!"; - - QString rootDirectory(getRootFolder()); - - if (!m_model->init(rootDirectory)) - return false; - - - std::shared_ptr exmDtc; - std::shared_ptr asmDtc; - if (m_session->app() == LtsAppDescriptor::App::OC && - m_session->getDtc(asmDtc) && - m_session->getDtc(exmDtc)) - { - if (!m_model->createDataJson(rootDirectory, exmDtc, asmDtc, m_session->exerciseId())) - { - return false; - } - } - - - m_model->setOC(m_session->app() == LtsAppDescriptor::App::OC); - - - m_ui->ltsDataView->setModel(m_model); - if (m_session->app() == LtsAppDescriptor::App::OC) - m_ui->ltsDataView->hideColumn(ExportedScriptsModel::Columns::ColUploaded); - - -#ifndef LTS_DEBUG - m_ui->ltsDataView->hideColumn(ExportedScriptsModel::ColId); -#endif - - if (m_session->app() == LtsAppDescriptor::App::OC) - m_ui->ltsDataView->hideColumn(ExportedScriptsModel::ColCreated); - else - m_ui->ltsDataView->hideColumn(ExportedScriptsModel::ColDownloaded); - - - - m_model->setServerContent(m_lastServerContent); - - onSelectionChanged(); - - return true; -} - - -void ExportedScriptsDialog::uploadScript() -{ - const QModelIndexList mil = m_ui->ltsDataView->selectedRows(); - if (mil.size() != 1) - return; - ExportedScriptInformation esi = m_model->getRowData(mil.first().row()); - - auto up = new UploadProcess(getRootFolder(), std::move(esi), this); - setOverlay(up->process()); -} - - -void ExportedScriptsDialog::downloadScript() -{ - const QModelIndexList mil = m_ui->ltsDataView->selectedRows(); - if (mil.size() != 1) - return; - const QModelIndex mi = mil.first(); - ExportedScriptInformation esi = m_model->getRowData(mi.row()); - - auto dp = new DownloadProcess(getRootFolder(), m_model->getId(mi), std::move(esi), this); - setOverlay(dp->process()); - - - connect(dp, &DownloadProcess::signalDone, - this, [this, dp]() - { - const QModelIndex mi = m_model->findIndexForId(dp->modelRowId()); - - if (!mi.isValid()) - { - ERROR_LOG(m_logger) << "could not update model data after download! cover up.."; - return; - } - - int row = mi.row(); - ExportedScriptInformation esi = m_model->getRowData(row); - - m_model->setRowData(row, esi); - m_model->setLocalState(row, true); - m_model->init(getRootFolder()); - m_model->setServerContent(m_lastServerContent); - - onSelectionChanged(); - }); -} - - -void ExportedScriptsDialog::removeScriptFromServer() -{ - const QModelIndexList mil = m_ui->ltsDataView->selectedRows(); - if (mil.size() != 1) - return; - const QModelIndex mi(mil.first()); - ExportedScriptInformation esi = m_model->getRowData(mi.row()); - - RemoveProcess *rp = new RemoveProcess(m_model->getId(mi), std::move(esi), this); - setOverlay(rp->process()); - - - connect(rp, &RemoveProcess::signalDone, - this, [this, rp]() - { - const QModelIndex mi = m_model->findIndexForId(rp->modelRowId()); - - if (!mi.isValid()) - { - ERROR_LOG(m_logger) << "could not update model data after deletion! cover up.."; - return; - } - - int row = mi.row(); - ExportedScriptInformation esi = m_model->getRowData(row); - - if (!esi.local) - m_model->removeRow(mi.row()); - - onSelectionChanged(); - }); -} - - -void ExportedScriptsDialog::removeScriptLocal() -{ - const QModelIndexList mil = m_ui->ltsDataView->selectedRows(); - if (mil.size() != 1) - return; - const ExportedScriptInformation esi = m_model->getRowData(mil.first().row()); - - static QString removingScriptFailedText(tr("Removing script failed")); - const auto iRet = LtsWidgets::LtsMessageDialog::showMessage( - this, - tr("Do you really want to remove the exported script '%1' from the local harddisk?").arg(esi.scriptName), - tr("Remove exported script"), - LtsWidgets::Behaviour::Modal, - LtsWidgets::Button::Yes | LtsWidgets::Button::No); - if (iRet != LtsWidgets::Button::Yes) - return; - - m_buttonBox->getButton(LtsWidgets::DialogButton::Save)->setEnabled(false); - m_buttonBox->getButton(LtsWidgets::DialogButton::Remove)->setEnabled(false); - m_buttonBox->getButton(LtsWidgets::DialogButton::Show)->setEnabled(false); - - QString currentDirectory = QStringLiteral("%1/%2").arg(getContentFolder(esi.exerciseId), QString::number(esi.scriptId)); - DEBUG_LOG(m_logger) << "currentDirectory=" << currentDirectory; - - QDir d(currentDirectory); - if (!d.removeRecursively()) - { - new LtsWidgets::LtsMessageDialogNew(this, tr("Cannot remove local directory '%1'").arg(currentDirectory), removingScriptFailedText); - return; - } - - - QFile dataJson(QStringLiteral("%1/data.json").arg(getContentFolder(esi.exerciseId))); - if (!dataJson.open(QIODevice::ReadWrite)) - { - new LtsWidgets::LtsMessageDialogNew(this, tr("Cannot remove script from index: %1").arg(dataJson.errorString()), removingScriptFailedText); - return; - } - - QJsonParseError err; - QJsonObject root(QJsonDocument::fromJson(dataJson.readAll(), &err).object()); - if (root.isEmpty()) - { - new LtsWidgets::LtsMessageDialogNew(this, tr("Unknown error while reading root from index"), removingScriptFailedText); - return; - } - - if (err.error != QJsonParseError::NoError) - { - new LtsWidgets::LtsMessageDialogNew(this, tr("Cannot read index file"), removingScriptFailedText); - ERROR_LOG(m_logger) << "Cannot read index file at offset" << err.offset << ": " << err.errorString(); - return; - } - - QJsonValueRef presentationsRef(root[QStringLiteral("presentations")]); - if (!presentationsRef.isArray()) - { - new LtsWidgets::LtsMessageDialogNew(this, tr("Unknown error while reading presentations value from index"), removingScriptFailedText); - return; - } - - QJsonArray presentations(presentationsRef.toArray()); - if (presentations.isEmpty()) - { - new LtsWidgets::LtsMessageDialogNew(this, tr("Unknown error while reading presentations array from index"), removingScriptFailedText); - return; - } - - bool deleted = false; - for (auto it = presentations.begin(); it != presentations.end(); ++it) - { - QJsonObject pre((*it).toObject()); - - int scriptId = pre[QStringLiteral("scriptId")].toInt(-1); - - if (scriptId == -1) - { - WARNING_LOG(m_logger) << "cannot find scriptId in presentations array object from data.json"; - continue; - } - - if (scriptId == esi.scriptId) - { - presentations.erase(it); - deleted = true; - break; - } - } - - if (!deleted) - { - new LtsWidgets::LtsMessageDialogNew(this, tr("Cannot find script in index"), removingScriptFailedText); - return; - } - - presentationsRef = presentations; - - - - dataJson.seek(0); - dataJson.resize(0); - dataJson.write(QJsonDocument(root).toJson()); - dataJson.close(); - - - if (esi.uploadTime < 1) - m_model->removeRow(mil.first().row()); - else - m_model->setLocalState(mil.first().row(), false); -} - - -void ExportedScriptsDialog::openScript() -{ - const QModelIndexList mil = m_ui->ltsDataView->selectedRows(); - if (mil.size() != 1) - return; - const ExportedScriptInformation esi = m_model->getRowData(mil.first().row()); - - const QString pathToScript = getContentFolder(esi.exerciseId) + QDir::separator() + QString::number(esi.id()) + QDir::separator(); - QStringList args; - args.append(QStringLiteral("-t")); - args.append(pathToScript); - - DEBUG_LOG(m_logger) << "pathToScript: " << pathToScript; - -#ifndef WIN32 - QProcess().startDetached(QLatin1String("./thp_viewer"), args, QCoreApplication::applicationDirPath()); -#else - QProcess().startDetached(QLatin1String("thp_viewer.exe"), args, qApp->applicationDirPath()); -#endif -} - - -QString ExportedScriptsDialog::getContentFolder(const QString &rootFolder, int exerciseId) -{ - return rootFolder + QStringLiteral("Exercise_%1").arg(exerciseId); -} - - -QString ExportedScriptsDialog::getContentFolder(int exerciseId) const -{ - return getContentFolder(getRootFolder(), exerciseId); -} - - -QString ExportedScriptsDialog::getRootFolder() const -{ - if (m_session->app() == LtsAppDescriptor::App::OC) - return QDir::tempPath() + QStringLiteral("/THP-Download/"); - - return QDir::tempPath() + QStringLiteral("/THP-Export/"); -} - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpManagement/tpm_exported_scripts_dialog.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpManagement/tpm_exported_scripts_dialog.h deleted file mode 100755 index 4e7a46b6c..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpManagement/tpm_exported_scripts_dialog.h +++ /dev/null @@ -1,207 +0,0 @@ - - -#pragma once - - -#include "logger.h" - -#include -#include - -#include - - -namespace Ui -{ -class ExportedScriptsDialog; -} -namespace NGL -{ -class Compress; -} -namespace LtsSession -{ -class LtsSession; -} - -class QTemporaryFile; -class QNetworkAccessManager; -class QNetworkReply; -class QNetworkRequest; -class QFileSystemWatcher; - - -namespace TakeHomePackageManager -{ -class ProcessOverlay; - -class HttpProcess : public QObject -{ - Q_OBJECT - -public: - HttpProcess(ExportedScriptInformation &&esi, QObject *parent); - virtual ~HttpProcess(); - - ProcessOverlay *process() const { return m_process; } - - -signals: - void signalReadyRead(); - - void signalSuccess(); - void signalTimeout(); - void signalCancel(); - void signalError(); - - -private slots: - void slotReadyRead(); - void slotError(); - void slotSuccess(); - - -protected slots: - void stopTimeout(); - void resetTimeout(); - - -private: - - -NGL::INGLLogger &m_logger; - void doConnections(QNetworkReply *r); - - -protected: - - QNetworkReply *post(const QString &path, QIODevice *data, const QUrlQuery &q = QUrlQuery(), const QString &contentType = QStringLiteral("application/octet-stream")); - QNetworkReply *get(const QString &path, const QUrlQuery &q = QUrlQuery()); - QNetworkReply *deleteResource(const QString &path, const QUrlQuery &q = QUrlQuery()); - - ExportedScriptInformation m_esi; - bool m_isError { false }; - ProcessOverlay *m_process; - bool m_wasCanceled { false }; - bool m_isTimeout { false }; - - -private: - static QNetworkRequest forgeRequest(const QString &path, const QUrlQuery &q, const QString &contentType = QString()); - - QNetworkAccessManager *m_nam; - QTimer *m_timeout; -}; - - - -class UploadProcess : public HttpProcess -{ - Q_OBJECT - -public: - UploadProcess(const QString &rootFolder, ExportedScriptInformation &&esi, QObject *parent); - -signals: - - -private slots: - void compressionDone(); - -private: - void abortCompress(); - - QTemporaryFile *m_tempFile; - NGL::Compress *m_compress; - QString m_rootDir; -}; - - - -class DownloadProcess : public HttpProcess -{ - Q_OBJECT - -public: - DownloadProcess(const QString &rootFolder, int modelRowId, ExportedScriptInformation &&esi, QObject *parent); - - int modelRowId() const { return m_modelRowId; } - -private slots: - void downloadFinished(); - -signals: - void signalDone(); - -private: - QTemporaryFile *m_tempFile; - NGL::Compress *m_compress { nullptr }; - int m_modelRowId { -1 }; - QString m_rootFolder; -}; - - - -class RemoveProcess : public HttpProcess -{ - Q_OBJECT - -public: - RemoveProcess(int modelRowId, ExportedScriptInformation &&esi, QObject *parent); - int modelRowId() const { return m_modelRowId; } - -signals: - void signalDone(); - -private: - int m_modelRowId { -1 }; -}; - - - -class ExportedScriptsDialog : public LtsWidgets::LtsDialog -{ - Q_OBJECT -public: - explicit ExportedScriptsDialog(QWidget *parent = nullptr); - ~ExportedScriptsDialog(); - - void retranslate() override; - bool init(LtsSession::LtsSession *session); - static QString getContentFolder(const QString &rootFolder, int exerciseId); - -private slots: - void uploadScript(); - void downloadScript(); - void removeScriptFromServer(); - void removeScriptLocal(); - void openScript(); - void onSelectionChanged(); - -private: - enum class WsConnectionStatus - { - NotConnected, - Connecting, - Disconnected, - Error, - Connected, - }; - - void startUpload(); - QString getContentFolder(int exerciseId) const; - QString getRootFolder() const; - bool initModel(); - void setWsConnectionStatus(WsConnectionStatus status); - void setWsConnectionStatusLabel(); - -private: - ExportedScriptsModel *m_model; - Ui::ExportedScriptsDialog *m_ui; - LtsSession::LtsSession *m_session; - int m_exerciseId; - QFileSystemWatcher *m_fsWatcher; - QString m_lastServerContent; - WsConnectionStatus m_wsStatus { WsConnectionStatus::NotConnected }; -}; -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpManagement/tpm_exported_scripts_dialog.ui b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpManagement/tpm_exported_scripts_dialog.ui deleted file mode 100755 index 550e24ddf..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpManagement/tpm_exported_scripts_dialog.ui +++ /dev/null @@ -1,77 +0,0 @@ - - - ExportedScriptsDialog - - - - 0 - 0 - 834 - 491 - - - - Form - - - - - - The following Scripts are already exported. You can remove them from your local hard disk or upload them to the server here. - - - - - - - - - Server connection status: - - - - - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - false - - - false - - - - - - - - LtsDataView::LtsDataView - QWidget -
LtsDataView/lts_data_view.h
- 1 -
-
- - -
diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpManagement/tpm_gui_plugin.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpManagement/tpm_gui_plugin.cpp deleted file mode 100755 index 676eb6201..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpManagement/tpm_gui_plugin.cpp +++ /dev/null @@ -1,54 +0,0 @@ - - - -#include "tpm_gui_plugin.h" -#include "tpm_exported_scripts_dialog.h" -#include "logger.h" - -namespace TakeHomePackageManager -{ -std::shared_ptr GuiPlugin::createGuiInterface(LtsSession::LtsSession *session) -{ - return std::make_shared(session); -} - - -InterfaceImpl::InterfaceImpl(LtsSession::LtsSession *session) - : GuiPluginBase::Interface(session, getLogger("Plugins.Gui.Tpm")) -{} - - -bool InterfaceImpl::fetchInterfaces() -{ - return true; -} - - -QString InterfaceImpl::menuGroup() const -{ - return tr("Presentation"); -} - -QVector InterfaceImpl::getActions() -{ - QVector ret; - LtsWidgets::PluginData plData; - plData.menuGroup = menuGroup(); - if (m_session->app() == LtsAppDescriptor::App::Scripts) - plData.exercisePart = LtsWidgets::ExercisePart::eSpecial; - else - plData.exercisePart = LtsWidgets::ExercisePart::eAfterAction; - plData.identifier = QLatin1String("PresentationManagement.ScriptDialog.ManageExportedScripts"); - plData.menuIcon = QIcon(QLatin1String("icon:export_documents.svg")); - plData.menuText = tr("Manage Exported Scripts"); - - plData.createWidgetFunc = [this](QWidget *) - { - return LtsWidgets::initDialog(new ExportedScriptsDialog(), m_session); - }; - ret.append(plData); - - return ret; -} - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpManagement/tpm_gui_plugin.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpManagement/tpm_gui_plugin.h deleted file mode 100755 index 0d6e7c243..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpManagement/tpm_gui_plugin.h +++ /dev/null @@ -1,45 +0,0 @@ - - - -#pragma once -#include - -#include "logger.h" -#include -#include - -namespace TakeHomePackageManager -{ -class GuiPlugin final : public QObject, public GuiPluginBase::Plugin -{ - Q_PLUGIN_METADATA(IID "gui:3:tpm.man") - Q_INTERFACES(GuiPluginBase::Plugin) - - Q_OBJECT -public: - GuiPlugin() = default; - ~GuiPlugin() = default; - - QString pluginName() override { return QLatin1String("TakeHomePackageManager"); } - std::shared_ptr createGuiInterface(LtsSession::LtsSession *session) override; - bool availableInPartition(IDL::PartitionType partition) const override - { - return partition == IDL::PartitionType::Exercise; - } -}; - -class InterfaceImpl final : public QObject, public GuiPluginBase::Interface, public ForeignTpmGuiInterface -{ - Q_OBJECT -public: - explicit InterfaceImpl(LtsSession::LtsSession *session); - - bool fetchInterfaces() override; - QString menuGroup() const override; - QVector getActions() override; - bool availableInPartition(IDL::PartitionType partition) const override { return partition == IDL::PartitionType::Exercise; } -private: - -}; - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpUsbManagement/CMakeLists.txt b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpUsbManagement/CMakeLists.txt deleted file mode 100755 index ba7d7b7f7..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpUsbManagement/CMakeLists.txt +++ /dev/null @@ -1,61 +0,0 @@ -# -# $Id: CMakeLists.txt 51804 2020-07-31 04:47:28Z fritsche_h $ -# $HeadURL: svn://slssvn/TDS/branches/product/iterations/21_03_salted_caramel/Lts/Plugins/TakeHomePackageManager/CMakeLists.txt $ -# $Author: fritsche_h $ -# -# Created by Mike Wille, SLTE, 2020-03-23 -# - -# Make ${Qt6_Widgets} optional -if(QT6_GUI_AVAILABLE AND TARGET Qt6::Widgets) - set(Qt6_Widgets ${Qt6_Widgets}) -else() - set(Qt6_Widgets "") -endif() - -# Make ${Qt6_WebSockets} optional -if(QT6_GUI_AVAILABLE AND TARGET Qt6::WebSockets) - set(Qt6_WebSockets ${Qt6_WebSockets}) -else() - set(Qt6_WebSockets "") -endif() - - -SET(src - tpm_usb_gui_plugin.cpp - tpm_usb_gui_plugin.h - tpm_usb_dialog.cpp - tpm_usb_dialog.h - logger.cpp - logger.h -) - -QT5_WRAP_UI(src - tpm_usb_dialog.ui -) - -NGL_ADD_LIBRARY2(WS ThpUsbManagementGuiPlugin MODULE ${src}) -if(QT6_GUI_AVAILABLE) - NGL_TARGET_LINK_LIBRARIES(ThpUsbManagementGuiPlugin - ThpCommon - TpmGuiPluginInterface - ${Qt6_Widgets} - Qt6::Network - ${Qt6_WebSockets} - NGLLogger - LtsWidgets - LtsSession - LtsDataView - nglcompression - nglsettings - ngltools - LtsSessionData - - # for creating data.json - AsmDataPluginInterface - ExmDataPluginInterface - ) -endif() - -NGL_INSTALL_TARGET(ThpUsbManagementGuiPlugin) - diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpUsbManagement/logger.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpUsbManagement/logger.cpp deleted file mode 100755 index 03028f498..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpUsbManagement/logger.cpp +++ /dev/null @@ -1,32 +0,0 @@ - - - -#include "logger.h" - -#include - -namespace TakeHomePackageManager -{ - -LOGGER_T getLogger(const char *name) -{ - static const char ns[] = "TPM.USB."; - std::string loggerName; - const size_t len = strlen(name); - loggerName.reserve(sizeof(ns) + len); - loggerName.append(ns, sizeof(ns) - 1); - loggerName.append(name, len); - - try - { - return NGL::NGLLoggerBootstrap::getNGLRootLogger(). - getNGLLogger(loggerName); - } - catch (const std::exception &ex) - { - fprintf(stderr, "Error retrieving logger: %s", ex.what()); - abort(); - } -} - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpUsbManagement/logger.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpUsbManagement/logger.h deleted file mode 100755 index 02b407a94..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpUsbManagement/logger.h +++ /dev/null @@ -1,17 +0,0 @@ - - - -#pragma once - -#include - -namespace TakeHomePackageManager -{ -typedef NGL::INGLLogger &LOGGER_T; - -LOGGER_T getLogger(const char *name); -inline LOGGER_T getLogger(const QString &loggerName) -{ - return getLogger(loggerName.toUtf8().constData()); -} -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpUsbManagement/tpm_usb_dialog.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpUsbManagement/tpm_usb_dialog.cpp deleted file mode 100755 index f7916f139..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpUsbManagement/tpm_usb_dialog.cpp +++ /dev/null @@ -1,1666 +0,0 @@ - - - - - - - - - -#include "ui_tpm_usb_dialog.h" -#include -#include "tpm_usb_dialog.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef Q_OS_UNIX -#include -#endif - -#include - -#ifdef Q_OS_UNIX -#define _compiler_warning(x) _Pragma(#x) -#define compiler_warning(x) _compiler_warning(GCC warning x) -#define TMP_WARNING_LOG(x) compiler_warning("Temporary warning log active!") \ - WARNING_LOG(x) -#else -#define compiler_warning(x) -#define TMP_WARNING_LOG(x) WARNING_LOG(x) -#endif - -#ifndef ELOG -#define ELOG ERROR_LOG(m_logger) -#endif - - -namespace TakeHomePackageManager -{ - - -class AsyncFileCopy : public QObject -{ - Q_OBJECT - -public: - static const int s_chunkSize = 1 * 1024 * 1024; - - static AsyncFileCopy *createAsyncFileCopy(const QDir &src, const QDir &dst, const QFileInfoList &fil = {}, bool cdUp = true) - { - return new AsyncFileCopy(src, dst, fil, cdUp); - } - - ~AsyncFileCopy() = default; - -private: - AsyncFileCopy(const QDir &src, const QDir &dst, const QFileInfoList &fil, bool cdUp) - - { - QFutureWatcher *fw = new QFutureWatcher(this); - connect(fw, &QFutureWatcher::finished, - this, [this, fw]() - { - emit finished(fw->result()); - }); - connect(fw, &QFutureWatcher::finished, - this, &QObject::deleteLater); - fw->setFuture(QtConcurrent::run(this, &AsyncFileCopy::copy, src, dst, fil, cdUp)); - } - -private: -#define cancelationPoint if (m_wasCanceled) { qWarning() << "canceled"; return false; } (void)m_wasCanceled - - bool copy(const QDir &src, const QDir &dst, const QFileInfoList &fil, bool cdUp) - { - qint64 totalAll = 0, writtenAll = 0; - int fileCount = 0; - - - { - QDirIterator it(src.absolutePath(), QDir::Files | QDir::NoDotAndDotDot, - QDirIterator::Subdirectories | QDirIterator::FollowSymlinks); - while (it.hasNext()) - { - const QFileInfo fi(it.next()); - - - - - - - - if (!fil.isEmpty()) - { - auto it = std::find_if(fil.constBegin(), fil.constEnd(), [fi](const QFileInfo &_fi) - { - - return (fi.absoluteFilePath() == _fi.absoluteFilePath()); - }); - - if (it == fil.constEnd()) - continue; - } - - - - totalAll += fi.size(); - fileCount++; - } - } - - - - - int currentFile = 0; - QDirIterator it(src.absolutePath(), QDir::Files | QDir::NoDotAndDotDot, - QDirIterator::Subdirectories | QDirIterator::FollowSymlinks); - while (it.hasNext()) - { - cancelationPoint; - - const QFileInfo fi(it.next()); - - - - - - - - - - if (!fil.isEmpty()) - { - auto it = std::find_if(fil.constBegin(), fil.constEnd(), [fi](const QFileInfo &_fi) - { - return (fi.absoluteFilePath() == _fi.absoluteFilePath()); - }); - - if (it == fil.constEnd()) - continue; - } - - - - - - currentFile++; - qint64 totalFile = fi.size(), writtenFile = 0; - - QDir x(src); - if (cdUp) - x.cdUp(); - - QString srcFilePath(fi.absolutePath()); - QString dstFilePath(dst.absolutePath() + QDir::separator() + srcFilePath.remove(x.absolutePath())); - - if (!QDir().mkpath(dstFilePath) ) - { - qWarning() << "cannot create path"; - return false; - } - - QFile srcFile(fi.absoluteFilePath()); - QFile dstFile(dstFilePath + QDir::separator() + fi.fileName()); - - - - - - - - - - - if (!srcFile.open(QIODevice::ReadOnly)) - { - qWarning() << QStringLiteral("failed to open src '%1' (error: %2)").arg(srcFile.fileName(), srcFile.errorString()); - continue; - } - - if (!dstFile.open(QIODevice::ReadWrite | QIODevice::Truncate)) - { - qWarning() << QStringLiteral("failed to open dst '%1' (error: %2)").arg(dstFile.fileName(), dstFile.errorString()); - continue; - } - - - - - - qint64 fileSize = srcFile.size(); - while (fileSize) - { - cancelationPoint; - - const auto data = srcFile.read(s_chunkSize); - - cancelationPoint; - - const auto _written = dstFile.write(data); - qWarning() << "progress" << writtenFile << totalFile << writtenAll << totalAll << currentFile << fileCount; - emit newAction(tr("Copying...")); - emit progress(writtenFile, totalFile, writtenAll, totalAll, currentFile, fileCount); - - - -#ifdef Q_OS_UNIX - - emit newAction(tr("Writing...")); - - QElapsedTimer t; - t.start(); - - fsync(dstFile.handle()); - - -#endif - - - if (data.size() == _written) - { - writtenFile += _written; - fileSize -= data.size(); - } - else - { - qWarning() << "cannot write to" << dstFile.fileName() << ":" << dstFile.errorString(); - fileSize = 0; - break; - } - } - - writtenAll += writtenFile; - } - - - if (totalAll == writtenAll) - { - qWarning() << "done - " << writtenAll << "/" << totalAll << "bytes"; - return true; - } - else - { - qWarning() << "failed....."; - return false; - } - } - - bool m_wasCanceled { false }; - -public slots: - void slotCancel() - { - m_wasCanceled = true; - } - -signals: - void newAction(const QString &newAction); - void progress(qint64 bytesCopiedFile, qint64 bytesTotalFile, qint64 bytesCopiedAll, qint64 bytesTotalAll, int currentFile, int fileCount); - void finished(bool success); -}; - - - -class CopyProcess : public QObject -{ - Q_OBJECT - -public: - CopyProcess(const QDir &src, const QDir &dst, const QFileInfoList &fil = {}, bool cdUp = true, QObject *parent = nullptr) - : QObject(parent) - , m_process(new ProcessOverlay) - { - connect(m_process, &ProcessOverlay::signalCancel, - this, [this]() - { - - m_wasCanceled = true; - m_process->setCancelEnabled(false); - }); - connect(m_process, &ProcessOverlay::signalCancel, - this, &CopyProcess::signalCancel); - - AsyncFileCopy *afc = AsyncFileCopy::createAsyncFileCopy(src, dst, fil, cdUp); - - connect(m_process, &ProcessOverlay::signalCancel, - afc, &AsyncFileCopy::slotCancel); - - connect(afc, &AsyncFileCopy::progress, - this, [this](qint64 bytesCopiedFile, qint64 bytesTotalFile, - qint64 bytesCopiedAll, qint64 bytesTotalAll, - int currentFile, int fileCount) - { - m_process->setStatus(m_currentAction, fileCount, currentFile, bytesTotalFile, bytesCopiedFile); - }); - - connect(afc, &AsyncFileCopy::newAction, - this, [this](const QString &newAction) - { - m_currentAction = newAction; - }); - - connect(afc, &AsyncFileCopy::finished, - this, &QObject::deleteLater); - - connect(afc, &AsyncFileCopy::finished, - this, &CopyProcess::finished); - } - - ~CopyProcess() - { - - delete m_process; - } - - QWidget *process() { return m_process; } - -signals: - void signalCancel(); - void finished(bool success); - -private: - ProcessOverlay *m_process; - bool m_wasCanceled { false }; - QString m_currentAction; - -}; - - - -USBDialog::USBDialog(LtsSession::LtsSession *session, QWidget *parent) - : LtsWidgets::LtsDialog(parent) - , m_localThpModel(new ExportedScriptsModel(this)) - , m_usbThpModel(new ExportedScriptsModel(this)) - , m_ui(new Ui::USBDialog) - , m_session(session) - - , m_exerciseId(m_session->exerciseId()) - , m_paths(0) -{ - m_ui->setupUi(this); - - connect(m_ui->pbCHange, &QPushButton::clicked, - this, &USBDialog::slotChangePath); - - connect(m_ui->pbCopy, &QPushButton::clicked, - this, &USBDialog::slotCopy); - connect(m_ui->pbRemove, &QPushButton::clicked, - this, &USBDialog::slotRemove); - connect(this, &USBDialog::nextMap, - this, &USBDialog::onNextMap); - - connect(m_ui->pbCopyMaps, &QPushButton::clicked, - this, &USBDialog::slotCopyMaps); - connect(m_ui->pbRemoveMaps, &QPushButton::clicked, - this, &USBDialog::slotRemoveMaps); - connect(m_ui->tvLocal->selectionModel(), &QItemSelectionModel::selectionChanged, - this, &USBDialog::slotSelectionChanged); - - - - - - - - - - - - - - - - - - - - initModel(); - - setOnlineHelpFilename(QStringLiteral("Script_Editor-Export_Script_Administration")); -} - - -USBDialog::~USBDialog() -{ - delete m_ui; -} - - -void USBDialog::initUsbModel() -{ - m_usbThpModel->clear(); - - if (!m_usbThpModel->init(m_usbRoot)) - { - new LtsWidgets::LtsMessageDialogNew(this, tr("The directory '%1' doesn't contain valid THP data.").arg(m_usbRoot)); - ERROR_LOG(m_logger) << "cannot initialize usb thp model from usb root" << m_usbRoot; - return; - } - - - QDir tmp; - tmp.mkpath(getContentFolder(m_usbRoot) + QDir::separator() + QStringLiteral("Maps")); - - m_ui->tvUSB->setModel(m_usbThpModel); - - m_ui->tvUSB->hideColumn(ExportedScriptsModel::ColId); - m_ui->tvUSB->hideColumn(ExportedScriptsModel::ColLocation); - m_ui->tvUSB->hideColumn(ExportedScriptsModel::ColUploaded); - m_ui->tvUSB->hideColumn(ExportedScriptsModel::ColUploadedTime); - - m_ui->lblPath->setText(m_usbRoot); - - - - { - m_ui->tvUSBMaps->setRowCount(0); - m_ui->tvUSBMaps->clearContents(); - QDirIterator it(getContentFolder(m_usbRoot) + QDir::separator() + QStringLiteral("Maps"), QDir::Files | QDir::NoDotAndDotDot, - QDirIterator::Subdirectories | QDirIterator::FollowSymlinks); - while (it.hasNext()) - { - QFileInfo fi(it.next()); - m_ui->tvUSBMaps->insertRow(m_ui->tvUSBMaps->rowCount()); - m_ui->tvUSBMaps->setItem(m_ui->tvUSBMaps->rowCount() - 1, 0, new QTableWidgetItem(fi.fileName())); - if (fi.fileName().endsWith(QStringLiteral("json")) || - fi.fileName().endsWith(QStringLiteral("tif"))) - m_ui->tvUSBMaps->hideRow(m_ui->tvUSBMaps->rowCount() -1); - - } - } -} - - -void USBDialog::slotChangePath() -{ - QFileDialog *dlg = new QFileDialog(this); - dlg->setFileMode(QFileDialog::Directory); - dlg->setOption(QFileDialog::ShowDirsOnly); - dlg->setAttribute(Qt::WA_DeleteOnClose); - dlg->show(); - - connect(dlg, &QFileDialog::accepted, - this, [this, dlg]() - { - QStringList selected(dlg->selectedFiles()); - - if (selected.count() > 1) - return; - - m_usbRoot = selected.first(); - - - if (!QFile::exists(m_usbRoot + QDir::separator() + QStringLiteral("exercises.json"))) - { - auto m = new LtsWidgets::LtsMessageDialogNew(this, tr("The selected directory '%1' doesn't contain THPs yet.
Do you want to initialize the directory now?").arg(m_usbRoot), - {}, LtsWidgets::Behaviour::Modal, LtsWidgets::Button::Yes | LtsWidgets::Button::Cancel); - - connect(m, &LtsWidgets::LtsMessageDialogNew::yes, - this, [this]() - { - - QFile exerciseJsonFile(m_usbRoot + QDir::separator() + QStringLiteral("exercises.json")); - if (!exerciseJsonFile.open(QIODevice::WriteOnly)) - { - new LtsWidgets::LtsMessageDialogNew(this, tr("The selected directory '%1' can't be written to and the initialization was aborted.").arg(m_usbRoot)); - return; - } - - exerciseJsonFile.write(QString(QStringLiteral("{ \"Exercises\": [ %1 ] }\n").arg(m_exerciseId)).toUtf8()); - exerciseJsonFile.close(); - - slotCopyWinBin(); - - - - std::shared_ptr exmDtc; - std::shared_ptr asmDtc; - if (m_session->getDtc(asmDtc) && - m_session->getDtc(exmDtc)) - { - if (!m_usbThpModel->createDataJson(m_usbRoot, exmDtc, asmDtc, m_exerciseId)) - { - - ERROR_LOG(m_logger) << "Failed to initialize data.json"; - return; - } - - TMP_WARNING_LOG() << "DONE!"; - } - else - TMP_WARNING_LOG() << "Failed to get dtcs :( !"; - }); - - return; - } - - initUsbModel(); - generateLayerMappingXML(); - }); - - -} - -void USBDialog::slotCopyMaps() -{ - if (m_usbRoot.isEmpty()) - return; - - m_finished_mapCopys = 0; - - QDir dstDir(getContentFolder(m_usbRoot) + QDir::separator() + QStringLiteral("Maps")); - - if (!dstDir.exists()) - { - ERROR_LOG(m_logger) << "dst dir " << m_usbRoot << " is not accessible"; - return; - } - - const QModelIndexList mil = m_ui->tvLocalMaps->selectionModel()->selectedRows(); - if (mil.size() < 1) - return; - - - DEBUG_LOG(m_logger) << "mil.size()" << mil.size(); - - - - for (const QModelIndex &idx : mil) - { - - QString abs = m_ui->tvLocalMaps->item(idx.row(), 2)->text() + QDir::separator() + m_ui->tvLocalMaps->item(idx.row(), 1)->text(); - m_files[m_ui->tvLocalMaps->item(idx.row(), 2)->text()] += abs; - - } - - - - QDirIterator eleit(QStringLiteral("/usr/share/arcgis/resources/elevation/"), QDir::Files | QDir::NoDotAndDotDot, - QDirIterator::Subdirectories | QDirIterator::FollowSymlinks); - while (eleit.hasNext()) - { - QString file = eleit.next(); - QFileInfo eleFile(file); - if (!eleFile.fileName().toLower().endsWith(QStringLiteral(".tif"))) - continue; - m_files[eleFile.absolutePath()] += eleFile.absoluteFilePath(); - } - - m_paths = m_files.count(); - - - - - - - - - emit nextMap(); - -} - -void USBDialog::onNextMap() -{ - auto path = m_files.firstKey(); - { - QString src(path); - DEBUG_LOG(m_logger) << "src" << src; - - QDir srcDir(src); - - if (!srcDir.exists()) - { - ERROR_LOG(m_logger) << "src dir " << src << " is not accessible"; - return; - } - QDir dstDir(getContentFolder(m_usbRoot) + QDir::separator() + QStringLiteral("Maps")); - - auto cp = new CopyProcess(srcDir, dstDir, m_files[path], false, this); - setOverlay(cp->process()); - connect(cp, &CopyProcess::finished, - this, [this, path](bool success) - { - if (!success) - new LtsWidgets::LtsMessageDialogNew(this, tr("The files could not be copied successfully from path! ") + path); - m_finished_mapCopys++; - m_files.remove(path); - - if(m_paths == m_finished_mapCopys) - { - - new LtsWidgets::LtsMessageDialogNew(this, tr("The files were copied successfully from path: ") + path); - initUsbModel(); - generateLayerMappingXML(); - m_finished_mapCopys = 0; - }else - emit nextMap(); - }); - } -} - - -void USBDialog::generateLayerMappingXML() -{ - QJsonObject layers; - - QJsonArray elevationUrls; - QJsonArray mapUrls; - QJsonArray sceneObjectUrls; - QJsonArray sceneUrls; - - - for(int i = 0; i < m_ui->tvUSBMaps->rowCount(); ++i) - { - QFileInfo fileInfo = QFileInfo(m_usbRoot + QDir::separator() + m_ui->tvUSBMaps->item(i,0)->text()); - - if(fileInfo.suffix() == QStringLiteral("tif") || fileInfo.suffix() == QStringLiteral("dt2")) - { - QJsonObject elavation; - elavation.insert(QStringLiteral("description"), QJsonValue(QStringLiteral("Elevation"))); - elavation.insert(QStringLiteral("maxScale"), QJsonValue(-1)); - elavation.insert(QStringLiteral("minScale"), QJsonValue(-1)); - elavation.insert(QStringLiteral("name"), QJsonValue(fileInfo.baseName())); - elavation.insert(QStringLiteral("url"), QJsonValue(fileInfo.fileName())); - elevationUrls.push_back(elavation); - } - else if (fileInfo.suffix() == QStringLiteral("slpk")) - { - QJsonObject objectScene; - objectScene.insert(QStringLiteral("description"), QJsonValue(QStringLiteral("ObjectScene"))); - objectScene.insert(QStringLiteral("maxScale"), QJsonValue(125)); - objectScene.insert(QStringLiteral("minScale"), QJsonValue(-1)); - objectScene.insert(QStringLiteral("altitudeOffset"), QJsonValue(0.5)); - objectScene.insert(QStringLiteral("name"), QJsonValue(fileInfo.baseName())); - objectScene.insert(QStringLiteral("url"), QJsonValue(fileInfo.fileName())); - sceneObjectUrls.push_back(objectScene); - } - else if(fileInfo.suffix() == QStringLiteral("tpk")) - { - - if(fileInfo.fileName().contains(QStringLiteral("WebMerc"))) - { - QJsonObject scene; - scene.insert(QStringLiteral("description"), QJsonValue(QStringLiteral("Scene"))); - scene.insert(QStringLiteral("maxScale"), QJsonValue(125)); - scene.insert(QStringLiteral("minScale"), QJsonValue(-1)); - scene.insert(QStringLiteral("name"), QJsonValue(fileInfo.baseName())); - scene.insert(QStringLiteral("url"), QJsonValue(fileInfo.fileName())); - sceneUrls.push_back(scene); - - } - else - { - QJsonObject map; - map.insert(QStringLiteral("description"), QJsonValue(QStringLiteral("Map"))); - map.insert(QStringLiteral("maxScale"), QJsonValue(125)); - map.insert(QStringLiteral("minScale"), QJsonValue(-1)); - map.insert(QStringLiteral("name"), QJsonValue(fileInfo.baseName())); - map.insert(QStringLiteral("url"), QJsonValue(fileInfo.fileName())); - mapUrls.push_back(map); - } - } - } - - - layers.insert(QStringLiteral("elevationUrls"), elevationUrls); - layers.insert(QStringLiteral("mapUrls"), mapUrls); - layers.insert(QStringLiteral("sceneObjectUrls"), sceneObjectUrls); - layers.insert(QStringLiteral("sceneUrls"), sceneUrls); - - QFile layersMapping(getContentFolder(m_usbRoot) + QDir::separator() + QStringLiteral("layerMapping.json")); - QFile layersMappingAtMaps(getContentFolder(m_usbRoot) + QDir::separator() + QStringLiteral("Maps") + QDir::separator() + QStringLiteral("layerMapping.json")); - - if (!layersMapping.open(QIODevice::WriteOnly)) - { - WARNING_LOG(m_logger) << "Couldn't open save file."; - return; - } - if (!layersMappingAtMaps.open(QIODevice::WriteOnly)) - { - WARNING_LOG(m_logger) << "Couldn't open save file in folder Maps."; - return; - } - QJsonDocument doc(layers); - - layersMapping.write(doc.toJson()); - layersMappingAtMaps.write(doc.toJson()); -} - -QFileInfoList USBDialog::prepareFileInfoListForFolder(QString src, QFileInfoList fil) -{ - - QDir dir(src); - if (! dir.exists()) - return fil; - - for (QString d : dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot)) - { - fil = prepareFileInfoListForFolder(src+ QDir::separator() + d, fil); - } - - for (QString f : dir.entryList(QDir::Files)) - { - fil += QString(src + QDir::separator() + f); - } - return fil; -} - -void USBDialog::slotCopyWinBin() -{ - if (m_usbRoot.isEmpty()) - return; - - QDir dstDir(getContentFolder(m_usbRoot) + QDir::separator()); - - if (!dstDir.exists()) - { - dstDir.mkpath(QStringLiteral(".")); - } - - - - QString src(QStringLiteral("/opt/THP/")); - - QDir srcDir(src); - - if (!srcDir.exists()) - { - ERROR_LOG(m_logger) << "src dir " << src << " is not accessible"; - return; - } - - QFileInfoList fil; - fil = prepareFileInfoListForFolder(src, fil); - DEBUG_LOG(m_logger) << "XXXXXXXXXXX filsize is: " << fil.size(); - - auto cp = new CopyProcess(srcDir, dstDir, fil, false, this); - setOverlay(cp->process()); - - connect(cp, &CopyProcess::finished, - this, [this](bool success) - { - if (success) - { - - slotCopyWinBinP2(); - } - else - new LtsWidgets::LtsMessageDialogNew(this, tr("The files could not be copied successfully!")); - }); - - -} - -void USBDialog::slotCopyWinBinP2() -{ - if (m_usbRoot.isEmpty()) - return; - - QDir dstDir(getContentFolder(m_usbRoot) + QDir::separator()); - - if (!dstDir.exists()) - { - dstDir.mkpath(QStringLiteral(".")); - } - const QString initFilePath = NGL::findFile(NGL::FileType::ConfigFile, QStringLiteral("situation_map_defaults.ini")); - - if (initFilePath.isEmpty()) - { - ERROR_LOG(m_logger) << "sitmap init is not accessible"; - return; - } - - QFileInfo fileInfo(initFilePath); - QFileInfoList fil2; - fil2.append(fileInfo); - DEBUG_LOG(m_logger) << "XXXXXXXXXXX sitmap is: " << fileInfo.absoluteFilePath(); - ERROR_LOG(m_logger) << "XXXXXXXXXXX filsize is: " << fil2.size(); - - - const QDir dstDir2(dstDir.absolutePath() + QDir::separator() + QStringLiteral("thp") + QDir::separator() + QStringLiteral("share") + QDir::separator() + QStringLiteral("LTS") + QDir::separator() + QStringLiteral("situation_Map")) ; - DEBUG_LOG(m_logger) << "XXXXXXXXXXX sitmap dst is: " << dstDir2.absolutePath(); - - auto cp2 = new CopyProcess(fileInfo.absoluteDir(), dstDir2, fil2, false, this); - setOverlay(cp2->process()); - - connect(cp2, &CopyProcess::finished, - this, [this](bool success) - { - if (success) - { - - slotCopyWinBinP3(); - } - else - new LtsWidgets::LtsMessageDialogNew(this, tr("The files could not be copied successfully!")); - }); -} - -void USBDialog::slotCopyWinBinP3() -{ - if (m_usbRoot.isEmpty()) - return; - - QDir dstDir(getContentFolder(m_usbRoot) + QDir::separator()); - - if (!dstDir.exists()) - { - dstDir.mkpath(QStringLiteral(".")); - } - - const QString autorunFile = NGL::findFile(NGL::FileType::ConfigFile, QStringLiteral("autorun.inf")); - if (autorunFile.isEmpty()) - { - ERROR_LOG(m_logger) << "autorunFile init is not accessible"; - return; - } - - QFileInfo fileInfo2(autorunFile); - QFileInfoList fil; - fil = prepareFileInfoListForFolder(fileInfo2.absoluteDir().path(), fil); - DEBUG_LOG(m_logger) << "XXXXXXXXXXX autofinFile is: " << fileInfo2.absoluteDir().path(); - DEBUG_LOG(m_logger) << "XXXXXXXXXXX filsize is: " << fil.size(); - - auto cp3 = new CopyProcess(fileInfo2.absoluteDir(), dstDir, fil, false, this); - setOverlay(cp3->process()); - - connect(cp3, &CopyProcess::finished, - this, [this](bool success) - { - if (success) - { - - initUsbModel(); - } - else - new LtsWidgets::LtsMessageDialogNew(this, tr("The files could not be copied successfully!")); - }); - - -} - - -class JsonHandler -{ -public: - JsonHandler() - {} - - - - - - - - - - - - - - JsonHandler(const QString &filename, const QString &root, bool mustExist = true) - : m_f(new QFile) - , m_filename(filename) - { - m_filepath = QString(root + QDir::separator() + filename); - - if (!QFile::exists(m_filepath) && mustExist) - throw QStringLiteral("%1 does not exist in given root").arg(filename); - - m_f->setFileName(m_filepath); - - if (!m_f->open(QIODevice::ReadWrite)) - throw QStringLiteral("Cannot open %1").arg(filename); - - qint64 s = m_f->size(); - if (s == 0 && mustExist) - throw QStringLiteral("%1 is empty").arg(filename); - - if (s == 0) - return; - - QJsonParseError err; - QJsonDocument doc(QJsonDocument::fromJson(m_f->readAll(), &err)); - - if (err.error != QJsonParseError::NoError) - throw QStringLiteral("Json malformed: %1 - offset %2").arg(err.errorString(), err.offset); - - m_root = doc.object(); - - if (m_root.isEmpty()) - throw QStringLiteral("%1's object is empty").arg(filename); - - m_exists = true; - - - - - - - - - - - - } - - - virtual ~JsonHandler() - { - std::shared_ptr _(nullptr, [this](int *) { delete m_f; }); - - if (m_f == nullptr || !m_f->isOpen() || !m_changesMade) - return; - - - - - m_f->reset(); - m_f->resize(0); - - m_f->write(QJsonDocument(m_root).toJson(QJsonDocument::JsonFormat::Compact)); - } - - -protected: - bool m_changesMade { false }; - bool m_exists { false }; - QJsonObject m_root; - - -private: - QFile *m_f { nullptr }; - QString m_filepath; - QString m_filename; -}; - - -class ExerciseJsonHandler : public JsonHandler -{ -public: - ExerciseJsonHandler(const QString &root, bool mustExist = true) - : JsonHandler(QStringLiteral("exercises.json"), root, mustExist) - { - QJsonValue exercisesArrayValue(m_root[s_exercisesArrayIdentifier]); - - if (m_exists && exercisesArrayValue.isUndefined()) - throw "exercises.json's object is missing the 'Exercises' array"; - - m_exercisesArray = m_root[s_exercisesArrayIdentifier].toArray(); - - if (!m_exists) - m_changesMade = true; - } - - - ~ExerciseJsonHandler() - { - m_root[s_exercisesArrayIdentifier] = m_exercisesArray; - } - - - void addExercise(int exerciseId) - { - m_exercisesArray.append(exerciseId); - m_changesMade = true; - } - - - bool removeExercise(int exerciseId) - { - auto it = std::find_if(m_exercisesArray.begin(), m_exercisesArray.end(), - [exerciseId](const QJsonValue &val) - { - bool k = false; - int v = val.toVariant().toInt(&k); - if (!k) - return false; - - return (v == exerciseId); - }); - - bool ret = (it != m_exercisesArray.end()); - if (ret) - { - m_exercisesArray.erase(it); - m_changesMade = true; - } - - return ret; - } - -private: - static const QString s_exercisesArrayIdentifier; - QJsonArray m_exercisesArray; -}; - - -const QString ExerciseJsonHandler::s_exercisesArrayIdentifier = QStringLiteral("Exercises"); - - -class DataJsonHandler : public JsonHandler -{ -public: - DataJsonHandler() - {} - - - - - - - - - DataJsonHandler(const QString &root, int exerciseId) - : JsonHandler(QStringLiteral("data.json"), QStringLiteral("%1/%2").arg(root).arg(USBDialog::exerciseDirectoryName(exerciseId)), true) - { - QJsonValue scriptsArrayValue(m_root[s_presentationsArrayIdentifier]); - - if (m_exists && scriptsArrayValue.isUndefined()) - throw "data.json's object is missing the 'presentations' array"; - - m_presentationsArray = m_root[s_presentationsArrayIdentifier].toArray(); - - if (!m_exists) - m_changesMade = true; - } - - - ~DataJsonHandler() - { - m_root[s_presentationsArrayIdentifier] = m_presentationsArray; - } - - - - - - - - - - QVector scripts() - { - QVector ret; - - for (const QJsonValue &val : std::as_const(m_presentationsArray)) - { - QJsonObject scriptObject(val.toObject()); - - bool k = false; - int v = scriptObject[QStringLiteral("scriptId")].toVariant().toInt(&k); - if (!k) - continue; - - ret += v; - } - - return ret; - } - - - bool removeScript(int scriptId) - { - auto it = std::find_if(m_presentationsArray.begin(), m_presentationsArray.end(), - [scriptId](const QJsonValue &val) - { - QJsonObject scriptObject(val.toObject()); - - bool k = false; - int v = scriptObject[QStringLiteral("scriptId")].toVariant().toInt(&k); - if (!k) - return false; - - return (v == scriptId); - }); - - bool ret = (it != m_presentationsArray.end()); - if (ret) - { - m_presentationsArray.erase(it); - m_changesMade = true; - } - - return ret; - } - -private: - static const QString s_presentationsArrayIdentifier; - QJsonArray m_presentationsArray; -}; - - -const QString DataJsonHandler::s_presentationsArrayIdentifier = QStringLiteral("presentations"); - - -void USBDialog::adjustJsonFiles(What what) -{ - - - - switch (what) - { - case What::ScriptWasDeletedFromExercise: - { - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - } - - case What::ExerciseDirectoryWasDeleted: - case What::NewExerciseDirectoryWasCreated: - { - - - break; - } - - case What::ScriptWasCopiedToExercise: - break; - } -} - - -void USBDialog::scriptDeleted(int scriptId) -{ - - QDir dir(m_usbRoot); - dir.setFilter(QDir::Filter::Dirs | QDir::Filter::NoDotAndDotDot); - - const QFileInfoList fil(dir.entryInfoList()); - if (fil.isEmpty()) - { - DEBUG_LOG(m_logger) << "no scripts left"; - - - - - dir.removeRecursively(); - - - try - { - ExerciseJsonHandler(m_usbRoot).removeExercise(m_exerciseId); - } - catch (const QString &str) - { - ERROR_LOG(m_logger) << "ExerciseJsonHandler failed: " << str; - return; - } - - return; - } - - - try - { - DataJsonHandler(m_usbRoot, m_exerciseId).removeScript(scriptId); - } - catch (const QString &str) - { - ERROR_LOG(m_logger) << "DataJsonHandler failed: " << str; - } -} - - -void USBDialog::scriptCopied(int ) -{ - compiler_warning("TODO: re-copy data.json ???") - - - - QDir dir(getContentFolder(m_usbRoot)); - dir.setFilter(QDir::Filter::Dirs | QDir::Filter::NoDotAndDotDot); - - const QFileInfoList fil(dir.entryInfoList()); - Q_ASSERT_X(!fil.isEmpty(), "", "no scripts on USB"); - - - QVector existingScripts; - - for (const QFileInfo &fi : fil) - { - bool k = false; - int val = fi.fileName().toInt(&k); - - if (!k) - continue; - - existingScripts += val; - } - - - QVector usbScripts; - DataJsonHandler djh; - - try - { - - djh = DataJsonHandler(m_usbRoot, m_exerciseId); - } - catch (const QString &str) - { - ERROR_LOG(m_logger) << "DataJsonHandler failed: " << str; - return; - } - - usbScripts = djh.scripts(); - - - - usbScripts.erase(std::remove_if(usbScripts.begin(), usbScripts.end(), - [existingScripts](int id) - { - return (std::find(existingScripts.begin(), existingScripts.end(), id) != existingScripts.end()); - }), usbScripts.end()); - - - - for (const int scriptId : std::as_const(usbScripts)) - djh.removeScript(scriptId); - - - - for (const QFileInfo &fi : fil) - { - bool k = false; - int val = fi.fileName().toInt(&k); - - if (!k || !usbScripts.contains(val)) - continue; - - fi.absoluteDir().removeRecursively(); - } -} - - -void USBDialog::slotCopy() -{ - if (m_usbRoot.isEmpty()) - return; - - QDir dstDir(m_usbRoot); - - if (!dstDir.exists()) - { - ERROR_LOG(m_logger) << "dst dir " << m_usbRoot << " is not accessible"; - return; - } - - dstDir = QDir(getContentFolder(m_usbRoot)); - - if (!dstDir.mkpath(dstDir.absolutePath())) - { - ERROR_LOG(m_logger) << "Could not create destination path " << dstDir.absolutePath(); - return; - } - - qWarning() << "dst" << dstDir.absolutePath(); - - const QModelIndexList mil = m_ui->tvLocal->selectionModel()->selectedRows(); - if (mil.size() != 1) - return; - - ExportedScriptInformation esi = m_localThpModel->getRowData(mil.first().row()); - - if (!QDir(esi.rootDirectory).exists()) - return; - - QString src(getScriptFolder(esi.rootDirectory, esi.exerciseId, esi.scriptId)); - DEBUG_LOG(m_logger) << "src" << src; - - QDir srcDir(src); - QDir bldgDir( QStringLiteral("%1/BuildingModels").arg(getContentFolder(esi.rootDirectory, esi.exerciseId))); - - if (!srcDir.exists()) - { - ERROR_LOG(m_logger) << "src dir " << src << " is not accessible"; - return; - } - - auto cp = new CopyProcess(srcDir, dstDir, {}, true, this); - - auto cpBuildings = new CopyProcess(bldgDir, dstDir, {}, true, this); - cpBuildings->process(); - - setOverlay(cp->process()); - - connect(cp, &CopyProcess::finished, - this, [this, esi](bool success) - { - if (!success) - { - new LtsWidgets::LtsMessageDialogNew(this, tr("The files could not be copied successfully!")); - return; - } - - new LtsWidgets::LtsMessageDialogNew(this, tr("The files were copied successfully")); - - TMP_WARNING_LOG() << "GO GO GO"; - ExportedScriptInformation esi2(esi); - esi2.rootDirectory = m_usbRoot; - m_localThpModel->addDownloadData(esi2); - initUsbModel(); - - - }); -} - - -void USBDialog::slotRemove() -{ - - - if (m_usbRoot.isEmpty()) - return; - - const QModelIndexList mil = m_ui->tvUSB->selectionModel()->selectedRows(); - if (mil.size() < 1) - return; - - - DEBUG_LOG(m_logger) << "mil.size()" << mil.size(); - - - for (const QModelIndex &idx : mil) - { - int scriptId = idx.data(Qt::UserRole).toInt(); - - - scriptDeleted(scriptId); - } - - initUsbModel(); -} - - -void USBDialog::slotRemoveMaps() -{ - - - if (m_usbRoot.isEmpty()) - return; - - QDir dir(getContentFolder(m_usbRoot) + QDir::separator() + QStringLiteral("Maps")); - - if (!dir.exists()) - { - ERROR_LOG(m_logger) << "dir " << m_usbRoot << " is not accessible"; - return; - } - - const QModelIndexList mil = m_ui->tvUSBMaps->selectionModel()->selectedRows(); - if (mil.size() < 1) - return; - - - DEBUG_LOG(m_logger) << "mil.size()" << mil.size(); - - - for (const QModelIndex &idx : mil) - { - DEBUG_LOG(m_logger) << "rm" << idx.data().toString(); - QFile::remove(dir.absolutePath() + QDir::separator() + idx.data().toString()); - } - - - - initUsbModel(); - generateLayerMappingXML(); -} - - -void USBDialog::slotSelectionChanged() -{ - const QModelIndexList mil = m_ui->tvLocal->selectionModel()->selectedRows(); - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -} - - -void USBDialog::retranslate() -{ - translate(m_ui, tr("Manage exported scripts")); -} - - -void USBDialog::initModel() -{ - DEBUG_LOG(m_logger) << "(re)initModel !!"; - - - - - - - if (!m_localThpModel->init(getRootFolder())) - { - throw "init model failed for Export"; - if (!m_localThpModel->init(getRootFolder(true))) - throw "init model failed for Download"; - } - - m_ui->tvLocal->setModel(m_localThpModel); - - m_ui->tvLocal->hideColumn(ExportedScriptsModel::ColId); - m_ui->tvLocal->hideColumn(ExportedScriptsModel::ColLocation); - m_ui->tvLocal->hideColumn(ExportedScriptsModel::ColUploaded); - m_ui->tvLocal->hideColumn(ExportedScriptsModel::ColUploadedTime); - - - - - { - m_ui->tvLocalMaps->setRowCount(0); - m_ui->tvLocalMaps->clearContents(); - - - - QDirIterator tpit(QStringLiteral("/usr/share/arcgis/resources/TilePackage/"), QDir::Files | QDir::NoDotAndDotDot, - QDirIterator::Subdirectories | QDirIterator::FollowSymlinks); - while (tpit.hasNext()) - { - QString file = tpit.next(); - m_ui->tvLocalMaps->insertRow(m_ui->tvLocalMaps->rowCount()); - QFileInfo mapFile(file); - m_ui->tvLocalMaps->setItem(m_ui->tvLocalMaps->rowCount() - 1, 0, mapFile.fileName().contains(QStringLiteral("WebMerc")) ? new QTableWidgetItem(tr("3D Map")) : new QTableWidgetItem(tr("2D Map")) ); - m_ui->tvLocalMaps->setItem(m_ui->tvLocalMaps->rowCount() - 1, 1, new QTableWidgetItem(mapFile.fileName())); - m_ui->tvLocalMaps->setItem(m_ui->tvLocalMaps->rowCount() - 1, 2, new QTableWidgetItem(QFileInfo(file).absolutePath())); - } - - - QDirIterator slpkit(QStringLiteral("/usr/share/arcgis/resources/slpk/"), QDir::Files | QDir::NoDotAndDotDot, - QDirIterator::Subdirectories); - while (slpkit.hasNext()) - { - QString file = slpkit.next(); - if (!file.endsWith(QStringLiteral(".slpk"))) - continue; - QFileInfo fi(file); - if(fi.isSymLink()) - continue; - - m_ui->tvLocalMaps->insertRow(m_ui->tvLocalMaps->rowCount()); - m_ui->tvLocalMaps->setItem(m_ui->tvLocalMaps->rowCount() - 1, 0, new QTableWidgetItem(tr("3D Object"))); - m_ui->tvLocalMaps->setItem(m_ui->tvLocalMaps->rowCount() - 1, 1, new QTableWidgetItem(QFileInfo(file).fileName())); - m_ui->tvLocalMaps->setItem(m_ui->tvLocalMaps->rowCount() - 1, 2, new QTableWidgetItem(QFileInfo(file).absolutePath())); - } - - - - - - - - - - - - - - - - } - m_ui->tvLocalMaps->sortItems(0); - - m_ui->tvLocalMaps->hideColumn(2); - slotSelectionChanged(); -} - - -QString USBDialog::getContentFolder(const QString &rootFolder) const -{ - return QStringLiteral("%1/%2").arg(rootFolder, exerciseDirectoryName()); -} - - -QString USBDialog::getContentFolder() const -{ - return getContentFolder(getRootFolder(), m_exerciseId); -} - - - QString USBDialog::exerciseDirectoryName(int exerciseId) -{ - return QStringLiteral("Exercise_%1").arg(exerciseId); -} - - -QString USBDialog::exerciseDirectoryName() const -{ - return exerciseDirectoryName(m_exerciseId); -} - - - QString USBDialog::getContentFolder(const QString &rootFolder, int exerciseId) -{ - return QStringLiteral("%1/%2").arg(rootFolder, exerciseDirectoryName(exerciseId)); -} - - -QString USBDialog::getContentFolder(int exerciseId) const -{ - return getContentFolder(getRootFolder(), exerciseId); -} - - - QString USBDialog::getScriptFolder(const QString &rootFolder, int exerciseId, int scriptId) -{ - return QStringLiteral("%1/%2").arg(getContentFolder(rootFolder, exerciseId)).arg(scriptId); -} - - -QString USBDialog::getScriptFolder(const QString &rootFolder, int scriptId) const -{ - return getScriptFolder(rootFolder, m_exerciseId, scriptId); -} - - -QString USBDialog::getScriptFolder(int scriptId) const -{ - return getScriptFolder(getRootFolder(), m_exerciseId, scriptId); -} - - -QString USBDialog::getRootFolder(bool forceDownloadDir) const -{ - if (m_session->app() == LtsAppDescriptor::App::OC || forceDownloadDir) - return QDir::tempPath() + QStringLiteral("/THP-Download/"); - - return QDir::tempPath() + QStringLiteral("/THP-Export/"); -} - - -} - - -#include "tpm_usb_dialog.moc" diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpUsbManagement/tpm_usb_dialog.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpUsbManagement/tpm_usb_dialog.h deleted file mode 100755 index e23dc1287..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpUsbManagement/tpm_usb_dialog.h +++ /dev/null @@ -1,131 +0,0 @@ - - -#pragma once - -#include "logger.h" - -#include - -#include - -namespace Ui -{ -class USBDialog; -} -namespace LtsSession -{ -class LtsSession; -} - -namespace TakeHomePackageManager -{ -class ExportedScriptsModel; - -enum eLayerType -{ - elevation, - map, - sceneObject, - scene -}; - -struct layerMappinEntry -{ - eLayerType type; - QString description; - int maxScale; - int minScale; - QString name; - QString url; - -public: - - layerMappinEntry() - : type(eLayerType::map), description(QStringLiteral("NOTSET")), maxScale(125), minScale(-1), name(QStringLiteral("_name")), url(QStringLiteral("_url")) - { - - } - layerMappinEntry(eLayerType _type, QString _description, int _maxScale, int _minScale, QString _name, QString _url) - : type(_type), description(_description), maxScale(_maxScale), minScale(_minScale), name(_name), url(_url) - { - - } -}; - -class USBDialog : public LtsWidgets::LtsDialog -{ - Q_OBJECT -public: - - - explicit USBDialog(LtsSession::LtsSession *session, QWidget *parent = nullptr); - ~USBDialog(); - - void retranslate() override; - - static QString getContentFolder(const QString &rootFolder, int exerciseId); - QString getContentFolder(const QString &rootFolder) const; - - static QString exerciseDirectoryName(int exerciseId); - static QString getScriptFolder(const QString &rootFolder, int exerciseId, int scriptId); - -signals: - void nextMap(); - -private slots: - void slotSelectionChanged(); - - void slotCopy(); - void slotCopyMaps(); - void slotCopyWinBin(); - void slotCopyWinBinP2(); - void slotCopyWinBinP3(); - - void slotRemove(); - void slotRemoveMaps(); - - void slotChangePath(); - void onNextMap(); - void generateLayerMappingXML(); - - - -private: - - - -NGL::INGLLogger &m_logger; - enum class What - { - ScriptWasDeletedFromExercise, - ExerciseDirectoryWasDeleted, - NewExerciseDirectoryWasCreated, - ScriptWasCopiedToExercise, - }; - - void adjustJsonFiles(What what); - void initModel(); - void initUsbModel(); - void scriptDeleted(int scriptId); - void scriptCopied(int scriptId); - QFileInfoList prepareFileInfoListForFolder(QString src, QFileInfoList fil); - - QString getContentFolder(int exerciseId) const; - QString getContentFolder() const; - QString getRootFolder(bool forceDownloadDir = false) const; - QString exerciseDirectoryName() const; - QString getScriptFolder(const QString &rootFolder, int scriptId) const; - QString getScriptFolder(int scriptId) const; - - ExportedScriptsModel *m_localThpModel; - ExportedScriptsModel *m_usbThpModel; - Ui::USBDialog *m_ui; - LtsSession::LtsSession *m_session; - int m_exerciseId; - int m_paths; - QMap m_files; - - QString m_usbRoot; - int m_finished_mapCopys; -}; -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpUsbManagement/tpm_usb_dialog.ui b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpUsbManagement/tpm_usb_dialog.ui deleted file mode 100755 index 4b3ad469d..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpUsbManagement/tpm_usb_dialog.ui +++ /dev/null @@ -1,274 +0,0 @@ - - - USBDialog - - - - 0 - 0 - 1081 - 541 - - - - Form - - - - - - Qt::Vertical - - - - Local - - - - - - Qt::Horizontal - - - - - - - THPs - - - - - - - true - - - QAbstractItemView::ExtendedSelection - - - - - - - - 0 - 0 - - - - Copy selected THPs to USB - - - - - - - - - - - Maps - - - - - - - true - - - QAbstractItemView::SelectRows - - - true - - - false - - - - Type - - - - - Name - - - - - Path - - - - - - - - - 0 - 0 - - - - Copy selected Maps to USB - - - - - - - - - - - - On USB - - - - - - - - Path: - - - - - - - (none) - - - - - - - - 0 - 0 - - - - Change path - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - Qt::Horizontal - - - - - 0 - - - - - THPs - - - - - - - true - - - QAbstractItemView::ExtendedSelection - - - QAbstractItemView::SelectRows - - - - - - - - 0 - 0 - - - - Remove selected THPs from USB - - - - - - - - - - - Maps - - - - - - - true - - - QAbstractItemView::SelectRows - - - true - - - false - - - - Name - - - - - - - - - 0 - 0 - - - - Remove selected Maps from USB - - - - - - - - - - - - - - - - diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpUsbManagement/tpm_usb_gui_plugin.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpUsbManagement/tpm_usb_gui_plugin.cpp deleted file mode 100755 index f330eecb9..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpUsbManagement/tpm_usb_gui_plugin.cpp +++ /dev/null @@ -1,95 +0,0 @@ - - - -#include "tpm_usb_gui_plugin.h" -#include "tpm_usb_dialog.h" -#include "logger.h" - - - - -#include - - - - -namespace TakeHomePackageManager -{ -std::shared_ptr GuiPlugin::createGuiInterface(LtsSession::LtsSession *session) -{ - return std::make_shared(session); -} - - -InterfaceImpl::InterfaceImpl(LtsSession::LtsSession *session) - : GuiPluginBase::Interface(session, getLogger("Plugin")) -{ -} - - -bool InterfaceImpl::fetchInterfaces() -{ - return true; -} - - -QString InterfaceImpl::menuGroup() const -{ - return tr("Presentation"); -} - -QVector InterfaceImpl::getActions() -{ - - QVector ret; - - LtsWidgets::PluginData plData; - plData.menuGroup = menuGroup(); - - if (m_session->app() == LtsAppDescriptor::App::Scripts) - plData.exercisePart = LtsWidgets::ExercisePart::eSpecial; - else - plData.exercisePart = LtsWidgets::ExercisePart::eAfterAction; - - plData.identifier = QLatin1String("THP.USB.Dialog"); - plData.menuIcon = QIcon(QLatin1String("icon:export_documents.svg")); - plData.menuText = tr("USB Management"); - - plData.createWidgetFunc = [this](QWidget *) - { - return LtsWidgets::createThrowableDialog(m_session); - }; - ret.append(plData); - - return ret; -} - -} - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpUsbManagement/tpm_usb_gui_plugin.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpUsbManagement/tpm_usb_gui_plugin.h deleted file mode 100755 index d94abb2e2..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/ThpUsbManagement/tpm_usb_gui_plugin.h +++ /dev/null @@ -1,45 +0,0 @@ - - - -#pragma once -#include - -#include "logger.h" -#include -#include - -namespace TakeHomePackageManager -{ -class GuiPlugin final : public QObject, public GuiPluginBase::Plugin -{ - Q_PLUGIN_METADATA(IID "gui:3:tpm.usb") - Q_INTERFACES(GuiPluginBase::Plugin) - - Q_OBJECT -public: - GuiPlugin() = default; - ~GuiPlugin() = default; - - QString pluginName() override { return QLatin1String("ThpUsbManager"); } - std::shared_ptr createGuiInterface(LtsSession::LtsSession *session) override; - bool availableInPartition(IDL::PartitionType partition) const override - { - return partition == IDL::PartitionType::Exercise; - } -}; - -class InterfaceImpl final : public QObject, public GuiPluginBase::Interface, public ForeignTpmGuiInterface -{ - Q_OBJECT -public: - explicit InterfaceImpl(LtsSession::LtsSession *session); - - bool fetchInterfaces() override; - QString menuGroup() const override; - QVector getActions() override; - bool availableInPartition(IDL::PartitionType partition) const override { return partition == IDL::PartitionType::Exercise; } -private: - -}; - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/tpm_gui_plugin_interface.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/tpm_gui_plugin_interface.h deleted file mode 100755 index cdd08bbed..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/TakeHomePackageManager/OldTHP/tpm_gui_plugin_interface.h +++ /dev/null @@ -1,19 +0,0 @@ - - - -#pragma once -#include - - -namespace TakeHomePackageManager -{ - -class ForeignTpmGuiInterface -{ -public: - ForeignTpmGuiInterface() = default; - virtual ~ForeignTpmGuiInterface() = default; - static QString pluginName() { return QStringLiteral("TpmGuiPlugin"); } -}; - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/CMakeLists.txt b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/CMakeLists.txt deleted file mode 100755 index d72cbd486..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/CMakeLists.txt +++ /dev/null @@ -1,152 +0,0 @@ -# -# $Id$ -# $HeadURL$ -# $Author$ -# -# Created by Mike Wille, SLSE, 2017-02-10 -# - - -# EventFilter -# Make ${Qt6_Widgets} optional -if(QT6_GUI_AVAILABLE AND TARGET Qt6::Widgets) - set(Qt6_Widgets ${Qt6_Widgets}) -else() - set(Qt6_Widgets "") -endif() - -# Make ${Qt6_WebSockets} optional -if(QT6_GUI_AVAILABLE AND TARGET Qt6::WebSockets) - set(Qt6_WebSockets ${Qt6_WebSockets}) -else() - set(Qt6_WebSockets "") -endif() - - -SET(EventFilter_SRCS - EventFilter/AttributeEditingModeUI.h - EventFilter/AttributeEditingModeUI.cpp - EventFilter/AttributeSelectionModeUI.h - EventFilter/AttributeSelectionModeUI.cpp - - EventFilter/FilterWindow.h - EventFilter/FilterWindow.cpp - EventFilter/FilterTableEntry.h - EventFilter/FilterTableEntry.cpp - EventFilter/FilterTableEntryAttribute.h - EventFilter/FilterTableEntryAttribute.cpp - - EventFilter/interpreter/FilterWorker.h - EventFilter/interpreter/FilterWorker.cpp - - EventFilter/widgets/AbstractAttributeWidget.cpp - EventFilter/widgets/ComboBox.cpp - EventFilter/widgets/TimeRangeWidget.cpp - EventFilter/widgets/AreaWidget.cpp - EventFilter/widgets/DefaultRangeWidget.cpp - EventFilter/widgets/CheckBoxWidget.cpp - EventFilter/widgets/RadiusWidget.cpp - - EventFilter/interpreter/InfoWindow.h - EventFilter/interpreter/InfoWindow.cpp - EventFilter/interpreter/FilterEquationFunctions.cpp - EventFilter/interpreter/FilterValueInterpreter.cpp - - EventFilter/widgets/AbstractAttributeWidget.h - EventFilter/widgets/ComboBox.h - EventFilter/widgets/TimeRangeWidget.h - EventFilter/widgets/AreaWidget.h - EventFilter/widgets/DefaultRangeWidget.h - EventFilter/widgets/CheckBoxWidget.h - EventFilter/widgets/RadiusWidget.h - - EventFilter/interpreter/FilterEquationFunctions.h - EventFilter/interpreter/FilterValueInterpreter.h - - detail_data.h - detail_data.cpp - excon_filter.h - excon_filter.cpp - logger.h - logger.cpp -) - -SET(EventFilter_UICS - EventFilter/ui/FilterWindowUi.ui -) - - -# Timeline -SET(tln_view_gui_SRCS - attribute_value_lookup.cpp - attribute_value_lookup.h - tln_view_gui_plugin.cpp - tln_view_gui_plugin.h - tln_dialog.cpp - tln_dialog.h - tln_dialog_model.cpp - tln_dialog_model.h - tln_cache_dialog.cpp - tln_cache_dialog.h - tln_show_details.cpp - tln_show_details.h - tln_event_list.h - tln_event_list.cpp - tln_event_list_model.h - tln_event_list_model.cpp - tln_event_list_columns.h - tln_event_list_columns.cpp - tln_legend.h - tln_legend.cpp - - ${EventFilter_SRCS} -) - -NGL_WRAP_UI(tln_view_gui_SRCS - tln_dialog.ui - tln_cache_dialog.ui - tln_show_details.ui - tln_event_list.ui - tln_event_list_columns.ui - tln_legend.ui - - ${EventFilter_UICS} -) - -NGL_ADD_LIBRARY(WS TlnViewGuiPlugin MODULE ${tln_view_gui_SRCS}) -if(QT6_GUI_AVAILABLE) - NGL_TARGET_LINK_LIBRARIES(TlnViewGuiPlugin - ${Qt6_Widgets} - ${Qt6_WebSockets} - - LtsAppManager - LtsDataView - LtsTimelineClassic - LtsPrinting - LtsSession - LtsSessionData - LtsUtilsCore # data mod - LtsUtilsGuiDds - LtsUtilsSettings - LtsWidgets - NGLLogger - ngltools # dtg - - AvmDataPluginInterface - ExmDataPluginInterface - IsmDataPluginInterface - MrkDataPluginInterface - OpmDataPluginInterface - PdmDataPluginInterface - PpmDataPluginInterface - - FlmExplorerGuiPluginInterface - FltAesGuiPluginInterface # SitMap Filter - TlnDataPluginInterface - TlnViewGuiPluginInterface - - MrkCommon # SitMap Filter Helper - ) -endif() - -NGL_INSTALL_TARGET(TlnViewGuiPlugin) diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/AttributeEditingModeUI.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/AttributeEditingModeUI.cpp deleted file mode 100755 index 14dfba0d5..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/AttributeEditingModeUI.cpp +++ /dev/null @@ -1,218 +0,0 @@ - - - - - -#include "AttributeEditingModeUI.h" -#include "../detail_data.h" - -#include "widgets/TimeRangeWidget.h" -#include "widgets/DefaultRangeWidget.h" -#include "widgets/ComboBox.h" -#include "widgets/CheckBoxWidget.h" -#include "widgets/AreaWidget.h" -#include "widgets/RadiusWidget.h" - -#include "logger.h" - -#include -#include -#include - -namespace Timeline -{ - -AbstractAttributeWidget *EditingModeUI::createAttributeUIWidget(DetailData *detailData, const QString &attributeType, - int eventType, const QString &initialValue) -{ - AbstractAttributeWidget *resultWidget = nullptr; - QString concreteAttributeType = detailData->attributeRedirectionLookup.getRedirection(attributeType); - int attributeUIType = detailData->attributeUITypeLookup.getUIType(concreteAttributeType); - - if (attributeUIType == -1) - return nullptr; - - - - const DetailData::AttributeParameterLookup::ParameterMap &pm = detailData->attributeParameterLookup.getParameterMap(concreteAttributeType); - - switch (attributeUIType) - { - case DetailData::ATTRIBUTE_UI_TYPE_COMBO_BOX: - { - resultWidget = new ComboBox(detailData, concreteAttributeType, eventType, initialValue); - break; - } - - case DetailData::ATTRIBUTE_UI_TYPE_DEFAULT_RANGE_WIDGET: - { - bool minb = false; - unsigned int min = pm.value(DetailData::UI_PARAM_TYPE_MIN).toUInt(&minb); - - bool maxb = false; - unsigned int max = pm.value(DetailData::UI_PARAM_TYPE_MAX).toUInt(&maxb); - - QString prefix = pm.value(DetailData::UI_PARAM_TYPE_PREFIX).toString(); - - QString suffix = pm.value(DetailData::UI_PARAM_TYPE_SUFFIX).toString(); - - - if (!minb || !maxb) - { - WARNING_LOG(m_logger) << "createAttributeUIWidget: !minb (" << minb << ") || !maxb (" << maxb << ")"; - break; - } - - resultWidget = new DefaultRangeWidget(min, max, prefix, suffix, initialValue); - break; - } - - case DetailData::ATTRIBUTE_UI_TYPE_RAD_RANGE_WIDGET: - { - bool n1k = false; - int n1 = pm.value(DetailData::UI_PARAM_TYPE_N1).toUInt(&n1k); - - bool n2k = false; - int n2 = pm.value(DetailData::UI_PARAM_TYPE_N2).toUInt(&n2k); - - bool o1k = false; - int o1 = pm.value(DetailData::UI_PARAM_TYPE_O1).toUInt(&o1k); - - bool o2k = false; - int o2 = pm.value(DetailData::UI_PARAM_TYPE_O2).toUInt(&o2k); - - bool rk = false; - int r = pm.value(DetailData::UI_PARAM_TYPE_RAD).toUInt(&rk); - - if (n1k && n2k && o1k && o2k && rk) - { - resultWidget = new RadiusWidget(n1, n2, o1, o2, r); - break; - } - - WARNING_LOG(m_logger) << "DetailData::ATTRIBUTE_UI_TYPE_RAD_RANGE_WIDGET: errorious values!"; - - break; - } - - case DetailData::ATTRIBUTE_UI_TYPE_AREA_RANGE_WIDGET: - { - bool n1k = false; - int n1 = pm.value(DetailData::UI_PARAM_TYPE_N1).toUInt(&n1k); - - bool n2k = false; - int n2 = pm.value(DetailData::UI_PARAM_TYPE_N2).toUInt(&n2k); - - bool o1k = false; - int o1 = pm.value(DetailData::UI_PARAM_TYPE_O1).toUInt(&o1k); - - bool o2k = false; - int o2 = pm.value(DetailData::UI_PARAM_TYPE_O2).toUInt(&o2k); - - if (n1k && n2k && o1k && o2k) - { - resultWidget = new AreaWidget(n1, n2, o1, o2); - break; - } - - WARNING_LOG(m_logger) << "DetailData::ATTRIBUTE_UI_TYPE_AREA_RANGE_WIDGET: errorious values!"; - - break; - } - - case DetailData::ATTRIBUTE_UI_TYPE_CHECKBOX: - { - resultWidget = new CheckBoxWidget(detailData, concreteAttributeType, initialValue); - break; - } - - case DetailData::ATTRIBUTE_UI_TYPE_TIME_RANGE_WIDGET: - { - TimeRangeWidget *trw = new TimeRangeWidget(detailData, initialValue); - detailData->createRetrieveCurrentTimeCallback(trw->m_edit1); - detailData->createRetrieveCurrentTimeCallback(trw->m_edit2); - resultWidget = trw; - break; - } - - default: - { - WARNING_LOG(m_logger) << "createAttributeUIWidget: invalid attribute type #" << attributeUIType << "!"; - - break; - } - } - - - return resultWidget; -} - -void EditingModeUI::addAttributeContainer(int eventType, const QString &initialValue) -{ - - - AbstractAttributeWidget *attributeUIWidget = createAttributeUIWidget(m_detailData, attributeType, eventType, initialValue); - - if (attributeUIWidget == nullptr) - { - DEBUG_LOG(m_logger) << "addAttributeContainer: !attributeUIWidget"; - return; - } - - connect(attributeUIWidget, &AbstractAttributeWidget::destroyed, this, &EditingModeUI::signalChanges); - connect(attributeUIWidget, &AbstractAttributeWidget::signalChanges, this, &EditingModeUI::signalChanges); - - attributeValuesLayout->insertWidget(0, attributeUIWidget, 0, Qt::AlignTop); - attributeUIWidget->setFocus(); -} - -EditingModeUI::EditingModeUI(DetailData *detailData, const QString &attributeType, QWidget *parent) : QWidget(parent) - , attributeType(attributeType) - , m_detailData(detailData), - m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger()) { - QVBoxLayout *editingModeLayout = new QVBoxLayout; - - QWidget *filterTextWidget = new QWidget; - QHBoxLayout *filterTextLayout = new QHBoxLayout; - filterTextWidget->setLayout(filterTextLayout); - - pbDelete = new QPushButton(QStringLiteral("-")); - pbDelete->setToolTip(tr("Delete this attribute and all its values")); - pbDelete->setPalette(QPalette(QColor("red"))); - pbDelete->setMaximumWidth(30); - - lbFilterText = new QLabel; - - filterTextLayout->addWidget(lbFilterText, 0, Qt::AlignLeft); - filterTextLayout->addWidget(pbDelete, 1, Qt::AlignLeft); - - - QWidget *attributeValuesWidget = new QWidget; - attributeValuesLayout = new QVBoxLayout(); - attributeValuesWidget->setLayout(attributeValuesLayout); - pbAddAttributeContainer = new QPushButton(tr("Add Value")); - pbAddAttributeContainer->setPalette(QPalette(QColor("green"))); - - - setLayout(editingModeLayout); - editingModeLayout->addWidget(filterTextWidget, 0, Qt::AlignTop); - - - QWidget *horizontalLineWidget = new QWidget; - horizontalLineWidget->setFixedHeight(2); - horizontalLineWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); - horizontalLineWidget->setStyleSheet(QStringLiteral("background-color: #c0c0c0;")); - editingModeLayout->addWidget(horizontalLineWidget, 0, Qt::AlignTop); - - editingModeLayout->addWidget(pbAddAttributeContainer, 0, Qt::AlignTop | Qt::AlignLeft); - editingModeLayout->addWidget(attributeValuesWidget, 0, Qt::AlignTop); -} - -EditingModeUI::~EditingModeUI() -{ - const auto children = findChildren(); - for (auto child : children) - child->disconnect(this); -} - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/AttributeEditingModeUI.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/AttributeEditingModeUI.h deleted file mode 100755 index 871c162d2..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/AttributeEditingModeUI.h +++ /dev/null @@ -1,45 +0,0 @@ - - - -#pragma once - -#include -#include - -class QLabel; -class QPushButton; -class QVBoxLayout; -namespace Timeline -{ -class DetailData; -class AbstractAttributeWidget; - - -class EditingModeUI : public QWidget -{ - Q_OBJECT -public: - explicit EditingModeUI(DetailData *detailData, const QString &attributeType, QWidget *parent); - ~EditingModeUI(); - - void addAttributeContainer(int eventType, const QString &initialValue = QString()); - - QLabel *lbFilterText; - QPushButton *pbDelete; - QVBoxLayout *attributeValuesLayout; - QPushButton *pbAddAttributeContainer; - -private: - -NGL::INGLLogger &m_logger; - Timeline::AbstractAttributeWidget *createAttributeUIWidget(DetailData *detailData, const QString &attributeType, - int eventType, const QString &initialValue); - -signals: - void signalChanges(); -private: - QString attributeType; - DetailData *m_detailData; -}; - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/AttributeSelectionModeUI.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/AttributeSelectionModeUI.cpp deleted file mode 100755 index dd34b1ba8..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/AttributeSelectionModeUI.cpp +++ /dev/null @@ -1,72 +0,0 @@ - - - - -#include "../detail_data.h" -#include "AttributeSelectionModeUI.h" -#include "logger.h" - -namespace Timeline -{ - -QComboBox *SelectionModeUI::createAttributesComboBox(int eventType) -{ - QComboBox *cbAttributes = new QComboBox(); - - - - - DetailData::AttributeEventLookup::AttributeList attributeList = m_detailData->attributeEventLookup.getEventsAttributeList(eventType); - - for (auto i = attributeList.constBegin(); i != attributeList.constEnd(); ++i) - { - const QString &attributeKey = m_detailData->attributeRedirectionLookup.getRedirection(*i); - - - if (m_detailData->attributeInterpreterLookup.getInterpreterType(attributeKey) == DetailData::INTERPRETER_TYPE_NONE) - continue; - - QString cbAttribute = m_detailData->attributeTypeLookup.getAttributeText(attributeKey); - - if (cbAttribute.isEmpty()) - { - WARNING_LOG(m_logger) << "SelectionModeUI::createAttributesComboBox: event type " << eventType << " has no attribute text for attribute " << attributeKey << " for attribute event lookup - not added"; - } - else - { - cbAttributes->addItem(cbAttribute); - } - } - - return cbAttributes; -} - - -SelectionModeUI::SelectionModeUI(DetailData *detailData, const int eventType) : eventType(eventType) - , m_detailData(detailData), - m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger()) { - selectionModeWidget = new QWidget(); - selectionModeLayout = new QHBoxLayout(); - - lbFilterText = new QLabel(tr("Select attribute type to filter:")); - cbAttributeType = createAttributesComboBox(eventType); - - pbAddEditingMode = new QPushButton(tr("OK")); - pbAddEditingMode->setToolTip(tr("Add this attribute and start adding values")); - pbAddEditingMode->setPalette(QPalette(QColor("green"))); - pbAddEditingMode->setMaximumWidth(30); - - pbDeleteFilter = new QPushButton(QStringLiteral("-")); - pbDeleteFilter->setPalette(QPalette(QColor("red"))); - pbDeleteFilter->setToolTip(tr("Delete this attribute and all its values")); - pbDeleteFilter->setMaximumWidth(30); - - selectionModeLayout->addWidget(lbFilterText, 0, Qt::AlignCenter); - selectionModeLayout->addWidget(cbAttributeType, 0, Qt::AlignTop); - selectionModeLayout->addWidget(pbAddEditingMode, 0, Qt::AlignTop); - selectionModeLayout->addWidget(pbDeleteFilter, 1, Qt::AlignTop); - - selectionModeWidget->setLayout(selectionModeLayout); -} - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/AttributeSelectionModeUI.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/AttributeSelectionModeUI.h deleted file mode 100755 index 881d5b055..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/AttributeSelectionModeUI.h +++ /dev/null @@ -1,53 +0,0 @@ - - - - -#pragma once - -#include - -#include -#include -#include -#include -#include - - -namespace Timeline -{ -class DetailData; - -class SelectionModeUI : public QObject -{ - Q_OBJECT -private: -NGL::INGLLogger &m_logger; - SelectionModeUI &operator=(const SelectionModeUI &); - -public: - QComboBox *createAttributesComboBox(int eventType); - - - - explicit SelectionModeUI(DetailData *detailData, const int eventType); - - ~SelectionModeUI() - { - delete lbFilterText; - delete cbAttributeType; - delete pbAddEditingMode; - delete selectionModeLayout; - delete selectionModeWidget; - } - - int eventType; - QWidget *selectionModeWidget; - QHBoxLayout *selectionModeLayout; - QLabel *lbFilterText; - QComboBox *cbAttributeType; - QPushButton *pbAddEditingMode; - QPushButton *pbDeleteFilter; - DetailData *m_detailData; -}; - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/FilterTableEntry.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/FilterTableEntry.cpp deleted file mode 100755 index 9c2c67157..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/FilterTableEntry.cpp +++ /dev/null @@ -1,326 +0,0 @@ - - - - -#include "FilterTableEntry.h" -#include "FilterTableEntryAttribute.h" -#include "interpreter/FilterWorker.h" -#include "../detail_data.h" -#include "logger.h" - -#include -#include -#include - -#include - - -namespace Timeline -{ - -FilterTableEntry::FilterTableEntry(DetailData *detailData, const int &eventType, const bool &active, QWidget *parent) : QGroupBox(parent) - , m_eventType(eventType) - - - , m_mainLayout(new QVBoxLayout()) - , m_topLayout(new QHBoxLayout()) - , m_centerLayout(new QHBoxLayout()) - , m_cbEventSelector(nullptr) - , m_pbDelete(new QPushButton(QStringLiteral("-"))) - , m_pbFoundEvents(new QPushButton(tr("Show Events"))) - , m_pbFilterActive(new QPushButton(tr("Active"))) - , m_pbOK(new QPushButton(tr("OK"))) - , m_lbSelectText(new QLabel(tr("Select event type to filter:"))) - , m_detailData(detailData), - m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger()) { - m_cbEventSelector = getEventTypesComboBox(); - - m_pbDelete->setPalette(QPalette(QColor("red"))); - m_pbDelete->setToolTip(tr("Delete this filter and all its attributes")); - - m_pbFilterActive->setPalette(QPalette(QColor("orange"))); - m_pbFoundEvents->setPalette(QPalette(QColor("orange"))); - m_pbOK->setPalette(QPalette(QColor("green"))); - - m_pbOK->setToolTip(tr("Add this filter and start adding attributes (when needed)")); - connect(m_pbFilterActive, &QPushButton::clicked, this, &FilterTableEntry::signalChanges); - - - - - setLayout(m_mainLayout); - - - - QWidget *topLayoutWidget = new QWidget(this); - - - topLayoutWidget->setLayout(m_topLayout); - - m_mainLayout->addWidget(topLayoutWidget, 0, Qt::AlignTop); - - - - m_topLayout->addWidget(m_lbSelectText, 0, Qt::AlignLeft); - m_topLayout->addWidget(m_cbEventSelector, 0, Qt::AlignLeft); - - m_pbOK->setMinimumWidth(30); - m_pbOK->setMaximumWidth(30); - m_topLayout->addWidget(m_pbOK, 0, Qt::AlignLeft); - connect(m_pbOK, &QPushButton::clicked, this, &FilterTableEntry::slotSelectEventType); - - connect(m_pbDelete, &QPushButton::clicked, this, &FilterTableEntry::deleteLater); - m_pbDelete->setMinimumWidth(30); - m_pbDelete->setMaximumWidth(30); - m_topLayout->addWidget(m_pbDelete, 1, Qt::AlignLeft); - - QWidget *centerLayoutWidget = new QWidget(this); - centerLayoutWidget->setStyleSheet(topLayoutWidget->styleSheet()); - centerLayoutWidget->setLayout(m_centerLayout); - m_mainLayout->addWidget(centerLayoutWidget, 0); - - if (m_eventType > -1) - slotSelectEventType(); - - m_pbFoundEvents->setEnabled(active); - m_pbFilterActive->setCheckable(true); - m_pbFilterActive->setChecked(active); - m_pbFilterActive->setToolTip(m_pbFilterActive->isChecked() ? tr("Filter is active") : tr("Filter is inactive")); -} - -FilterTableEntry::~FilterTableEntry() -{ - const auto children = findChildren(); - for (auto child : children) - child->disconnect(this); -} - -void FilterTableEntry::updateData() -{ - for (int i = 0; i < m_centerLayout->count(); i++) - { - FilterTableEntryAttribute *ftec = dynamic_cast(m_centerLayout->itemAt(i)->widget()); - - if (!ftec) - { - WARNING_LOG(m_logger) << "FilterTableEntry::filterText(): !ftec"; - continue; - } - - ftec->updateData(m_detailData); - } -} - - -QComboBox *FilterTableEntry::getEventTypesComboBox() -{ - QComboBox *cbEventTypes = new QComboBox(); - cbEventTypes->addItems(m_detailData->eventTypeLookup.getEventTexts()); - cbEventTypes->model()->sort(0); - connect(cbEventTypes, static_cast(&QComboBox::currentIndexChanged), this, &FilterTableEntry::signalChanges); - - return cbEventTypes; -} - - -const QJsonObject FilterTableEntry::filter(bool typeSafe) const -{ - - - if (m_eventType == -1) - { - WARNING_LOG(m_logger) << "FilterTableEntry has no event type."; - - return {}; - } - - if (!m_centerLayout->count()) - { - - } - - - QJsonObject result; - - QString eventTypeString; - - if (typeSafe) - eventTypeString = QString::number(m_eventType); - else - eventTypeString = m_detailData->eventTypeLookup.getEventText(m_eventType); - - if (!eventTypeString.length()) - return QJsonObject(); - - - - - result[QStringLiteral("EventType")] = eventTypeString; - - QJsonArray attributes; - for (int i = 0; i < m_centerLayout->count(); i++) - { - FilterTableEntryAttribute *ftec = dynamic_cast(m_centerLayout->itemAt(i)->widget()); - - if (!ftec) - { - WARNING_LOG(m_logger) << "FilterTableEntry::filterText(): !ftec"; - continue; - } - - - - QJsonObject filterTile = ftec->filter(typeSafe); - - if (filterTile.isEmpty()) - continue; - - attributes.append(filterTile); - } - - result[QStringLiteral("Attributes")] = attributes; - result[QStringLiteral("Active")] = m_pbFilterActive->isChecked(); - - return result; -} - - -void FilterTableEntry::slotSelectEventType() -{ - delete m_lbSelectText; - - - if (m_cbEventSelector) - { - if (m_eventType == -1) - { - m_eventType = m_detailData->eventTypeLookup.getEventType(m_cbEventSelector->currentText()); - } - - m_lbEventName = new QLabel(QString(tr("Filter by event type: %1")).arg(m_detailData->eventTypeLookup.getEventText(m_eventType))); - m_lbEventName->setMinimumWidth(m_cbEventSelector->width()); - - delete m_cbEventSelector; - m_cbEventSelector = nullptr; - - m_topLayout->insertWidget(0, m_lbEventName); - } - - if (m_eventType == -1) - { - WARNING_LOG(m_logger) << "slotSelectEventType: m_eventType == -1"; - return; - } - - delete m_pbOK; - - - - - - - - QWidget *horizontalLineWidget = new QWidget(); - horizontalLineWidget->setFixedHeight(2); - horizontalLineWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); - horizontalLineWidget->setStyleSheet(QStringLiteral("background-color: #c0c0c0;")); - m_mainLayout->insertWidget(1, horizontalLineWidget, 0, Qt::AlignTop); - - delete m_pbDelete; - m_pbDelete = new QPushButton(QStringLiteral("-")); - m_pbDelete->setToolTip(tr("Delete this filter and all its attributes")); - m_pbDelete->setPalette(QPalette(QColor("red"))); - connect(m_pbDelete, &QPushButton::clicked, this, &FilterTableEntry::deleteLater); - m_pbDelete->setMinimumWidth(30); - m_pbDelete->setMaximumWidth(30); - m_topLayout->addWidget(m_pbDelete, 0, Qt::AlignLeft); - - m_topLayout->addWidget(m_pbFilterActive, 0, Qt::AlignLeft); - connect(m_pbFilterActive, &QPushButton::clicked, this, &FilterTableEntry::slotFilterActiveClicked); - - connect(m_pbFoundEvents, &QPushButton::clicked, this, &FilterTableEntry::slotShowEvents); - m_pbFoundEvents->setToolTip(tr("Show all events that fit to this filter")); - m_topLayout->addWidget(m_pbFoundEvents, 1, Qt::AlignLeft); - - - - - - DetailData::AttributeEventLookup::AttributeList attributeList = m_detailData->attributeEventLookup.getEventsAttributeList(m_eventType); - - - - QMutableListIterator it(attributeList); - - while (it.hasNext()) - { - const QString attributeType = it.next(); - - if (m_detailData->attributeInterpreterLookup.getInterpreterType(attributeType) == DetailData::INTERPRETER_TYPE_NONE) - it.remove(); - } - - if (attributeList.isEmpty()) - return; - - - QPushButton *pbAddAttribute = new QPushButton(tr("Add Attribute")); - pbAddAttribute->setPalette(QPalette(QColor("green"))); - connect(pbAddAttribute, &QPushButton::clicked, this, &FilterTableEntry::slotAddAttribute); - - - m_mainLayout->insertWidget(2, pbAddAttribute, 0, Qt::AlignLeft); -} - - -void FilterTableEntry::slotShowEvents() -{ - QJsonArray a; - a.append(filter(true )); - emit signalShowEvents(a); -} - - -void FilterTableEntry::slotFilterActiveClicked() -{ - if (m_pbFilterActive->isChecked()) - { - m_pbFilterActive->setPalette(QPalette(QColor("orange"))); - m_pbFilterActive->setToolTip(tr("Filter is active")); - m_pbFoundEvents->setPalette(QPalette(QColor("orange"))); - m_pbFoundEvents->setEnabled(true); - } - else - { - m_pbFilterActive->setPalette(QPalette(QColor("grey"))); - m_pbFilterActive->setToolTip(tr("Filter is inactive")); - m_pbFoundEvents->setPalette(QPalette(QColor("grey"))); - m_pbFoundEvents->setEnabled(false); - } -} - - -void FilterTableEntry::slotAddAttribute() -{ - addAttribute(); -} - - -bool FilterTableEntry::hasAttributes() const -{ - qWarning() << "hasAttributes? children: " << m_centerLayout->children().count(); - return !!m_centerLayout->children().count(); -} - - -FilterTableEntryAttribute *FilterTableEntry::addAttribute(const QString &attributeType) -{ - FilterTableEntryAttribute *ftec = new FilterTableEntryAttribute(m_detailData, m_eventType, attributeType, this); - connect(ftec, &FilterTableEntryAttribute::signalChanges, this, &FilterTableEntry::signalChanges); - connect(ftec, &FilterTableEntryAttribute::destroyed, this, &FilterTableEntry::signalChanges); - m_centerLayout->insertWidget(0, ftec, 1, Qt::AlignLeft); - - return ftec; -} - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/FilterTableEntry.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/FilterTableEntry.h deleted file mode 100755 index 5cf8b33c2..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/FilterTableEntry.h +++ /dev/null @@ -1,74 +0,0 @@ - - - - -#pragma once - -#include "FilterTableEntryAttribute.h" - -#include -#include -#include -#include -#include -#include -#include -#include - - -namespace Timeline -{ -class DetailData; - -class FilterTableEntry : public QGroupBox -{ - Q_OBJECT - -public: - explicit FilterTableEntry(DetailData *detailData, const int &eventType = -1, const bool &active = true, QWidget *parent = nullptr); - ~FilterTableEntry(); - const QJsonObject filter(bool typeSafe = false) const; - - - FilterTableEntryAttribute *addAttribute(const QString &attributeType = QString()); - bool hasAttributes() const; - void updateData(); - - -private: - NGL::INGLLogger &m_logger; - QComboBox *getEventTypesComboBox(); - - int m_eventType; - - - QVBoxLayout *m_mainLayout{nullptr}; - QHBoxLayout *m_topLayout{nullptr}; - QHBoxLayout *m_centerLayout{nullptr}; - QComboBox *m_cbEventSelector{nullptr}; - QLabel *m_lbEventName{nullptr}; - QPushButton *m_pbDelete{nullptr}; - QPushButton *m_pbFoundEvents{nullptr}; - QPushButton *m_pbFilterActive{nullptr}; - QPushButton *m_pbOK{nullptr}; - QLabel *m_lbSelectText{nullptr}; - DetailData *m_detailData{nullptr}; - -signals: - void signalShowEvents(const QJsonArray &filter); - void signalChanges(); - -private slots: - void slotAddAttribute(); - void slotFilterActiveClicked(); - void slotSelectEventType(); - void slotShowEvents(); - -public slots: - - - - -}; - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/FilterTableEntryAttribute.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/FilterTableEntryAttribute.cpp deleted file mode 100755 index 108903a75..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/FilterTableEntryAttribute.cpp +++ /dev/null @@ -1,210 +0,0 @@ - - - - -#include "interpreter/FilterWorker.h" -#include "FilterTableEntryAttribute.h" -#include "widgets/AbstractAttributeWidget.h" -#include "logger.h" -#include "../detail_data.h" - -#include -#include -#include - - -namespace Timeline -{ - -FilterTableEntryAttribute::FilterTableEntryAttribute(DetailData *detailData, int eventType, const QString &attributeType, QWidget *parent) : QGroupBox(parent) - , m_eventType(eventType) - , m_attributeType(attributeType) - , m_selectionModeUI(nullptr) - , m_editionModeUI(nullptr) - , m_attributesLayout(new QVBoxLayout()) - , m_detailData(detailData), - m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger()) { - - this->setTitle(QString()); - - setLayout(m_attributesLayout); - - - - - - - - - slotAddSelectionMode(); - - if (!attributeType.isEmpty()) - { - m_selectionModeUI->cbAttributeType->setCurrentIndex(m_selectionModeUI->cbAttributeType->findData(QVariant::fromValue(attributeType))); - slotAddEditingMode(false); - } -} - -FilterTableEntryAttribute::~FilterTableEntryAttribute() -{ - delete m_editionModeUI; -} - -void FilterTableEntryAttribute::updateData(DetailData *detailData) -{ - if (!m_editionModeUI) - return; - - for (int i = 0; i < m_editionModeUI->attributeValuesLayout->count(); i++) - { - AbstractAttributeWidget *aaw = dynamic_cast(m_editionModeUI->attributeValuesLayout->itemAt(i)->widget()); - - if (!aaw) - continue; - - aaw->updateData(detailData); - connect(aaw, &AbstractAttributeWidget::deleteClicked, this, [this]() - { - emit attributeChanged(false); - }); - } -} - - -const QJsonObject FilterTableEntryAttribute::filter(bool typeSafe) const -{ - if (m_attributeType.isEmpty()) - { - WARNING_LOG(m_logger) << "filterText: m_attributeType == -1"; - - return QJsonObject(); - } - - - QString attributeTypeName; - - if (typeSafe) - attributeTypeName = m_attributeType; - else - { - attributeTypeName = m_detailData->attributeTypeLookup.getAttributeText(m_attributeType); - } - - if (attributeTypeName.isEmpty()) - { - WARNING_LOG(m_logger) << "filterText: !attributeTypeName.length()"; - - return QJsonObject(); - } - - - QJsonObject result; - result[QStringLiteral("AttributeType")] = attributeTypeName; - - - - - - QJsonArray values; - - if (m_editionModeUI) - { - for (int i = 0; i < m_editionModeUI->attributeValuesLayout->count(); i++) - { - AbstractAttributeWidget *aaw = dynamic_cast(m_editionModeUI->attributeValuesLayout->itemAt(i)->widget()); - - if (!aaw) - continue; - - - - QString value = aaw->filterText(typeSafe); - - if (value.isEmpty()) - continue; - - values.append(value); - } - } - - - result[QStringLiteral("AttributeValues")] = values; - - return result; -} - -void FilterTableEntryAttribute::slotAddSelectionMode() -{ - - - - - - m_selectionModeUI = new SelectionModeUI(m_detailData, m_eventType); - - connect(m_selectionModeUI->pbAddEditingMode, &QPushButton::clicked, this, &FilterTableEntryAttribute::slotAddEditingMode); - connect(m_selectionModeUI->pbDeleteFilter, &QPushButton::clicked, this, &FilterTableEntryAttribute::slotDeleteAttributeContainer); - - m_attributesLayout->addWidget(m_selectionModeUI->selectionModeWidget, 0, Qt::AlignTop); -} - -void FilterTableEntryAttribute::slotAddEditingMode(bool createBlankContainer) -{ - - if (!m_selectionModeUI) - return; - - - QString attributeTypeString; - - if (m_attributeType.isEmpty()) - { - attributeTypeString = m_selectionModeUI->cbAttributeType->currentText(); - m_attributeType = m_detailData->attributeTypeLookup.getAttributeType(attributeTypeString); - } - else - { - attributeTypeString = m_detailData->attributeTypeLookup.getAttributeText(m_attributeType); - - } - - delete m_selectionModeUI; - m_selectionModeUI = nullptr; - - if (m_attributeType.isEmpty()) - { - WARNING_LOG(m_logger) << "slotAddEditingMode: invalid attribute type string!"; - return; - } - - m_editionModeUI = new EditingModeUI(m_detailData, m_attributeType, nullptr); - - connect(m_editionModeUI, &EditingModeUI::signalChanges, this, &FilterTableEntryAttribute::signalChanges); - connect(m_editionModeUI, &EditingModeUI::destroyed, this, &FilterTableEntryAttribute::signalChanges); - - connect(m_editionModeUI->pbAddAttributeContainer, &QPushButton::clicked, this, &FilterTableEntryAttribute::slotAddAttributeContainer); - connect(m_editionModeUI->pbDelete, &QPushButton::clicked, this, &FilterTableEntryAttribute::slotDeleteAttributeContainer); - m_editionModeUI->lbFilterText->setText(tr("Filter by attribute type: %1").arg(attributeTypeString)); - - m_attributesLayout->addWidget(m_editionModeUI, 0, Qt::AlignTop); - - - if (createBlankContainer) - slotAddAttributeContainer(); -} - -void FilterTableEntryAttribute::slotDeleteAttributeContainer() -{ - emit attributeChanged(false); - deleteLater(); -} - -void FilterTableEntryAttribute::slotAddAttributeContainer() -{ - emit signalChanges(); - emit attributeChanged(true); - if (m_editionModeUI != nullptr) - m_editionModeUI->addAttributeContainer(m_eventType); -} - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/FilterTableEntryAttribute.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/FilterTableEntryAttribute.h deleted file mode 100755 index 9245f15bc..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/FilterTableEntryAttribute.h +++ /dev/null @@ -1,52 +0,0 @@ - - - - -#pragma once - -#include "AttributeEditingModeUI.h" -#include "AttributeSelectionModeUI.h" -#include - -class QLabel; -class QVBoxLayout; -namespace Timeline -{ -class DetailData; - -class FilterTableEntryAttribute : public QGroupBox -{ - Q_OBJECT - -public: - explicit FilterTableEntryAttribute(DetailData *detailData, int eventType, const QString &attributeType, QWidget *parent = nullptr); - ~FilterTableEntryAttribute(); - const QJsonObject filter(bool typeSafe = false) const; - void updateData(DetailData *detailData); - - int m_eventType; - QString m_attributeType; - - - - SelectionModeUI *m_selectionModeUI; - EditingModeUI *m_editionModeUI; - - QVBoxLayout *m_attributesLayout; - QLabel *m_lbSelectText; - DetailData *m_detailData; - -signals: - void signalChanges(); - void attributeChanged(const bool &hasAttribute); - -private: - NGL::INGLLogger &m_logger; -private slots: - void slotAddAttributeContainer(); - void slotDeleteAttributeContainer(); - void slotAddSelectionMode(); - void slotAddEditingMode(bool createBlankContainer = true); -}; - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/FilterWindow.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/FilterWindow.cpp deleted file mode 100755 index 18d9e5176..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/FilterWindow.cpp +++ /dev/null @@ -1,317 +0,0 @@ - - - - -#include "FilterWindow.h" -#include "ui_FilterWindowUi.h" -#include "FilterTableEntry.h" -#include "interpreter/FilterWorker.h" -#include "../detail_data.h" -#include "logger.h" -#include - -#include -#include -#include -#include -#include - -#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0) -#include -#endif - - -#include - - -namespace Timeline -{ - -FilterWindow::FilterWindow(DetailData *detailData, - const std::shared_ptr &flmIfc, - LtsSession::LtsSession *session, - QWidget *parent) : LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::OkApplyCancel) - , m_flmIfc(flmIfc) - , m_ui(new Ui::FilterWindow) - , updateTimer(new QTimer(this)) - , m_detailData(detailData) - , m_session(session), - m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger()) { - m_ui->setupUi(this); - setMinimumSize(1500, 800); - - m_buttonBox->getButton(LtsWidgets::DialogButton::Ok)->hide(); - - m_buttonBox->connectButton(LtsWidgets::DialogButton::Add, - this, &FilterWindow::slotAddNewFilter); - - m_buttonBox->connectButton(LtsWidgets::DialogButton::Show, - this, &FilterWindow::slotShowEvents); - - m_buttonBox->connectButton(LtsWidgets::DialogButton::Save, - this, &FilterWindow::slotSave); - - m_buttonBox->connectButton(LtsWidgets::DialogButton::Load, - this, &FilterWindow::slotLoad); - - - - - - - connect(updateTimer, &QTimer::timeout, this, &FilterWindow::slotUpdate); - updateTimer->setInterval(5000); - updateTimer->start(); - - - - - - - - - setOnlineHelpFilename(QStringLiteral("Timeline-Filter_Functions")); -} - - -FilterWindow::~FilterWindow() -{ - const QList lst = findChildren(); - for (FilterTableEntry *fte : lst) - fte->disconnect(this); - updateTimer->stop(); - delete m_ui; -} - - -void FilterWindow::retranslate() -{ - translate(m_ui, tr("Filters")); - - m_buttonBox->getButton(LtsWidgets::DialogButton::Add)->setText(tr("Add Filter")); - m_buttonBox->getButton(LtsWidgets::DialogButton::Show)->setText(tr("Show Events")); -} - - -void FilterWindow::slotSave() -{ - int fileId = m_flmIfc->saveFileContent(this, FileManagement::FileType::Xml, m_session->exerciseId(), - filterToDoc(exportFilter())); - if (fileId > 0) - { - DEBUG_LOG(m_logger) << "Saved file with id = " << fileId; - __unchange__(); - } - else - ERROR_LOG(m_logger) << "Could not save file in library "; -} - - -void FilterWindow::slotUpdate() -{ - for (int i = 0; i < m_ui->filterContainer->count(); i++) - { - FilterTableEntry *fte = qobject_cast(m_ui->filterContainer->itemAt(i)->widget()); - - if (!fte) - continue; - - fte->updateData(); - } -} - - -FilterTableEntry *FilterWindow::addNewFilter(const int eventType, bool active) -{ - FilterTableEntry *fte = new FilterTableEntry(m_detailData, eventType, active, this); - - connect(fte, &FilterTableEntry::signalChanges, this, &FilterWindow::slotChangesMade); - connect(fte, &FilterTableEntry::destroyed, this, &FilterWindow::slotChangesMade); - connect(fte, &FilterTableEntry::signalShowEvents, this, &FilterWindow::signalShowEvents); - - m_ui->filterContainer->addWidget(fte); - - slotChangesMade(); - - return fte; -} - - -void FilterWindow::slotAddNewFilter() -{ - addNewFilter(); -} - - -const QJsonArray FilterWindow::exportFilter() const -{ - if (!m_ui->filterContainer->count()) - return QJsonArray(); - - QJsonArray result; - - for (int i = 0; i < m_ui->filterContainer->count(); i++) - { - FilterTableEntry *fte = qobject_cast(m_ui->filterContainer->itemAt(i)->widget()); - - if (!fte) - continue; - - const QJsonObject filterTile = fte->filter(true ); - if (filterTile.isEmpty()) - continue; - - result.append(filterTile); - } - - - qWarning() << "filter text:" << result; - - return result; -} - - -const QByteArray FilterWindow::filterToDoc(const QJsonArray &flt) -{ - QJsonObject obj; - obj[QStringLiteral("XmlType")] = FileManagement::toString(FileManagement::XmlType::TLNTimelineFilter); - obj[QStringLiteral("Filter")] = flt; - - QJsonDocument doc(obj); - return doc.toJson(QJsonDocument::Compact); -} - -bool FilterWindow::apply() -{ - slotApplyFilter(); - return true; -} - - -void FilterWindow::aboutToClose() -{ - -} - - -void FilterWindow::slotApplyFilter() -{ - emit signalApplyFilter(exportFilter()); - -} - - -void FilterWindow::slotShowEvents() -{ - emit signalShowEvents(exportFilter()); -} - - -void FilterWindow::slotLoad() -{ - QByteArray content; - int fileId = m_flmIfc->loadFileContent(this, content, {FileManagement::FileType::Xml}, m_session->exerciseId(), FileManagement::toString(FileManagement::XmlType::TLNTimelineFilter)); - if (fileId > 0) - { - - int msgResult = QMessageBox::question(this, - tr("Load filter set"), - tr("Do you really want to discard current filter set to load the requested filter set?\n" - "\n" - "Yes, discard current filter set and load a filter set.\n" - "No, do not make any changes."), - QMessageBox::Yes | QMessageBox::No, - QMessageBox::No); - - if (msgResult != QMessageBox::Yes) - return; - - if (!m_flmIfc->isXmlType(content, FileManagement::toString(FileManagement::XmlType::TLNTimelineFilter))) - { - QHash texts({{LtsWidgets::Button::Yes, tr("Ok")}}); - LtsWidgets::LtsMessageDialog::showMessage(this, - tr("Invalid xml file content"), - windowTitle(), - LtsWidgets::Behaviour::Modal, - LtsWidgets::Button::Yes, - texts); - } - else - { - const QJsonDocument doc(QJsonDocument::fromJson(content)); - const QJsonObject obj(doc.object()); - const QJsonArray tlnFilter(obj.value(QStringLiteral("Filter")).toArray()); - - loadFilters(tlnFilter); - slotChangesMade(); - } - } -} - - -bool FilterWindow::loadFilters(const QJsonArray &filter) -{ - setUnchangeable(); - - -#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0) - auto unchangableReset = qScopeGuard([this] { setUnchangeable(false); }); -#else - std::shared_ptr unchangeableReset(nullptr, [this](int *) { setUnchangeable(false); }); -#endif - - - - FilterWorker::GetModelFilterListResult result = FilterWorker::getModelFilterList(m_detailData, filter, true); - if (!FilterWorker::getInstance()->handleResultValues(result.resultValueList, this, true)) - { - LtsWidgets::LtsMessageDialog::showMessage(this, tr("The selected filter set is invalid and cannot be loaded."), tr("Cannot load filter")); - return false; - } - - - - while (m_ui->filterContainer->count()) - { - delete m_ui->filterContainer->itemAt(0)->widget(); - } - - - const ModelFilterList &modelFilterList = result.result; - - - int lastEventType = -1; - FilterTableEntry *lastFTW = nullptr; - - QString lastAttributeType; - FilterTableEntryAttribute *lastFTEA = nullptr; - - for (const FilterWorker::ModelFilter &mf : modelFilterList) - { - if (lastEventType != mf.eventType || lastEventType == -1 || !lastFTW) - { - lastEventType = mf.eventType; - lastFTW = addNewFilter(mf.eventType, mf.active); - } - - if (mf.attributeType == QString()) - continue; - - if (lastAttributeType != mf.attributeType || lastAttributeType.isEmpty() || !lastFTEA) - { - lastAttributeType = mf.attributeType; - lastFTEA = lastFTW->addAttribute(mf.attributeType); - } - - EditingModeUI *emui = lastFTEA->m_editionModeUI; - - if (!emui) - continue; - - emui->addAttributeContainer(mf.eventType, mf.attributeValue); - } - - return true; -} - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/FilterWindow.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/FilterWindow.h deleted file mode 100755 index b9fd92cee..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/FilterWindow.h +++ /dev/null @@ -1,81 +0,0 @@ - - - -#pragma once - -#include -#include -#include -#include - -#include -#include - - - -namespace Ui -{ -class FilterWindow; -} - - -namespace Timeline -{ -class DetailData; -class FilterTableEntry; -class FilterWorker; - -class FilterWindow : public LtsWidgets::LtsDialog -{ - Q_OBJECT -public: - explicit FilterWindow(DetailData *detailData, - const std::shared_ptr &flmIfc, - LtsSession::LtsSession *session, - QWidget *parent = nullptr); - ~FilterWindow(); - FilterTableEntry *addNewFilter(const int eventType = -1, bool active = true); - - - void clearSavedFiltersList(); - void updateData(); - const QJsonArray exportFilter() const; - const QByteArray filterToDoc(const QJsonArray &flt); - bool loadFilters(const QJsonArray &filter); - -private: - NGL::INGLLogger &m_logger; - void retranslate() override; - bool apply() override; - void aboutToClose() override; - - std::shared_ptr m_flmIfc; - Ui::FilterWindow *m_ui; - QTimer *updateTimer; - DetailData *m_detailData; - LtsSession::LtsSession *m_session; - -signals: - void signalConvertFilterText(const QString &); - void signalShowEvents(const QJsonArray &events); - void signalApplyFilter(const QJsonArray &filter); - void signalReloadSavedFiltersList(); - void signalDeleteFilter(int); - void signalReplaceFilter(int); - void signalReplaceFilterNow(int, const QString &); - - - -public slots: - void slotLoad(); - void slotSave(); - void slotUpdate(); - void slotAddNewFilter(); - -private slots: - void slotApplyFilter(); - void slotShowEvents(); - -}; - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/interpreter/FilterEquationFunctions.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/interpreter/FilterEquationFunctions.cpp deleted file mode 100755 index a34680f80..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/interpreter/FilterEquationFunctions.cpp +++ /dev/null @@ -1,291 +0,0 @@ - - - - -#include "logger.h" -#include "FilterEquationFunctions.h" -#include "FilterValueInterpreter.h" -#include "../../detail_data.h" - -#include -#include -#include - -namespace Timeline -{ -static bool inTime(DetailData *detailData, const QVariant &value, const QString &interpreterText) -{ - NGL::INGLLogger &logger(getLogger("FilterEquationFunctions")); - bool ok = false; - - unsigned int time = value.toUInt(&ok); - - if (!ok) - { - WARNING_LOG(logger) << "inTime: value error!" << value.toString(); - return false; - } - - InterpreterResult ir = interpretValue(detailData, DetailData::INTERPRETER_TYPE_RANGE, interpreterText); - - if (ir.resultType == InterpreterResult::InterpreterResultTypes::RESULT_SUCCESS && ir.resultList.count() == 2) - { - bool ok1 = false; - bool ok2 = false; - - unsigned int t1 = ir.resultList.at(0).toUInt(&ok1); - unsigned int t2 = ir.resultList.at(1).toUInt(&ok2); - - if (ok1 && ok2 && t1 <= time && t2 >= time) - { - return true; - } - } - - return false; -} - - - -static bool inArea(DetailData *detailData, const QVariant &value, const QString &interpreterText) -{ - NGL::INGLLogger &logger(getLogger("FilterEquationFunctions")); - (void)detailData; - - QStringList areaValuesList = value.toString().split(QLatin1Char('x')); - - if (areaValuesList.count() != 2) - { - WARNING_LOG(logger) << "inArea: areaValuesList.count() != 2 (" << areaValuesList.count() << ")"; - return false; - } - - QStringList interpreterValuesList = interpreterText.split(QLatin1Char('x')); - - if (interpreterValuesList.count() != 4) - { - WARNING_LOG(logger) << "inArea: interpreterValuesList.count() != 4 (" << interpreterValuesList.count() << ")"; - return false; - } - - bool nb = false; - int n = areaValuesList.at(0).toInt(&nb); - - bool ob = false; - int o = areaValuesList.at(1).toInt(&ob); - - - bool n1b = false; - int n1 = interpreterValuesList.at(0).toInt(&n1b); - - bool n2b = false; - int n2 = interpreterValuesList.at(1).toInt(&n2b); - - bool o1b = false; - int o1 = interpreterValuesList.at(2).toInt(&o1b); - - bool o2b = false; - int o2 = interpreterValuesList.at(3).toInt(&o2b); - - - - - - - - - if (!nb || !ob || !n1b || !n2b || !o1b || !o2b) - { - WARNING_LOG(logger) << "inArea: !nb || !ob || !n1b || !n2b || !o1b || !o2b"; - return false; - } - - - QRect range; - range.adjust(o1, n1, o2, n2); - - if (range.contains(o, n)) - { - WARNING_LOG(logger) << "inArea: in area!"; - return true; - } - - WARNING_LOG(logger) << "inArea: not in area"; - return false; -} - - -static bool inRad(DetailData *detailData, const QVariant &value, const QString &interpreterText) -{ - NGL::INGLLogger &logger(getLogger("FilterEquationFunctions")); - (void)detailData; - - QStringList radValuesList = value.toString().split(QLatin1Char('x')); - - if (radValuesList.count() != 2) - { - WARNING_LOG(logger) << "inRad: radValuesList.count() != 2 (" << radValuesList.count() << ")"; - return false; - } - - QStringList interpreterValuesList = interpreterText.split(QLatin1Char('x')); - - if (interpreterValuesList.count() != 3) - { - WARNING_LOG(logger) << "inArea: interpreterValuesList.count() != 3 (" << interpreterValuesList.count() << ")"; - return false; - } - - bool nb = false; - int n = radValuesList.at(0).toInt(&nb); - - bool ob = false; - int o = radValuesList.at(1).toInt(&ob); - - - bool n1b = false; - int n1 = interpreterValuesList.at(0).toInt(&n1b); - - bool o1b = false; - int o1 = interpreterValuesList.at(1).toInt(&o1b); - - bool r1b = false; - int r1 = interpreterValuesList.at(2).toInt(&r1b); - - - - - - - - - if (!nb || !ob || !n1b || !o1b || !r1b) - { - WARNING_LOG(logger) << "inRad: !nb || !ob || !n1b || !o1b || !r1b"; - return false; - } - - - QRect range; - range.adjust(o1 - r1, n1 - r1, o1 + r1, n1 + r1); - - if (range.contains(o, n)) - { - WARNING_LOG(logger) << "inRad: in radius!"; - return true; - } - - WARNING_LOG(logger) << "inRad: not in radius"; - return false; -} - - -static bool isIntEqual(DetailData *detailData, const QVariant &value, const QString &interpreterText) -{ - NGL::INGLLogger &logger(getLogger("FilterEquationFunctions")); - (void)detailData; - - bool ok1 = false; - bool ok2 = false; - - - - int i1 = value.toInt(&ok1); - int i2 = interpreterText.toInt(&ok2); - - if (!ok1 || !ok2) - { - WARNING_LOG(logger) << "isIntEqual: STR to INT conversion error! ok1 (" << ok1 << ") ok2 (" << ok2 << ") value (" << value.toString() << ") intTxt (" << interpreterText << ")"; - } - - if (ok1 && ok2 && i1 == i2) - { - return true; - } - - return false; -} - - -bool checkValue(DetailData *detailData, int attributeInterpreterType, const QVariant &value, const QString &interpreterText) -{ - switch(attributeInterpreterType) - { - case DetailData::INTERPRETER_TYPE_TIME: - { - return inTime(detailData, value, interpreterText); - } - - case DetailData::INTERPRETER_TYPE_AREA: - { - return inArea(detailData, value, interpreterText); - } - - case DetailData::INTERPRETER_TYPE_RAD: - { - return inRad(detailData, value, interpreterText); - } - - case DetailData::INTERPRETER_TYPE_STR_COMPARE: - { - - - if (value.toString() == interpreterText) - return true; - return false; - } - - case DetailData::INTERPRETER_TYPE_ID_COMPARE: - { - bool tryIt = isIntEqual(detailData, value, interpreterText); - - - - - - - - - - - - - - - - - - return tryIt; - } - - default: - { - - - - - - - - - - - - - - - - - return false; - } - } -} - - -bool FilterEquationFunctions::checkValue(DetailData *detailData, const QString &attributeType, const QVariant &value, const QString &interpreterText) -{ - int attributeInterpreterType = detailData->attributeInterpreterLookup.getInterpreterType(attributeType); - return checkValue(detailData, attributeInterpreterType, value, interpreterText); -} - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/interpreter/FilterEquationFunctions.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/interpreter/FilterEquationFunctions.h deleted file mode 100755 index 1af170a98..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/interpreter/FilterEquationFunctions.h +++ /dev/null @@ -1,20 +0,0 @@ - - - - -#pragma once - - -class QVariant; -class QString; - -namespace Timeline -{ -class DetailData; - -namespace FilterEquationFunctions -{ - bool checkValue(DetailData *detailData, const QString &attributeType, const QVariant &value, const QString &interpreterText); -} - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/interpreter/FilterValueInterpreter.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/interpreter/FilterValueInterpreter.cpp deleted file mode 100755 index 4e0e5340c..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/interpreter/FilterValueInterpreter.cpp +++ /dev/null @@ -1,163 +0,0 @@ - - - - -#include "FilterValueInterpreter.h" -#include "../../detail_data.h" - -#include -#include -#include - - -namespace Timeline -{ - -static InterpreterResult interpretAreaText(const QString &areaText) -{ - QStringList areaList = areaText.split(QLatin1Char('x')); - - if (areaList.count() != 4) - { - return InterpreterResult(InterpreterResult::InterpreterResultTypes::RESULT_AREATEXT_COUNT_NOT_FOUR); - } - - bool ok1 = false; - bool ok2 = false; - bool ok3 = false; - bool ok4 = false; - - int n1 = areaList.at(0).toInt(&ok1); - int n2 = areaList.at(1).toInt(&ok2); - int o1 = areaList.at(2).toInt(&ok3); - int o2 = areaList.at(3).toInt(&ok4); - - - - - if (!ok1) - { - return InterpreterResult(InterpreterResult::InterpreterResultTypes::RESULT_AREATEXT_CANNOT_INTERPRET_N1); - } - - if (!ok2) - { - return InterpreterResult(InterpreterResult::InterpreterResultTypes::RESULT_AREATEXT_CANNOT_INTERPRET_N2); - } - - if (!ok3) - { - return InterpreterResult(InterpreterResult::InterpreterResultTypes::RESULT_AREATEXT_CANNOT_INTERPRET_O1); - } - - if (!ok4) - { - return InterpreterResult(InterpreterResult::InterpreterResultTypes::RESULT_AREATEXT_CANNOT_INTERPRET_O2); - } - - InterpreterResult ir(InterpreterResult::InterpreterResultTypes::RESULT_SUCCESS); - ir.resultList.append(QRect(o1, n1, o2, n2)); - return ir; -} - - - -static InterpreterResult interpretToInt(const QString &text) -{ - bool ok = false; - - int result = text.toInt(&ok); - - if (!ok) - { - return InterpreterResult(InterpreterResult::InterpreterResultTypes::RESULT_TOINT_CANNOT_INTERPRET_VALUE); - } - - InterpreterResult ir(InterpreterResult::InterpreterResultTypes::RESULT_SUCCESS); - ir.resultList.append(result); - return ir; -} - -static InterpreterResult interpretRangeText(const QString &rangeText) -{ - QStringList rangeList = rangeText.split(QLatin1Char('-')); - - if (rangeList.count() != 2) - { - return InterpreterResult(InterpreterResult::InterpreterResultTypes::RESULT_RANGETEXT_COUNT_NOT_TWO); - } - - bool ok1 = false; - bool ok2 = false; - - unsigned int t1 = rangeList.at(0).toUInt(&ok1); - unsigned int t2 = rangeList.at(1).toUInt(&ok2); - - if (!ok1) - { - return InterpreterResult(InterpreterResult::InterpreterResultTypes::RESULT_RANGETEXT_CANNOT_INTERPRET_T1); - } - - if (!ok2) - { - return InterpreterResult(InterpreterResult::InterpreterResultTypes::RESULT_RANGETEXT_CANNOT_INTERPRET_T2); - } - - if (t1 > t2) - { - return InterpreterResult(InterpreterResult::InterpreterResultTypes::RESULT_RANGETEXT_BEGIN_GREATER_THAN_END); - } - - InterpreterResult ir(InterpreterResult::InterpreterResultTypes::RESULT_SUCCESS); - ir.resultList.append(t1); - ir.resultList.append(t2); - - return ir; -} - - -InterpreterResult interpretValue(DetailData *detailData, int attributeInterpreterType, const QString &value) -{ - (void)detailData; - - switch (attributeInterpreterType) - { - case DetailData::INTERPRETER_TYPE_ID_COMPARE: - { - return interpretToInt(value); - } - - case DetailData::INTERPRETER_TYPE_RANGE: - { - return interpretRangeText(value); - } - - case DetailData::INTERPRETER_TYPE_AREA: - { - return interpretAreaText(value); - } - - - - case DetailData::INTERPRETER_TYPE_STR_COMPARE: - { - InterpreterResult ir(InterpreterResult::InterpreterResultTypes::RESULT_SUCCESS); - ir.resultList.append(value); - return ir; - } - - default: - { - return InterpreterResult(InterpreterResult::InterpreterResultTypes::RESULT_ATTRIBUTE_HAS_NO_INTERPRETER); - } - } -} - - -InterpreterResult interpretValue(DetailData *detailData, const QString &attributeType, const QString &value) -{ - int interpreterType = detailData->attributeInterpreterLookup.getInterpreterType(attributeType); - return interpretValue(detailData, interpreterType, value); -} - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/interpreter/FilterValueInterpreter.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/interpreter/FilterValueInterpreter.h deleted file mode 100755 index 9b6016ca2..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/interpreter/FilterValueInterpreter.h +++ /dev/null @@ -1,58 +0,0 @@ - - - - -#pragma once - -#include -#include - - -namespace Timeline -{ -class DetailData; - -class InterpreterResult -{ -public: - enum class InterpreterResultTypes - { - RESULT_UNKNOWN, - RESULT_SUCCESS, - - RESULT_ATTRIBUTE_HAS_NO_INTERPRETER, - - RESULT_RANGETEXT_COUNT_NOT_TWO, - RESULT_RANGETEXT_BEGIN_GREATER_THAN_END, - RESULT_RANGETEXT_CANNOT_INTERPRET_T1, - RESULT_RANGETEXT_CANNOT_INTERPRET_T2, - - RESULT_AREATEXT_COUNT_NOT_FOUR, - RESULT_AREATEXT_CANNOT_INTERPRET_N1, - RESULT_AREATEXT_CANNOT_INTERPRET_N2, - RESULT_AREATEXT_CANNOT_INTERPRET_O1, - RESULT_AREATEXT_CANNOT_INTERPRET_O2, - - RESULT_TOINT_CANNOT_INTERPRET_VALUE - }; - - explicit InterpreterResult(const InterpreterResult::InterpreterResultTypes &res) - : resultType(res) - { - } - - InterpreterResult() - : resultType(InterpreterResultTypes::RESULT_UNKNOWN) - { - } - - InterpreterResultTypes resultType; - QList additionalInformation; - - QList resultList; -}; - -InterpreterResult interpretValue(DetailData *detailData, int attributeInterpreterType, const QString &value); -InterpreterResult interpretValue(DetailData *detailData, const QString &attributeType, const QString &value); - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/interpreter/FilterWorker.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/interpreter/FilterWorker.cpp deleted file mode 100755 index c1c75442f..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/interpreter/FilterWorker.cpp +++ /dev/null @@ -1,313 +0,0 @@ - - - - -#include "FilterWorker.h" -#include "InfoWindow.h" -#include "../../detail_data.h" - -#include -#include -#include -#include -#include - -#include - - -namespace Timeline -{ - -FilterWorker* FilterWorker::s_instance = nullptr; -FilterWorker* FilterWorker::getInstance() -{ - if (!s_instance) - { - s_instance = new FilterWorker(); - } - - return s_instance; -} - - -FilterWorker::~FilterWorker() -{ - -} - - -void FilterWorker::deleteInstance() -{ - - - - - - - - - - -} - - -FilterWorker::FilterWorker() -{ -#define addErrorHandler(x,y) { FilterWorker::ErrorHandler eh; eh.errorText = y; eh.errorParamCount = eh.errorText.split(QLatin1Char('%'), QString::SkipEmptyParts).count(); m_errorHandlerLookupMap.insert(x, eh); }(void)this - - - - addErrorHandler(GetModelFilterListResult::ERR_ATTRIBUTE_BLOCK_NOT_CLOSED, tr("Attribute block not closed: \n\'%1'")); - addErrorHandler(GetModelFilterListResult::ERR_ATTRIBUTE_HAS_NO_VALUES, tr("Attribute '%1' has no values")); - addErrorHandler(GetModelFilterListResult::ERR_COLON_MISUSE, tr("Colon misuse: \n\'%1'")); - addErrorHandler(GetModelFilterListResult::ERR_EVENT_HAS_NOT_ATTRIBUTE, tr("Attribute type '%1' does not belong to event type '%2': \n'%3'")); - addErrorHandler(GetModelFilterListResult::ERR_NO_EVENT_NAME, tr("No event name given for filter '%1'")); - addErrorHandler(GetModelFilterListResult::ERR_UNKNOWN_ATTRIBUTE_TYPE_BY_STRING, tr("Attribute type for '%1' does not exist")); - addErrorHandler(GetModelFilterListResult::ERR_UNKNOWN_EVENT_TYPE, tr("Event type '%1' does not exist")); - - - addErrorHandler(GetModelFilterListResult::ERR_VALUE_NOT_FOUND, tr("The attribute value '%1' is not a value of attribute type '%2'")); - addErrorHandler(GetModelFilterListResult::ERR_NO_VALUE_GIVEN, tr("There are no values given inside the brackets: \n'%1'")); - addErrorHandler(GetModelFilterListResult::ERR_TOO_MUCH_BRACKETS, tr("Too much brackets: \n'%1'")); -} - - - FilterWorker::Result makeResult(const int resultValue, const QString& additionalInformation = QString()) -{ - FilterWorker::Result result; - - result.resultValue = resultValue; - - if (!additionalInformation.isEmpty()) - { - result.additionalInformation.append(additionalInformation); - } - - return result; -} - - - FilterWorker::Result makeResult(const int resultValue, const QStringList& additionalInformationList) -{ - FilterWorker::Result result; - - result.resultValue = resultValue; - result.additionalInformation.append(additionalInformationList); - - return result; -} - - -FilterWorker::GetModelFilterListResult FilterWorker::getModelFilterList(DetailData *detailData, const QJsonArray &filter, bool fromTypeSafe) -{ - GetModelFilterListResult result; - - if (filter.isEmpty()) - { - - return result; - } - - for (auto i1 = filter.constBegin(); i1 != filter.constEnd(); ++i1) - { - const QJsonObject ¤tFilter = (*i1).toObject(); - - - - - - - - - - - - - QString eventTypeString = currentFilter[QStringLiteral("EventType")].toString(); - int eventType = -1; - - if (fromTypeSafe) - { - bool ok = false; - eventType = eventTypeString.toInt(&ok); - if (!ok) - { - eventType = -1; - } - } - else - { - eventType = detailData->eventTypeLookup.getEventType(eventTypeString); - } - - - QString eventTypeName = detailData->eventTypeLookup.getEventText(eventType); - if (!eventTypeName.isEmpty()) - eventTypeString = eventTypeName; - - - if (eventType == -1) - { - result.resultValueList.append(makeResult(GetModelFilterListResult::ResultValues::ERR_UNKNOWN_EVENT_TYPE, - eventTypeString)); - continue; - } - - - bool active = currentFilter[QStringLiteral("Active")].toBool(false); - const QJsonArray &attributes = currentFilter[QStringLiteral("Attributes")].toArray(); - - if (attributes.isEmpty()) - { - ModelFilter mf; - mf.eventType = eventType; - mf.attributeType = QString(); - mf.active = active; - - result.result.append(mf); - - continue; - } - - - - for (auto i2 = attributes.constBegin(); i2 != attributes.constEnd(); i2++) - { - const QJsonObject &attribute = (*i2).toObject(); - QString attributeType = attribute[QStringLiteral("AttributeType")].toString(); - - if (!fromTypeSafe) - { - attributeType = detailData->attributeTypeLookup.getAttributeType(attributeType); - } - - - - attributeType = detailData->attributeRedirectionLookup.getRedirection(attributeType); - - - if (attributeType.isEmpty()) - { - result.resultValueList.append(makeResult(GetModelFilterListResult::ResultValues::ERR_UNKNOWN_ATTRIBUTE_TYPE_BY_STRING, - attributeType)); - continue; - } - - - - - - - - - - - - - - - - - - - - - int interpreterType = detailData->attributeInterpreterLookup.getInterpreterType(attributeType); - - if (interpreterType == DetailData::INTERPRETER_TYPE_NONE) - { - continue; - } - - - const QJsonArray &attributeValues = attribute[QStringLiteral("AttributeValues")].toArray(); - for (auto i3 = attributeValues.constBegin(); i3 != attributeValues.constEnd(); ++i3) - { - QString attributeValueString = (*i3).toString(); - - - - ModelFilter mf; - mf.eventType = eventType; - mf.attributeType = attributeType; - mf.active = active; - mf.attributeValue = attributeValueString; - result.result.append(mf); - - - } - } - } - - return result; -} - - -bool FilterWorker::handleResultValues(const QVector &resultList, QWidget* parentWidget, bool ignoreInfos) -{ - bool errorOccured = false; - InfoWindowEntryList iwel; - - for (int i = 0; i < resultList.count(); i++) - { - FilterWorker::Result result = resultList.at(i); - int resultValue = result.resultValue; - - if (!errorOccured && (resultValue & GetModelFilterListResult::ERR) == GetModelFilterListResult::ERR) - { - errorOccured = true; - } - - if (ignoreInfos && (resultValue & GetModelFilterListResult::INFO) == GetModelFilterListResult::INFO) - { - continue; - } - - - - InfoWindowEntry iwe; - const ErrorHandler& eh = m_errorHandlerLookupMap.value(result.resultValue); - if (!eh.isValid()) - { - iwe.text = tr("Unhandled error (%1)"); - iwe.infoType = InfoWindowEntry::InfoTypes::Error; - iwel.append(iwe); - - continue; - } - - - - int additionalInformationCount = result.additionalInformation.count(); - QString iweText = eh.errorText; - - if (eh.errorParamCount) - { - for (int i2 = 0; i2 < eh.errorParamCount; i2++) - { - if (additionalInformationCount >= eh.errorParamCount) - { - iweText = iweText.arg(result.additionalInformation.at(i2)); - } - else - { - iweText = iweText.arg(QStringLiteral("???")); - } - } - } - - iwe.text = iweText; - iwel.append(iwe); - } - - - if (iwel.count()) - { - InfoWindow* iw = new InfoWindow(iwel, parentWidget); - iw->show(); - } - - return !errorOccured; -} - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/interpreter/FilterWorker.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/interpreter/FilterWorker.h deleted file mode 100755 index 1fde48665..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/interpreter/FilterWorker.h +++ /dev/null @@ -1,113 +0,0 @@ - - - -#pragma once - -#include -#include -#include -#include - - -namespace Timeline -{ -class DetailData; - -class FilterWorker : public QObject -{ - Q_OBJECT -private: - FilterWorker(); - ~FilterWorker(); - static FilterWorker* s_instance; - -public: - static FilterWorker* getInstance(); - static void deleteInstance(); - - - - - - - - - struct ModelFilter - { - int eventType = -1; - QString attributeType; - bool active = false; - QString attributeValue; - }; - - struct Result - { - int resultValue = -1; - QStringList additionalInformation; - }; - - struct GetModelFilterListResult - { - - - enum ResultType - { - ERR = 0x80, - WARN = 0x40, - INFO = 0x20, - }; - - enum ResultValues - { - - - - ERR_NO_EVENT_NAME = ERR | 0, - ERR_COLON_MISUSE = ERR | 1, - ERR_UNKNOWN_EVENT_TYPE = ERR | 2, - ERR_ATTRIBUTE_HAS_NO_VALUES = ERR | 3, - ERR_ATTRIBUTE_BLOCK_NOT_CLOSED = ERR | 4, - ERR_UNKNOWN_ATTRIBUTE_TYPE_BY_STRING = ERR | 5, - - ERR_EVENT_HAS_NOT_ATTRIBUTE = ERR | 7, - ERR_VALUE_NOT_FOUND = ERR | 8, - ERR_NO_VALUE_GIVEN = ERR | 9, - ERR_TOO_MUCH_BRACKETS = ERR | 10, - }; - - QVector resultValueList; - QVector result; - }; - - static GetModelFilterListResult getModelFilterList(DetailData *detailData, const QJsonArray &filter, bool fromTypeSafe = false); - bool handleResultValues(const QVector &resultList, QWidget* parentWidget = nullptr, bool ignoreInfos = false); - -private: - class ErrorHandler - { - public: - ErrorHandler(const QString& errorText = QString(), const int errorParamCount = 0) - : errorText(errorText) - , errorParamCount(errorParamCount) - { - - } - - bool isValid() const - { - if (errorText.isEmpty() && !errorParamCount) - return false; - return true; - } - - QString errorText; - int errorParamCount; - }; - - using ErrorHandlerLookupMap = QMap; - ErrorHandlerLookupMap m_errorHandlerLookupMap; -}; - -using ModelFilterList = QVector; - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/interpreter/InfoWindow.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/interpreter/InfoWindow.cpp deleted file mode 100755 index e90d76bbb..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/interpreter/InfoWindow.cpp +++ /dev/null @@ -1,128 +0,0 @@ - - - - -#include "InfoWindow.h" - -#include -#include - - -namespace Timeline -{ - -InfoWindow::InfoWindow(const InfoWindowEntryList &infoWindowEntryList, QWidget* parent) - : QDialog(parent) - , infoWindowEntryList(infoWindowEntryList) - - - - , mainLayout(new QVBoxLayout()) - , pbPrev(new QPushButton(tr("< Previous"))) - , lbIndicator(new QLabel()) - , pbNext(new QPushButton(tr("Next >"))) - , pbOK(new QPushButton(tr("OK"))) - , teText(new QTextEdit(tr("Missing Message"))) - - , listPosition(-1) -{ - if (!infoWindowEntryList.count()) - { - return; - } - - connect(pbPrev, &QPushButton::clicked, this, &InfoWindow::slotPrev); - connect(pbNext, &QPushButton::clicked, this, &InfoWindow::slotNext); - connect(pbOK , &QPushButton::clicked, this, &InfoWindow::deleteLater); - - - - QHBoxLayout* topButtonsLayout = new QHBoxLayout(); - pbPrev->setEnabled(false); - topButtonsLayout->addWidget(pbPrev); - topButtonsLayout->addWidget(lbIndicator); - topButtonsLayout->addWidget(pbNext); - pbNext->setEnabled(false); - QWidget* topButtonsWidget = new QWidget(); - topButtonsWidget->setLayout(topButtonsLayout); - mainLayout->addWidget(topButtonsWidget); - - - - mainLayout->addWidget(teText); - - - - QHBoxLayout* bottomButtonsLayout = new QHBoxLayout(); - bottomButtonsLayout->addWidget(pbOK); - QWidget* bottomButtonsWidget = new QWidget(); - bottomButtonsWidget->setLayout(bottomButtonsLayout); - mainLayout->addWidget(bottomButtonsWidget); - - - - slotNext(); - - this->setLayout(mainLayout); -} - -void InfoWindow::checkNavigationButtons(int newPosition) -{ - int listCount = infoWindowEntryList.count(); - - if (newPosition -1 >= 0) - { - pbPrev->setEnabled(true); - } - else - { - pbPrev->setEnabled(false); - } - - if (newPosition +2 > listCount) - { - pbNext->setEnabled(false); - } - else - { - pbNext->setEnabled(true); - } -} - -void InfoWindow::slotPrev() -{ - int listCount = infoWindowEntryList.count(); - int prevListPosition = listPosition - 1 ; - - checkNavigationButtons(prevListPosition); - - if (prevListPosition >= 0 && prevListPosition < listCount) - { - teText->setText(infoWindowEntryList.at(prevListPosition).text); - - QString indicatorString = QStringLiteral("%1/%2"); - lbIndicator->setText(indicatorString.arg(prevListPosition + 1 ).arg(listCount)); - - listPosition = prevListPosition; - } -} - -void InfoWindow::slotNext() -{ - int listCount = infoWindowEntryList.count(); - int nextListPosition = listPosition + 1 ; - - checkNavigationButtons(nextListPosition); - - if (nextListPosition >= 0 && nextListPosition < listCount) - { - teText->setText(infoWindowEntryList.at(nextListPosition).text); - - QString indicatorString = QStringLiteral("%1/%2"); - lbIndicator->setText(indicatorString.arg(nextListPosition + 1 ).arg(listCount)); - - listPosition = nextListPosition; - } -} - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/interpreter/InfoWindow.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/interpreter/InfoWindow.h deleted file mode 100755 index 3d8d3a56a..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/interpreter/InfoWindow.h +++ /dev/null @@ -1,61 +0,0 @@ - - - - -#pragma once - -#include -#include -#include -#include -#include -#include - - -namespace Timeline -{ - -struct InfoWindowEntry -{ - enum class InfoTypes - { - Error, - Info, - Warning - }; - - QString title; - QString text; - InfoTypes infoType = InfoTypes::Info; -}; - -typedef QVector InfoWindowEntryList; - - -class InfoWindow : public QDialog -{ - Q_OBJECT - -public: - InfoWindow(const InfoWindowEntryList &infoWindowEntryList, QWidget* parent = nullptr); - ~InfoWindow() = default; - -private: - InfoWindowEntryList infoWindowEntryList; - QVBoxLayout* mainLayout; - QPushButton* pbPrev; - QLabel* lbIndicator; - QPushButton* pbNext; - QPushButton* pbOK; - QTextEdit* teText; - int listPosition; - - void checkNavigationButtons(int newPosition); - - -public slots: - void slotPrev(); - void slotNext(); -}; - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/ui/FilterEditorUi.ui b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/ui/FilterEditorUi.ui deleted file mode 100755 index 7777f134d..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/ui/FilterEditorUi.ui +++ /dev/null @@ -1,1357 +0,0 @@ - - - FilterEditor - - - - 0 - 0 - 628 - 393 - - - - Filter Table - - - false - - - - 0 - - - - - false - - - QFrame::NoFrame - - - QFrame::Plain - - - true - - - - - 0 - 0 - 610 - 375 - - - - true - - - - - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 128 - 0 - - - - - - - 0 - 192 - 0 - - - - - - - 0 - 160 - 0 - - - - - - - 0 - 64 - 0 - - - - - - - 0 - 85 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 128 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 64 - 0 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 128 - 0 - - - - - - - 0 - 192 - 0 - - - - - - - 0 - 160 - 0 - - - - - - - 0 - 64 - 0 - - - - - - - 0 - 85 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 128 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 64 - 0 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 0 - 64 - 0 - - - - - - - 0 - 128 - 0 - - - - - - - 0 - 192 - 0 - - - - - - - 0 - 160 - 0 - - - - - - - 0 - 64 - 0 - - - - - - - 0 - 85 - 0 - - - - - - - 0 - 64 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 64 - 0 - - - - - - - 0 - 128 - 0 - - - - - - - 0 - 128 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 128 - 0 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - Add Filter - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 128 - 0 - - - - - - - 0 - 192 - 0 - - - - - - - 0 - 160 - 0 - - - - - - - 0 - 64 - 0 - - - - - - - 0 - 85 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 128 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 64 - 0 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 128 - 0 - - - - - - - 0 - 192 - 0 - - - - - - - 0 - 160 - 0 - - - - - - - 0 - 64 - 0 - - - - - - - 0 - 85 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 128 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 64 - 0 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 0 - 64 - 0 - - - - - - - 0 - 128 - 0 - - - - - - - 0 - 192 - 0 - - - - - - - 0 - 160 - 0 - - - - - - - 0 - 64 - 0 - - - - - - - 0 - 85 - 0 - - - - - - - 0 - 64 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 64 - 0 - - - - - - - 0 - 128 - 0 - - - - - - - 0 - 128 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 128 - 0 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - Apply Filters - - - - - - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 170 - 0 - - - - - - - 255 - 213 - 127 - - - - - - - 255 - 191 - 63 - - - - - - - 127 - 85 - 0 - - - - - - - 170 - 113 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 170 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 212 - 127 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 170 - 0 - - - - - - - 255 - 213 - 127 - - - - - - - 255 - 191 - 63 - - - - - - - 127 - 85 - 0 - - - - - - - 170 - 113 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 170 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 212 - 127 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 127 - 85 - 0 - - - - - - - 255 - 170 - 0 - - - - - - - 255 - 213 - 127 - - - - - - - 255 - 191 - 63 - - - - - - - 127 - 85 - 0 - - - - - - - 170 - 113 - 0 - - - - - - - 127 - 85 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 127 - 85 - 0 - - - - - - - 255 - 170 - 0 - - - - - - - 255 - 170 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 170 - 0 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - Show Events of all Filters - - - - - - - - - - - - - - diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/ui/FilterWindowUi.ui b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/ui/FilterWindowUi.ui deleted file mode 100755 index c0f503bde..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/ui/FilterWindowUi.ui +++ /dev/null @@ -1,81 +0,0 @@ - - - FilterWindow - - - - 0 - 0 - 628 - 393 - - - - Filter Table - - - false - - - - 0 - - - - - Closing this window will reset all filters for the timeline. - - - - - - - false - - - QFrame::NoFrame - - - QFrame::Plain - - - true - - - - - 0 - 0 - 610 - 358 - - - - true - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - - diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/AbstractAttributeWidget.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/AbstractAttributeWidget.cpp deleted file mode 100755 index bc89adc3b..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/AbstractAttributeWidget.cpp +++ /dev/null @@ -1,38 +0,0 @@ - - - - -#include "AbstractAttributeWidget.h" - -#include -#include - - -namespace Timeline -{ - -AbstractAttributeWidget::AbstractAttributeWidget(QWidget *parent) - : QWidget(parent) - , m_abstractMainLayout(new QHBoxLayout(this)) -{ - QPushButton *pbDelete(new QPushButton(QStringLiteral("-"))); - pbDelete->setPalette(QPalette(QColor("red"))); - pbDelete->setToolTip(tr("Delete this value")); - - m_abstractMainLayout->addWidget(pbDelete); - connect(pbDelete, &QPushButton::clicked, this, &AbstractAttributeWidget::slotDelete); -} - -void AbstractAttributeWidget::slotDelete() -{ - - emit deleteClicked(); - deleteLater(); -} - -void AbstractAttributeWidget::addCustomWidget(QWidget* widget) -{ - m_abstractMainLayout->insertWidget(0, widget, 1, Qt::AlignLeft); -} - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/AbstractAttributeWidget.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/AbstractAttributeWidget.h deleted file mode 100755 index 6bf3159ae..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/AbstractAttributeWidget.h +++ /dev/null @@ -1,36 +0,0 @@ - - - - -#pragma once - -#include - -class QHBoxLayout; - -namespace Timeline -{ -class DetailData; - -class AbstractAttributeWidget : public QWidget -{ - Q_OBJECT -public: - explicit AbstractAttributeWidget(QWidget *parent = nullptr); - virtual QString filterText(bool typeSafe = false) const = 0; - virtual void updateData(DetailData *detailData) = 0; - -protected: - void addCustomWidget(QWidget* widget); -protected: - QHBoxLayout *m_abstractMainLayout; - -private slots: - void slotDelete(); - -signals: - void signalChanges(); - void deleteClicked(); -}; - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/AreaWidget.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/AreaWidget.cpp deleted file mode 100755 index 41c126301..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/AreaWidget.cpp +++ /dev/null @@ -1,71 +0,0 @@ - - - - -#include "AreaWidget.h" - -#include -#include -#include - - -namespace Timeline -{ - -AreaWidget::AreaWidget(int n1, int n2, int o1, int o2, QWidget *parent) - : AbstractAttributeWidget(parent) - , sbN1(new QSpinBox()) - , sbN2(new QSpinBox()) - , sbO1(new QSpinBox()) - , sbO2(new QSpinBox()) -{ - connect(sbN1, static_cast(&QSpinBox::valueChanged), this, &AreaWidget::signalChanges); - connect(sbN2, static_cast(&QSpinBox::valueChanged), this, &AreaWidget::signalChanges); - connect(sbO1, static_cast(&QSpinBox::valueChanged), this, &AreaWidget::signalChanges); - connect(sbO2, static_cast(&QSpinBox::valueChanged), this, &AreaWidget::signalChanges); - - QString sbNPrefix = tr("N "); - QString sbOPrefix = tr("O "); - - sbN1->setPrefix(sbNPrefix); - sbN2->setPrefix(sbNPrefix); - sbO1->setPrefix(sbOPrefix); - sbO2->setPrefix(sbOPrefix); - - sbN1->setRange(n1, n2); - sbN2->setRange(n1, n2); - sbO1->setRange(o1, o2); - sbO2->setRange(o1, o2); - - sbN1->setValue(n1); - sbN2->setValue(n2); - sbO1->setValue(o1); - sbO2->setValue(o2); - - - QGridLayout* mainLayout = new QGridLayout(); - - mainLayout->addWidget(sbN1, 0, 1); - mainLayout->addWidget(sbN2, 2, 1); - mainLayout->addWidget(sbO1, 1, 0); - mainLayout->addWidget(sbO2, 1, 2); - - QWidget* mainLayoutWidget = new QWidget(); - mainLayoutWidget->setLayout(mainLayout); - - this->addCustomWidget(mainLayoutWidget); -} - -QString AreaWidget::filterText(bool typeSafe) const -{ - Q_UNUSED(typeSafe); - return QStringLiteral("%1x%2x%3x%4").arg(sbN1->cleanText(), sbN2->cleanText(), sbO1->cleanText(), sbO2->cleanText()); -} - -void AreaWidget::updateData(DetailData *detailData) -{ - - Q_UNUSED(detailData); -} - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/AreaWidget.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/AreaWidget.h deleted file mode 100755 index 562f32003..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/AreaWidget.h +++ /dev/null @@ -1,30 +0,0 @@ - - - -#pragma once - -#include "AbstractAttributeWidget.h" - - -class QSpinBox; - - -namespace Timeline -{ - -class AreaWidget : public AbstractAttributeWidget -{ - Q_OBJECT -public: - explicit AreaWidget(int n1, int n2, int o1, int o2, QWidget *parent = nullptr); - QString filterText(bool typeSafe = false) const override; - void updateData(DetailData *detailData) override; - -private: - QSpinBox* sbN1; - QSpinBox* sbN2; - QSpinBox* sbO1; - QSpinBox* sbO2; -}; - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/CheckBoxWidget.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/CheckBoxWidget.cpp deleted file mode 100755 index 72f38b929..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/CheckBoxWidget.cpp +++ /dev/null @@ -1,67 +0,0 @@ - - - -#include "CheckBoxWidget.h" -#include "../../detail_data.h" - -#include - - -namespace Timeline -{ - -CheckBoxWidget::CheckBoxWidget(DetailData *detailData, const QString &attributeType, const QString &initialValue, QWidget* parent) - : AbstractAttributeWidget(parent) - , cbCheck(new QCheckBox(this)) -{ - connect(cbCheck, &QCheckBox::stateChanged, this, &CheckBoxWidget::signalChanges); - - trueValue = detailData->attributeValueLookup.getValueStringFromValueId(attributeType, 1); - falseValue = detailData->attributeValueLookup.getValueStringFromValueId(attributeType, 0); - - cbCheck->setText(trueValue); - - addCustomWidget(cbCheck); - - if (initialValue.isEmpty()) - return; - - cbCheck->setChecked(initialValue != QStringLiteral("0")); -} - - -void CheckBoxWidget::setText(const QString &text) -{ - cbCheck->setText(text); -} - - -QString CheckBoxWidget::filterText(bool typeSafe) const -{ - QString filterText; - - if (cbCheck->isChecked()) - { - if (typeSafe) - filterText += QStringLiteral("1"); - else - filterText += trueValue; - } - else - { - if (typeSafe) - filterText += QStringLiteral("0"); - else - filterText += falseValue; - } - - return filterText; -} - - -void CheckBoxWidget::updateData(DetailData *) -{ - -} - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/CheckBoxWidget.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/CheckBoxWidget.h deleted file mode 100755 index 1b35239ee..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/CheckBoxWidget.h +++ /dev/null @@ -1,31 +0,0 @@ - - - -#pragma once - -#include "AbstractAttributeWidget.h" -#include "../../detail_data.h" - - -class QCheckBox; - - -namespace Timeline -{ - -class CheckBoxWidget : public AbstractAttributeWidget -{ - Q_OBJECT -public: - explicit CheckBoxWidget(DetailData *detailData, const QString &attributeType, const QString &initialValue, QWidget *parent = nullptr); - QString filterText(bool typeSafe = false) const override; - void updateData(DetailData *) override; - void setText(const QString &text); - -private: - QCheckBox* cbCheck; - QString trueValue; - QString falseValue; -}; - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/ComboBox.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/ComboBox.cpp deleted file mode 100755 index ebf9d3cad..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/ComboBox.cpp +++ /dev/null @@ -1,100 +0,0 @@ - - - - -#include "ComboBox.h" -#include "logger.h" - -#include - -namespace Timeline -{ - - -ComboBox::ComboBox(DetailData *detailData, const QString &attributeType, int eventType, const QString &initialValue, QWidget* parent) : AbstractAttributeWidget(parent) - , m_cbValues(new QComboBox()) - , m_eventType(eventType), - m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger()) { - connect(m_cbValues, static_cast(&QComboBox::currentIndexChanged), this, &ComboBox::signalChanges); - - addCustomWidget(m_cbValues); - - m_concreteAttributeType = detailData->attributeRedirectionLookup.getRedirection(attributeType); - - updateData(detailData); - - if (initialValue.isEmpty()) - return; - - bool k = false; - int initialValueKey = initialValue.toInt(&k); - - if (initialValueKey < 0 || !k) - { - WARNING_LOG(m_logger) << "ComboBox::c_tor: initialValueKey < 0 (" << initialValueKey << ")" << "initialValue: " << initialValue; - return; - } - - - m_cbValues->setCurrentIndex(m_cbValues->findData(initialValueKey, Qt::UserRole)); -} - - -void ComboBox::updateData(DetailData *detailData) -{ - int lastSelectedKey = -1; - - if (m_cbValues->currentIndex() > 0) - lastSelectedKey = m_cbValues->itemData(m_cbValues->currentIndex()).toInt(); - - - QSignalBlocker blocker(m_cbValues); - m_cbValues->clear(); - m_avm = detailData->m_attributeValueLookupDtc.getAttributeValueMap(m_eventType, m_concreteAttributeType); - if (m_avm.isEmpty()) - m_avm = detailData->attributeValueLookup.getAttributeValueMap(m_concreteAttributeType); - - for (auto i = m_avm.constBegin(); i != m_avm.constEnd(); ++i) - { - m_cbValues->addItem(i.value() -#ifdef DEBUG - + " (" + QString::number(i.key()) + ")" -#endif - , i.key()); - } - - if (lastSelectedKey < 0) - { - m_cbValues->setCurrentIndex(0); - return; - } - - - m_cbValues->setCurrentIndex(m_cbValues->findData(lastSelectedKey, Qt::UserRole)); - - DEBUG_LOG(m_logger) << "ComboBox: no initial item index found for value id" << lastSelectedKey; -} - - -QString ComboBox::filterText(bool typeSafe) const -{ - QString resultFilterText; - - bool ok = false; - int key = m_cbValues->itemData(m_cbValues->currentIndex()).toInt(&ok); - - if (!ok) - { - return resultFilterText; - } - - if (typeSafe) - resultFilterText = QString::number(key); - else - resultFilterText = m_avm.value(key); - - - return resultFilterText; -} - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/ComboBox.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/ComboBox.h deleted file mode 100755 index 9981718e3..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/ComboBox.h +++ /dev/null @@ -1,35 +0,0 @@ - - - - -#pragma once - -#include "AbstractAttributeWidget.h" -#include "../../detail_data.h" - -#include - -class QComboBox; - - -namespace Timeline -{ - -class ComboBox : public AbstractAttributeWidget -{ - Q_OBJECT -public: - explicit ComboBox(DetailData *detailData, const QString &attributeType, - int eventType, const QString &initialValue, QWidget *parent = nullptr); - QString filterText(bool typeSafe = false) const override; - void updateData(DetailData *detailData) override; - -private: - NGL::INGLLogger &m_logger; - QComboBox *m_cbValues; - int m_eventType; - QString m_concreteAttributeType; - AttributeValueMap m_avm; -}; - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/DefaultRangeWidget.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/DefaultRangeWidget.cpp deleted file mode 100755 index 99e255de6..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/DefaultRangeWidget.cpp +++ /dev/null @@ -1,91 +0,0 @@ - - - - -#include "DefaultRangeWidget.h" -#include "logger.h" - -#include -#include -#include -#include - -namespace Timeline -{ - -DefaultRangeWidget::DefaultRangeWidget(unsigned int min, unsigned int max, const QString &prefix, const QString &suffix, const QString &initialValue, QWidget *parent) : AbstractAttributeWidget(parent) - , box1(new QSpinBox()) - , box2(new QSpinBox()), - m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger()) { - connect(box1, static_cast(&QSpinBox::valueChanged), this, &DefaultRangeWidget::signalChanges); - connect(box2, static_cast(&QSpinBox::valueChanged), this, &DefaultRangeWidget::signalChanges); - - box1->setRange(min, max); - box2->setRange(min, max); - - box1->setPrefix(prefix); - box2->setPrefix(prefix); - - box1->setSuffix(suffix); - box2->setSuffix(suffix); - - box1->setValue(min); - box2->setValue(max); - - - QHBoxLayout* mainLayout = new QHBoxLayout(); - - mainLayout->addWidget(new QLabel(tr("between"))); - mainLayout->addWidget(box1); - mainLayout->addWidget(new QLabel(tr("and"))); - mainLayout->addWidget(box2); - - QWidget* mainLayoutWidget = new QWidget(); - mainLayoutWidget->setLayout(mainLayout); - - this->addCustomWidget(mainLayoutWidget); - - box1->setFocus(); - - - - if (initialValue.length()) - { - QStringList valueList = initialValue.split(QLatin1Char('-'), QString::SkipEmptyParts); - - if (valueList.count() != 2) - { - WARNING_LOG(m_logger) << "DefaultRangeWidget: invalid initial value '" << initialValue << "'"; - return; - } - - bool k1 = false; - bool k2 = false; - - unsigned int val1 = valueList.at(0).toUInt(&k1); - unsigned int val2 = valueList.at(1).toUInt(&k2); - - if (!k1 || !k2) - { - WARNING_LOG(m_logger) << "DefaultRangeWidget: initial value is not numeric '" << initialValue << "'"; - return; - } - - box1->setValue(val1); - box2->setValue(val2); - } -} - -QString DefaultRangeWidget::filterText(bool typeSafe) const -{ - Q_UNUSED(typeSafe); - return QStringLiteral("%1 - %2").arg(box1->value(), box2->value()); -} - -void DefaultRangeWidget::updateData(DetailData *detailData) -{ - - Q_UNUSED(detailData); -} - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/DefaultRangeWidget.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/DefaultRangeWidget.h deleted file mode 100755 index 096096471..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/DefaultRangeWidget.h +++ /dev/null @@ -1,38 +0,0 @@ - - - - -#pragma once - -#include "AbstractAttributeWidget.h" -#include - - -class QHBoxLayout; -class QSpinBox; - - -namespace Timeline -{ - -class DefaultRangeWidget : public AbstractAttributeWidget -{ - Q_OBJECT - -public: - explicit DefaultRangeWidget(unsigned int min, - unsigned int max, - const QString &prefix, - const QString &suffix, - const QString &initialValue = QString(), - QWidget *parent = nullptr); - QString filterText(bool typeSafe = false) const override; - void updateData(DetailData *detailData) override; - -private: - NGL::INGLLogger &m_logger; - QSpinBox* box1; - QSpinBox* box2; -}; - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/RadiusWidget.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/RadiusWidget.cpp deleted file mode 100755 index 68c4fcac3..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/RadiusWidget.cpp +++ /dev/null @@ -1,64 +0,0 @@ - - - - -#include "RadiusWidget.h" - -#include -#include -#include - - -namespace Timeline -{ - -RadiusWidget::RadiusWidget(int n1, int n2, int o1, int o2, int radius, QWidget *parent) - : AbstractAttributeWidget(parent) - , sbN(new QSpinBox(this)) - , sbO(new QSpinBox(this)) - , sbR(new QSpinBox(this)) -{ - Q_ASSERT(false); - - QString sbNPrefix = tr("N "); - QString sbOPrefix = tr("O "); - QString sbRPrefix = tr("radius of "); - - sbN->setPrefix(sbNPrefix); - sbO->setPrefix(sbOPrefix); - sbR->setPrefix(sbRPrefix); - - sbN->setRange(n1, n2); - sbO->setRange(o1, o2); - sbR->setRange(0, 9999); - - sbN->setValue(n1); - sbO->setValue(o1); - sbR->setValue(radius); - - - - QGridLayout* mainLayout = new QGridLayout(); - - mainLayout->addWidget(sbN, 0, 0); - mainLayout->addWidget(sbR, 0, 1); - mainLayout->addWidget(sbO, 0, 2); - - QWidget* mainLayoutWidget = new QWidget(); - mainLayoutWidget->setLayout(mainLayout); - - addCustomWidget(mainLayoutWidget); -} - -QString RadiusWidget::filterText(bool typeSafe) const -{ - Q_UNUSED(typeSafe); - return QStringLiteral("%1x%2x%3").arg(sbN->cleanText(), sbO->cleanText(), sbR->cleanText()); -} - -void RadiusWidget::updateData(DetailData *) -{ - -} - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/RadiusWidget.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/RadiusWidget.h deleted file mode 100755 index 177db4372..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/RadiusWidget.h +++ /dev/null @@ -1,29 +0,0 @@ - - - - -#pragma once - -#include "AbstractAttributeWidget.h" - -class QSpinBox; - - -namespace Timeline -{ - -class RadiusWidget : public AbstractAttributeWidget -{ - Q_OBJECT -public: - explicit RadiusWidget(int n1, int n2, int o1, int o2, int radius, QWidget *parent = nullptr); - QString filterText(bool typeSafe = false) const override; - void updateData(DetailData *detailData) override; - -private: - QSpinBox* sbN; - QSpinBox* sbO; - QSpinBox* sbR; -}; - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/TimeRangeWidget.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/TimeRangeWidget.cpp deleted file mode 100755 index a440d8b7f..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/TimeRangeWidget.cpp +++ /dev/null @@ -1,101 +0,0 @@ - - - - -#include "logger.h" -#include "TimeRangeWidget.h" -#include "../../detail_data.h" - -#include - -#include -#include -#include - - -namespace Timeline -{ - -TimeRangeWidget::TimeRangeWidget(DetailData *detailData, const QString &initialValue, QWidget *parent) : AbstractAttributeWidget(parent) - , m_edit1(new LtsWidgets::LtsDateTimeEdit(this)) - , m_edit2(new LtsWidgets::LtsDateTimeEdit(this)), - m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger()) { - connect(m_edit1, &LtsWidgets::LtsDateTimeEdit::dateTimeChanged, this, &TimeRangeWidget::signalChanges); - connect(m_edit2, &LtsWidgets::LtsDateTimeEdit::dateTimeChanged, this, &TimeRangeWidget::signalChanges); - - - - - - - - QHBoxLayout* mainLayout = new QHBoxLayout(); - - mainLayout->addWidget(new QLabel(tr("between"))); - mainLayout->addWidget(m_edit1); - mainLayout->addWidget(new QLabel(tr("and"))); - mainLayout->addWidget(m_edit2); - - QWidget* mainLayoutWidget = new QWidget(); - mainLayoutWidget->setLayout(mainLayout); - - addCustomWidget(mainLayoutWidget); - - m_edit1->setFocus(); - - - updateData(detailData); - - - if (initialValue.isEmpty()) - return; - - const auto initialTimeRange(initialValue.splitRef(QLatin1Char('-'), QString::SkipEmptyParts)); - - if (initialTimeRange.count() != 2) - { - WARNING_LOG(m_logger) << "invalid initial time range value: " << initialValue; - return; - } - - bool k = false; - qint64 time = initialTimeRange.at(0).toInt(&k); - time *= 1000; - - if (!k) - WARNING_LOG(m_logger) << "invalid initial time range start value: " << initialTimeRange.at(0).toString(); - else - m_edit1->setMsecsSinceEpoch(time); - - - time = initialTimeRange.at(1).toInt(&k); - time *= 1000; - - if (!k) - WARNING_LOG(m_logger) << "invalid initial time range start value: " << initialTimeRange.at(1).toString(); - else - m_edit2->setMsecsSinceEpoch(time); -} - - -QString TimeRangeWidget::filterText(bool typeSafe) const -{ - (void)typeSafe; - QString filterText; - - filterText += QString::number(m_edit1->msecsSinceEpoch() / 1000 ); - filterText += QLatin1Char('-'); - filterText += QString::number(m_edit2->msecsSinceEpoch() / 1000 ); - - return filterText; -} - - -void TimeRangeWidget::updateData(DetailData *detailData) -{ - LtsSession::LtsSession *session = detailData->session(); - m_edit1->setMsecsSinceEpoch(session->partitionTime() - 60 * 1000 ); - m_edit2->setMsecsSinceEpoch(session->partitionTime()); -} - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/TimeRangeWidget.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/TimeRangeWidget.h deleted file mode 100755 index 3d830587b..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/EventFilter/widgets/TimeRangeWidget.h +++ /dev/null @@ -1,35 +0,0 @@ - - - -#pragma once - -#include "AbstractAttributeWidget.h" - -#include - - -namespace LtsWidgets -{ -class LtsDateTimeEdit; -} - - -namespace Timeline -{ - -class TimeRangeWidget : public AbstractAttributeWidget -{ - Q_OBJECT -public: - explicit TimeRangeWidget(DetailData *detailData, const QString &initialValue, QWidget *parent = nullptr); - QString filterText(bool typeSafe = false) const override; - void updateData(DetailData *detailData) override; - -private: - NGL::INGLLogger &m_logger; -public: - LtsWidgets::LtsDateTimeEdit *m_edit1; - LtsWidgets::LtsDateTimeEdit *m_edit2; -}; - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/attribute_value_lookup.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/attribute_value_lookup.cpp deleted file mode 100755 index 4c2c918c3..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/attribute_value_lookup.cpp +++ /dev/null @@ -1,297 +0,0 @@ - - - -#include "attribute_value_lookup.h" -#include - -#include -#include -#include -#include -#include -#include - -#include -#include - -#include - -namespace Timeline -{ - - - - -AttributeValueMap AvmChargeType::getAttributeValueMap(int eventType) const -{ - if (!m_dtc) - return {}; - - using namespace ProjectDataManagement; - QVector charges; - switch (eventType) - { - case EventType::Hit: - case EventType::WeaponAssignment: - case EventType::FireEvent: - charges = m_dtc->chargesForGearClass(GearClass::GearClass_DuelSim); - break; - case EventType::HitBuilding: - charges = m_dtc->chargesForGearClass(GearClass::GearClass_DuelSim); - Q_FALLTHROUGH(); - case EventType::HitEffectSimulation: - charges += m_dtc->chargesForGearClass(GearClass::GearClass_Artillery); - charges += m_dtc->chargesForGearClass(GearClass::GearClass_Mortar); - charges += m_dtc->chargesForGearClass(GearClass::GearClass_Geopairing); - charges += m_dtc->chargesForGearClass(GearClass::GearClass_AirSupport); - charges += m_dtc->chargesForGearClass(GearClass::GearClass_MineArea); - charges += m_dtc->chargesForGearClass(GearClass::GearClass_Biological); - charges += m_dtc->chargesForGearClass(GearClass::GearClass_Chemical); - break; - case EventType::HitB: - charges = m_dtc->chargesForGearClass(GearClass::GearClass_Biological); - break; - case EventType::HitC: - charges = m_dtc->chargesForGearClass(GearClass::GearClass_Chemical); - break; - case EventType::BCContamination: - charges = m_dtc->chargesForGearClass(GearClass::GearClass_Biological); - charges += m_dtc->chargesForGearClass(GearClass::GearClass_Chemical); - break; - case EventType::HitMine: - case EventType::EnterMineArea: - case EventType::LeaveMineArea: - case EventType::MineArea: - charges = m_dtc->chargesForGearClass(GearClass::GearClass_MineArea); - - break; - } - Q_ASSERT(!charges.isEmpty()); - - AttributeValueMap ret; - for (const ChargeType &data : std::as_const(charges)) - ret.insert(data.id(), m_dtc->trChargeTypeShortName(data.id())); - return ret; -} - -QString AvmChargeType::getValueStringFromValueId(int attributeValueId) const -{ - if (!m_dtc) - return {}; - return m_dtc->trChargeTypeShortName(attributeValueId); -} - - - - -AttributeValueMap AvmGearType::getAttributeValueMap(int eventType) const -{ - using namespace ProjectDataManagement; - if (eventType != EventType_def::WeaponAssignment && - eventType != EventType_def::FireEvent) - { - Q_ASSERT(false); - return {}; - } - - if (!m_dtc) - return {}; - - const auto gearTypes = m_dtc->gearTypes(); - AttributeValueMap ret; - for (const auto &data : gearTypes) - { - if (data.gearClassId() == GearClass::GearClass_DuelSim && - data.tasCode() != 0) - ret.insert(data.id(), m_dtc->trGearTypeName(data.id())); - } - return ret; -} - -QString AvmGearType::getValueStringFromValueId(int attributeValueId) const -{ - if (!m_dtc) - return {}; - return m_dtc->trGearTypeName(attributeValueId); -} - - - - -AttributeValueMap AvmParty::getAttributeValueMap(int eventType) const -{ - Q_UNUSED(eventType); - - using namespace ParticipantManagement; - - if (!m_dtc) - return {}; - - const auto parties = m_dtc->partys(); - AttributeValueMap ret; - for (const auto &data : parties) - ret.insert(data.id(), trPartyName(data.name())); - return ret; -} - -QString AvmParty::getValueStringFromValueId(int attributeValueId) const -{ - using namespace ParticipantManagement; - if (!m_dtc) - return {}; - return trPartyName(m_dtc->party(attributeValueId).name()); -} - - - - -AttributeValueMap AvmEquipmentNumber::getAttributeValueMap(int eventType) const -{ - Q_UNUSED(eventType); - - using namespace ParticipantManagement; - - if (!m_dtc) - return {}; - - AttributeValueMap ret; - auto cb = [&ret](const ParticipantManagement::Participant & p) -> void - { - if (!p.equipmentNumber().is_set()) - return; - const auto equipNo = p.equipmentNumber().get(); - ret.insert(equipNo, QString::number(equipNo)); - }; - m_dtc->participants(cb); - return ret; -} - -QString AvmEquipmentNumber::getValueStringFromValueId(int attributeValueId) const -{ - if (!m_dtc) - return {}; - auto ret = m_dtc->participant(attributeValueId).equipmentNumber(); - return ret.is_set() ? QString::number(ret.get()) : QString(); -} - - - - -AttributeValueMap AvmOperator::getAttributeValueMap(int eventType) const -{ - Q_UNUSED(eventType); - - using namespace OperatorManagement; - - if (!m_dtc) - return {}; - - const auto users = m_dtc->users(); - AttributeValueMap ret; - for (const auto &data : users) - ret.insert(data.id(), QString::fromStdString(data.name())); - ret.insert(0, QObject::tr("EXCON")); - return ret; -} - -QString AvmOperator::getValueStringFromValueId(int attributeValueId) const -{ - if (attributeValueId == 0) - return QObject::tr("EXCON"); - if (!m_dtc) - return {}; - return QString::fromStdString(m_dtc->user(attributeValueId).name()); -} - - - - -AttributeValueMap AvmBuilding::getAttributeValueMap(int eventType) const -{ - Q_UNUSED(eventType); - - if (!m_dtc) - return {}; - - AttributeValueMap ret; - auto cb = [this, &ret](const InfrastructureManagement::MainStructureElement &mse) -> void - { - if (mse.structureElementTypeId() != InfrastructureManagement::StructureElementType::Building) - return; - ret.insert(mse.id(), m_dtc->getBuildingDisplayName(mse)); - }; - m_dtc->mainStructureElements(cb); - return ret; -} - -QString AvmBuilding::getValueStringFromValueId(int attributeValueId) const -{ - if (!m_dtc) - return {}; - return m_dtc->getBuildingDisplayName(attributeValueId); -} - - - - -AvmStreamName::AvmStreamName(const std::shared_ptr &dtc) - : m_dtc(dtc) - , m_snm(AudioVideoManagement::StreamNameMapping::create(m_dtc.get())) -{} - -AvmStreamName::~AvmStreamName() = default; - -AttributeValueMap AvmStreamName::getAttributeValueMap(int eventType) const -{ - AttributeValueMap ret; - - if (!m_dtc) - return ret; - - switch (eventType) - { - case ProjectDataManagement::PdmEventType::RadioCnr: - { - auto cb = [&ret](const AudioVideoManagement::CnrConfig &cnrConfig) -> void - { - ret.insert(cnrConfig.id(), QString::fromStdString(cnrConfig.radioCircuit())); - }; - m_dtc->cnrConfigs(cb); - break; - } - case ProjectDataManagement::PdmEventType::RadioTvc: - { - auto cb = [&ret](const AudioVideoManagement::TvcConfig &tvcConfig) -> void - { - ret.insert(tvcConfig.id(), QString::fromStdString(tvcConfig.radioCircuit())); - }; - m_dtc->tvcConfigs(cb); - break; - } - case ProjectDataManagement::PdmEventType::CameraVideo: - { - auto cb = [this, &ret](const AudioVideoManagement::Stream &stream) -> void - { - if (stream.mountingPointId() == 0 || - stream.type() != AudioVideoManagement::StreamType::Video) - return; - ret.insert(stream.id(), m_snm->displayName(stream.mountingPointId())); - }; - m_dtc->streams(cb); - break; - } - default: - break; - } - return ret; -} - -QString AvmStreamName::getValueStringFromValueId(int attributeValueId) const -{ - if (!m_dtc) - return {}; - return QString::fromStdString(m_dtc->stream(attributeValueId).name()); -} - - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/attribute_value_lookup.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/attribute_value_lookup.h deleted file mode 100755 index 5815b3a7e..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/attribute_value_lookup.h +++ /dev/null @@ -1,132 +0,0 @@ - - -#pragma once - -#include -#include -#include - -namespace AudioVideoManagement -{ -class StreamNameMapping; -namespace Interface -{ -class Dtc; -} -} -namespace InfrastructureManagement -{ -namespace Interface -{ -class Dtc; -} -} -namespace OperatorManagement -{ -namespace Interface -{ -class Dtc; -} -} -namespace ParticipantManagement -{ -namespace Interface -{ -class Dtc; -} -} -namespace ProjectDataManagement -{ -namespace Interface -{ -class Dtc; -} -} - -namespace Timeline -{ -using AttributeValueMap = QMap; -using AtributeValueLookupMap = QMap; - -class AttributeValueLookupProvider -{ -public: - virtual ~AttributeValueLookupProvider() = default; - virtual AttributeValueMap getAttributeValueMap(int eventType) const = 0; - virtual QString getValueStringFromValueId(int attributeValueId) const = 0; -}; - -class AvmChargeType final : public AttributeValueLookupProvider -{ -public: - explicit AvmChargeType(const std::shared_ptr &dtc) : m_dtc(dtc) {} - AttributeValueMap getAttributeValueMap(int eventType) const override; - QString getValueStringFromValueId(int attributeValueId) const override; -private: -NGL::INGLLogger &m_logger; - std::shared_ptr m_dtc; -}; - -class AvmGearType final : public AttributeValueLookupProvider -{ -public: - explicit AvmGearType(const std::shared_ptr &dtc) : m_dtc(dtc) {} - AttributeValueMap getAttributeValueMap(int eventType) const override; - QString getValueStringFromValueId(int attributeValueId) const override; -private: - std::shared_ptr m_dtc; -}; - -class AvmParty final : public AttributeValueLookupProvider -{ -public: - explicit AvmParty(const std::shared_ptr &dtc) : m_dtc(dtc) {} - AttributeValueMap getAttributeValueMap(int eventType) const override; - QString getValueStringFromValueId(int attributeValueId) const override; -private: - std::shared_ptr m_dtc; -}; - -class AvmEquipmentNumber final : public AttributeValueLookupProvider -{ -public: - explicit AvmEquipmentNumber(const std::shared_ptr &dtc) : m_dtc(dtc) {} - AttributeValueMap getAttributeValueMap(int eventType) const override; - QString getValueStringFromValueId(int attributeValueId) const override; -private: - std::shared_ptr m_dtc; -}; - -class AvmOperator final : public AttributeValueLookupProvider -{ -public: - explicit AvmOperator(const std::shared_ptr &dtc) : m_dtc(dtc) {} - AttributeValueMap getAttributeValueMap(int eventType) const override; - QString getValueStringFromValueId(int attributeValueId) const override; -private: - std::shared_ptr m_dtc; -}; - -class AvmBuilding final : public AttributeValueLookupProvider -{ -public: - explicit AvmBuilding(const std::shared_ptr &dtc) : m_dtc(dtc) {} - AttributeValueMap getAttributeValueMap(int eventType) const override; - QString getValueStringFromValueId(int attributeValueId) const override; -private: - std::shared_ptr m_dtc; -}; - -class AvmStreamName final : public AttributeValueLookupProvider -{ -public: - explicit AvmStreamName(const std::shared_ptr &dtc); - ~AvmStreamName(); - AttributeValueMap getAttributeValueMap(int eventType) const override; - QString getValueStringFromValueId(int attributeValueId) const override; -private: - std::shared_ptr m_dtc; - std::shared_ptr m_snm; -}; - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/detail_data.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/detail_data.cpp deleted file mode 100755 index 9e6ae2ad9..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/detail_data.cpp +++ /dev/null @@ -1,856 +0,0 @@ - - - -#include "detail_data.h" -#include "logger.h" -#include "tln_legend.h" -#include "attribute_value_lookup.h" - -#include -#include -#include -#include - - -#include -#include -#include -#include -#include -#include - - - -#include -#include -#include -#include -#include - -#include -#include -#include -#include - - -namespace Timeline -{ - -static inline QString removeSpaces(const QString &str) -{ - - QString ret; - ret.reserve(str.size()); - for (const QChar c : str) - { - if (!c.isSpace()) - ret += c; - } - return ret; -} - -DetailData::DetailData(LtsSession::LtsSession *session, QObject *parent) - : QObject(parent) - , m_session(session) - , __already_populated__(false) -{ - populate(); -} - -void DetailData::addRedirectedAttributeType(const QString &newAttributeTypeId, const QString &attributeText, const QString &redirectToAttributeTypeId) -{ - attributeTypeLookup.addAttributeText(newAttributeTypeId, attributeText); - attributeRedirectionLookup.addRedirection(newAttributeTypeId, redirectToAttributeTypeId); -} - - -void DetailData::addAttributeType(const QString &attributeTypeId, const QString &attributeText, const int uiTypeId, const int interpreterTypeId) -{ - attributeTypeLookup.addAttributeText(attributeTypeId, attributeText); - attributeUITypeLookup.addUITypeToAttribute(attributeTypeId, uiTypeId); - attributeInterpreterLookup.addInterpreterTypeToAttribute(attributeTypeId, interpreterTypeId); -} - - -void DetailData::addEventType(int eventTypeId, const QString &eventTypeString) -{ - eventTypeLookup.addEventType(eventTypeId, eventTypeString); - attributeEventLookup.addAttributesToEvent(eventTypeId, {QStringLiteral("TimeRange")}); -} - - -void DetailData::addEventType(const ProjectDataManagement::PdmEventType &eventType) -{ - addEventType(eventType.underlying(), ProjectDataManagement::toString(eventType)); -} - - -void DetailData::populate() -{ - if (__already_populated__) - return; - __already_populated__ = true; - - - - - - - - - addEventType(0, tr("General")); - - addEventType(markerTypeId, tr("Marker")); - attributeEventLookup.addAttributesToEvent(markerTypeId, {QStringLiteral("MarkerName"), - QStringLiteral("MarkerNote"), - QStringLiteral("Operator"), - QStringLiteral("MarkerOffset"), - QStringLiteral("IsSituationType"), - QStringLiteral("IsVideoType"), - QStringLiteral("IsAudioType")}); - - - using namespace ProjectDataManagement; - const auto possibleEventTypes = TimelineLegendDialog::possibleEvents(); - for (const auto eventType : possibleEventTypes) - { - switch (eventType.underlying()) - { - case EventType::Hit: - attributeEventLookup.addAttributesToEvent(eventType, {QStringLiteral("VulnerabilityState"), - QStringLiteral("OriginatorChargeTypeId"), - QStringLiteral("FriendlyFire"), - - - QStringLiteral("OriginatorEquipmentNumber")}); - break; - case EventType::BiteMessage: - break; - case EventType::WeaponAssignment: - case EventType::FireEvent: - attributeEventLookup.addAttributesToEvent(eventType, { - QStringLiteral("GearTypeId"), - QStringLiteral("ChargeTypeId")}); - break; - case EventType::HitBuilding: - attributeEventLookup.addAttributesToEvent(eventType, {QStringLiteral("AesType"), - QStringLiteral("ChargeTypeId"), - QStringLiteral("OriginatorEquipmentNumber"), - QStringLiteral("MainStructureElementId"), - QStringLiteral("VulnerabilityState"), - QStringLiteral("damagePercent"), - - }); - break; - case EventType::Manipulation: - break; - case EventType::Sanitation: - attributeEventLookup.addAttributesToEvent(eventType, {QStringLiteral("Vitality"), - QStringLiteral("SanitationProceduresNeeded"), - QStringLiteral("SanitationProceduresTaken")}); - break; - case EventType::CameraVideo: - attributeEventLookup.addAttributesToEvent(eventType, {QStringLiteral("PartyId"), - QStringLiteral("MainStructureElementId"), - QStringLiteral("duration"), - QStringLiteral("streamName")}); - break; - case EventType::RadioCnr: - attributeEventLookup.addAttributesToEvent(eventType, {QStringLiteral("PartyId"), - QStringLiteral("duration"), - QStringLiteral("streamName")}); - break; - case EventType::RadioTvc: - attributeEventLookup.addAttributesToEvent(eventType, {QStringLiteral("duration"), - QStringLiteral("streamName")}); - - break; - case EventType::HitEffectSimulation: - attributeEventLookup.addAttributesToEvent(eventType, {QStringLiteral("AesType"), - QStringLiteral("AesName"), - QStringLiteral("OriginatorChargeTypeId")}); - break; - case EventType::HitC: - case EventType::HitB: - case EventType::HitMine: - case EventType::EnterMineArea: - case EventType::LeaveMineArea: - attributeEventLookup.addAttributesToEvent(eventType, {QStringLiteral("AesName"), - QStringLiteral("OriginatorChargeTypeId")}); - break; - case EventType::HitN: - case EventType::HitGasPipe: - case EventType::EnterDangerArea: - case EventType::LeaveDangerArea: - case EventType::CrossLocalBorderline: - case EventType::CrossGlobalBorderline: - case EventType::EnterFunctionalArea: - case EventType::LeaveFunctionalArea: - case EventType::EnterNuclear: - case EventType::LeaveNuclear: - attributeEventLookup.addAttributesToEvent(eventType, {QStringLiteral("AesName")}); - break; - case EventType::Borderline: - case EventType::NContamination: - case EventType::DangerArea: - case EventType::FunctionalArea: - case EventType::MineCorridor: - case ProjectDataManagement::PdmEventType::GasPipe: - attributeEventLookup.addAttributesToEvent(eventType, {QStringLiteral("AesName"), - QStringLiteral("duration")}); - break; - case EventType::MineArea: - case EventType::BCContamination: - attributeEventLookup.addAttributesToEvent(eventType, {QStringLiteral("AesName"), - QStringLiteral("duration"), - QStringLiteral("ChargeTypeId")}); - break; - case EventType::Unknown: - case EventType::FriendlyFire: - case EventType::TechnicalArea: - case EventType::EquipmentErrorReport: - case EventType::EmergencyCall: - Q_ASSERT(false); - continue; - } - addEventType(eventType); - } - - - - - - - - - - - addAttributeType(QStringLiteral("TimeRange"), tr("Time range:"), ATTRIBUTE_UI_TYPE_TIME_RANGE_WIDGET , INTERPRETER_TYPE_TIME); - - - - addAttributeType(QStringLiteral("VulnerabilityState"), tr("Vulnerability State:")); - addAttributeValue(QStringLiteral("VulnerabilityState"), ProjectDataManagement::VulnerabilityState::CombatReady); - addAttributeValue(QStringLiteral("VulnerabilityState"), ProjectDataManagement::VulnerabilityState::LightDamage); - addAttributeValue(QStringLiteral("VulnerabilityState"), ProjectDataManagement::VulnerabilityState::MediumDamage); - addAttributeValue(QStringLiteral("VulnerabilityState"), ProjectDataManagement::VulnerabilityState::HeavyDamage); - addAttributeValue(QStringLiteral("VulnerabilityState"), ProjectDataManagement::VulnerabilityState::MobilityKill); - addAttributeValue(QStringLiteral("VulnerabilityState"), ProjectDataManagement::VulnerabilityState::VisibleMobilityKill); - addAttributeValue(QStringLiteral("VulnerabilityState"), ProjectDataManagement::VulnerabilityState::WeaponSystemDamage); - addAttributeValue(QStringLiteral("VulnerabilityState"), ProjectDataManagement::VulnerabilityState::VisibleWeaponSystemDamage); - addAttributeValue(QStringLiteral("VulnerabilityState"), ProjectDataManagement::VulnerabilityState::CatastrophicKill); - addAttributeValue(QStringLiteral("VulnerabilityState"), ProjectDataManagement::VulnerabilityState::TemporarySeverance); - addAttributeValue(QStringLiteral("VulnerabilityState"), ProjectDataManagement::VulnerabilityState::NearMiss); - addAttributeValue(QStringLiteral("VulnerabilityState"), ProjectDataManagement::VulnerabilityState::HitWithNoEffect); - - - - - addAttributeTypeWithYesAndNo(QStringLiteral("IsSituationType"), tr("Is situation type:")); - addAttributeTypeWithYesAndNo(QStringLiteral("IsVideoType"), tr("Is video type:")); - addAttributeTypeWithYesAndNo(QStringLiteral("IsAudioType"), tr("Is audio type:")); - - - - - addAttributeType(QStringLiteral("AesType"), tr("Aes Type:")); - - - addAttributeValue(QStringLiteral("AesType"), AreaEffectSimulation::AesType::AtNContamination); - addAttributeValue(QStringLiteral("AesType"), AreaEffectSimulation::AesType::AtBCContamination); - addAttributeValue(QStringLiteral("AesType"), AreaEffectSimulation::AesType::AtExplosionArea); - addAttributeValue(QStringLiteral("AesType"), AreaEffectSimulation::AesType::AtExplosionSingle); - addAttributeValue(QStringLiteral("AesType"), AreaEffectSimulation::AesType::AtMineArea); - addAttributeValue(QStringLiteral("AesType"), AreaEffectSimulation::AesType::AtDangerArea); - addAttributeValue(QStringLiteral("AesType"), AreaEffectSimulation::AesType::AtFunctionalArea); - addAttributeValue(QStringLiteral("AesType"), AreaEffectSimulation::AesType::AtMineCorridor); - addAttributeValue(QStringLiteral("AesType"), AreaEffectSimulation::AesType::AtBorderline); - - - addAttributeValue(QStringLiteral("AesType"), AreaEffectSimulation::AesType::AtMineAreaSingleMines); - - - - addAttributeTypeWithYesAndNo(QStringLiteral("FriendlyFire"), tr("Friendly Fire:")); - - - addAttributeTypeWithYesAndNo(QStringLiteral("DryFire"), tr("Dry Fire:")); - - - - - - addAttributeType(QStringLiteral("MarkerName"), tr("Name:"), ATTRIBUTE_UI_TYPE_CHECKBOX , INTERPRETER_TYPE_NONE); - addAttributeType(QStringLiteral("MarkerNote"), tr("Note:"), ATTRIBUTE_UI_TYPE_CHECKBOX , INTERPRETER_TYPE_NONE); - - - - - - - - addAttributeType(QStringLiteral("MarkerOffset"), tr("Offset [msecs]:"), ATTRIBUTE_UI_TYPE_DEFAULT_RANGE_WIDGET , INTERPRETER_TYPE_RANGE); - { - DetailData::AttributeParameterLookup::ParameterMap pm; - pm.insert(DetailData::UI_PARAM_TYPE_MIN, QVariant::fromValue(0)); - pm.insert(DetailData::UI_PARAM_TYPE_MAX, QVariant::fromValue(9999999)); - pm.insert(DetailData::UI_PARAM_TYPE_SUFFIX, QVariant::fromValue(QString())); - pm.insert(DetailData::UI_PARAM_TYPE_PREFIX, QVariant::fromValue(QString())); - attributeParameterLookup.addParameter(QStringLiteral("MarkerOffset"), pm); - } - - - - addAttributeType(QStringLiteral("duration"), tr("Duration [msecs]:"), ATTRIBUTE_UI_TYPE_DEFAULT_RANGE_WIDGET , INTERPRETER_TYPE_RANGE); - { - DetailData::AttributeParameterLookup::ParameterMap pm; - pm.insert(DetailData::UI_PARAM_TYPE_MIN, QVariant::fromValue(0)); - pm.insert(DetailData::UI_PARAM_TYPE_MAX, QVariant::fromValue(99999999)); - pm.insert(DetailData::UI_PARAM_TYPE_SUFFIX, QVariant::fromValue(QString())); - pm.insert(DetailData::UI_PARAM_TYPE_PREFIX, QVariant::fromValue(QString())); - attributeParameterLookup.addParameter(QStringLiteral("duration"), pm); - } - - - - addAttributeType(QStringLiteral("damagePercent"), tr("Damage [%]:"), ATTRIBUTE_UI_TYPE_DEFAULT_RANGE_WIDGET , INTERPRETER_TYPE_RANGE); - addRedirectedAttributeType(QStringLiteral("damagePercentOld"), tr("Damage before [%]:"), QStringLiteral("damagePercent")); - - { - DetailData::AttributeParameterLookup::ParameterMap pm; - pm.insert(DetailData::UI_PARAM_TYPE_MIN, QVariant::fromValue(0)); - pm.insert(DetailData::UI_PARAM_TYPE_MAX, QVariant::fromValue(100)); - pm.insert(DetailData::UI_PARAM_TYPE_SUFFIX, QVariant::fromValue(tr(" %"))); - pm.insert(DetailData::UI_PARAM_TYPE_PREFIX, QVariant::fromValue(QString())); - attributeParameterLookup.addParameter(QStringLiteral("damagePercent"), pm); - } - - - std::shared_ptr dtcPpm; - m_session->getDtc(dtcPpm); - addAttributeType(QStringLiteral("EquipmentNumber"), tr("Equip. No.:")); - m_attributeValueLookupDtc.addHandlerForDtc(QStringLiteral("EquipmentNumber"), new AvmEquipmentNumber(dtcPpm)); - addRedirectedAttributeType(QStringLiteral("OriginatorEquipmentNumber"), tr("Equip. No. of Originator:"), QStringLiteral("EquipmentNumber")); - - std::shared_ptr dtcPdm; - m_session->getDtc(dtcPdm); - - addAttributeType(QStringLiteral("ChargeTypeId"), tr("Charge Type:")); - addRedirectedAttributeType(QStringLiteral("OriginatorChargeTypeId"), tr("Originator Charge Type:"), QStringLiteral("ChargeTypeId")); - m_attributeValueLookupDtc.addHandlerForDtc(QStringLiteral("ChargeTypeId"), new AvmChargeType(dtcPdm)); - - - addAttributeType(QStringLiteral("GearTypeId"), tr("Gear Type:")); - m_attributeValueLookupDtc.addHandlerForDtc(QStringLiteral("GearTypeId"), new AvmGearType(dtcPdm)); - - - addAttributeType(QStringLiteral("OriginatorType"), tr("Originator Type:")); - addAttributeValue(QStringLiteral("OriginatorType"), ProjectDataManagement::StateChangeOriginator::Unknown); - addAttributeValue(QStringLiteral("OriginatorType"), ProjectDataManagement::StateChangeOriginator::Participant); - addAttributeValue(QStringLiteral("OriginatorType"), ProjectDataManagement::StateChangeOriginator::AreaEffectSimulation); - addAttributeValue(QStringLiteral("OriginatorType"), ProjectDataManagement::StateChangeOriginator::ObserverController); - addAttributeValue(QStringLiteral("OriginatorType"), ProjectDataManagement::StateChangeOriginator::ExerciseControl); - - - addAttributeValue(QStringLiteral("OriginatorType"), ProjectDataManagement::StateChangeOriginator::FunctionalArea); - addAttributeValue(QStringLiteral("OriginatorType"), ProjectDataManagement::StateChangeOriginator::Initialization); - addAttributeValue(QStringLiteral("OriginatorType"), ProjectDataManagement::StateChangeOriginator::ImprovisedExplosiveDevice); - addAttributeValue(QStringLiteral("OriginatorType"), ProjectDataManagement::StateChangeOriginator::DusMine); - const bool showPvSan = LtsUtils::ProjectSettings::isFunctionEnabled(QStringLiteral("ParticipantInformation"), - QStringLiteral("HasPvSan")); - if (showPvSan) - addAttributeValue(QStringLiteral("OriginatorType"), ProjectDataManagement::StateChangeOriginator::Sanitation); - - - - std::shared_ptr dtcIsm; - m_session->getDtc(dtcIsm); - addAttributeType(QStringLiteral("MainStructureElementId"), tr("Building:")); - m_attributeValueLookupDtc.addHandlerForDtc(QStringLiteral("MainStructureElementId"), new AvmBuilding(dtcIsm)); - - - addAttributeType(QStringLiteral("PartyId"), tr("Party:")); - m_attributeValueLookupDtc.addHandlerForDtc(QStringLiteral("PartyId"), new AvmParty(dtcPpm)); - - - std::shared_ptr dtcOpm; - m_session->getDtc(dtcOpm); - addAttributeType(QStringLiteral("Operator"), tr("Operator:")); - m_attributeValueLookupDtc.addHandlerForDtc(QStringLiteral("Operator"), new AvmOperator(dtcOpm)); - - - - std::shared_ptr dtcAvm; - m_session->getDtc(dtcAvm); - addAttributeType(QStringLiteral("streamName"), tr("Stream Name:")); - m_attributeValueLookupDtc.addHandlerForDtc(QStringLiteral("streamName"), new AvmStreamName(dtcAvm)); -} - -DetailData::GetDetailDataResultList DetailData::getDetailData(const LtsTimelineClassic::Event *event) -{ - GetDetailDataResultList result; - - if (event->detailData().isEmpty()) - return result; - - const QJsonObject &root = event->detailData(); - for (auto i = root.constBegin(); i != root.constEnd(); ++i) - { - DEBUG_LOG(m_logger) << "Adding Detail Data for: " << i.key(); - result.append(getDetailDataForAttribute(i.key(), *i)); - } - - return result; -} - - -DetailData::GetDetailDataForAttributeResult DetailData::getDetailDataForAttribute(const LtsTimelineClassic::Event *event, const QString &attributeType) -{ - GetDetailDataForAttributeResult result; - - const QJsonObject &root = event->detailData(); - root[QStringLiteral("TimeRange")] = event->startTime() / 1000 ; - root[QStringLiteral("PartyId")] = event->partyId(); - - const QJsonValue attribute = root[attributeType]; - - if (attribute.isNull() || attribute.isUndefined()) - { - WARNING_LOG(m_logger) << "DetailData::getDetailDataForAttribute: no attribute type " << attributeType - << " in " << QJsonDocument(root).toJson(); - - result.requestResult = DetailData::RequestResult::InvalidAttributeType; - return result; - } - - return getDetailDataForAttribute(attributeType, attribute); -} - - -DetailData::GetDetailDataForAttributeResult DetailData::getDetailDataForAttribute(const QString &attributeType, const QJsonValue &attributeValueJson) -{ - GetDetailDataForAttributeResult result; - result.attributeTypeId = attributeType; - result.attributeValueId = -1; - result.requestResult = DetailData::RequestResult::Error; - QString attributeTypeTranslated = attributeTypeLookup.getAttributeText(attributeType); - - if (attributeTypeTranslated.isEmpty()) - { - result.requestResult = DetailData::RequestResult::InvalidAttributeType; - - return result; - } - - result.attributeType = attributeTypeTranslated; - - int attributeValueId = -1; - - - - - switch (attributeValueJson.type()) - { - - case QJsonValue::Double: - { - attributeValueId = attributeValueJson.toInt(-1); - break; - } - - case QJsonValue::Null: - case QJsonValue::Undefined: - { - WARNING_LOG(m_logger) << "Timeline: DetailData::getDetailDataForAttribute: attribute value is null or undefined! " << attributeValueJson.toString(); - result.requestResult = DetailData::RequestResult::InvalidAttributeTypeJson; - return result; - } - - case QJsonValue::Bool: - { - attributeValueId = attributeValueJson.toBool() ? 1 : 0; - break; - } - - case QJsonValue::String: - { - bool k = false; - QString attributeValueString = attributeValueJson.toString(); - - if (attributeValueString.isEmpty()) - { - attributeValueId = -1; - break; - } - - attributeValueId = attributeValueString.toInt(&k); - - if (!k) - { - result.attributeValue = attributeValueString; - result.requestResult = DetailData::RequestResult::Okay; - return result; - } - - break; - } - - default: - { - WARNING_LOG(m_logger) << "Timeline: DetailData::getDetailDataForAttribute: attribute value cannot be handled. Type " << attributeValueJson.type() << attributeValueJson.toString(); - result.requestResult = DetailData::RequestResult::InvalidAttributeType; - return result; - } - } - - if (attributeValueId == -1) - { - result.requestResult = DetailData::RequestResult::InvalidAttributeType; - return result; - } - - result.attributeValueId = attributeValueId; - - - - int attributeUiType = attributeUITypeLookup.getUIType(attributeType); - switch (attributeUiType) - { - - case ATTRIBUTE_UI_TYPE_TIME_RANGE_WIDGET: - case ATTRIBUTE_UI_TYPE_DEFAULT_RANGE_WIDGET: - case ATTRIBUTE_UI_TYPE_RAD_RANGE_WIDGET: - case ATTRIBUTE_UI_TYPE_AREA_RANGE_WIDGET: - { - result.attributeValue = QString::number(attributeValueId); - result.requestResult = DetailData::RequestResult::Okay; - - break; - } - - - case ATTRIBUTE_UI_TYPE_COMBO_BOX: - case ATTRIBUTE_UI_TYPE_CHECKBOX: - { - result.attributeValue = attributeValueLookup.getValueStringFromValueId(attributeType, attributeValueId); - if (result.attributeValue.isEmpty()) - result.attributeValue = m_attributeValueLookupDtc.getValueStringFromValueId(attributeType, attributeValueId); - result.requestResult = DetailData::RequestResult::Okay; - break; - } - - - default: - { - - QString concreteAttributeType = attributeRedirectionLookup.getRedirection(attributeType); - - if (concreteAttributeType == attributeType) - { - ERROR_LOG(m_logger) << "getDetailDataForAttribute: attribute type " << attributeType << " does not have an UiType !!!"; - result.requestResult = DetailData::RequestResult::NoUiTypeForAttribute; - } - else - { - - - - QString attributeType = result.attributeType; - QString attributeTypeId = result.attributeTypeId; - - result = getDetailDataForAttribute(concreteAttributeType, attributeValueJson); - - result.attributeType = attributeType; - result.attributeTypeId = attributeTypeId; - } - - break; - } - } - - return result; -} - - -void DetailData::createRetrieveCurrentTimeCallback(LtsWidgets::LtsDateTimeEdit *dateTimeEdit) -{ - dateTimeEdit->setRetrieveCurrentTimeCallback([this]() { return m_session->partitionTime(); }); -} - - - -DetailData::LookupBase::LookupBase(const QString &lookupClassName) - : m_lookupClassName(lookupClassName) - , m_logger(getLogger(QStringLiteral("DetailData.") + lookupClassName)) -{ - -} - - - -DetailData::EventTypeLookup::EventTypeLookup() - : LookupBase(QStringLiteral("EventTypeLookup")) -{ -} - -void DetailData::EventTypeLookup::addEventType(const int key, const QString &value) -{ - m_eventTypeMap.insert(key, value); -} - -int DetailData::EventTypeLookup::getEventType(const QString &eventText) const -{ - - - const QString paramText = removeSpaces(eventText); - for (auto i = m_eventTypeMap.constBegin(); i != m_eventTypeMap.constEnd(); ++i) - { - const QString mapText = removeSpaces(i.value()); - if (mapText == paramText) - return i.key(); - } - - return -1; -} - -QString DetailData::EventTypeLookup::getEventText(const int eventType) const -{ - return m_eventTypeMap.value(eventType); -} - -bool DetailData::EventTypeLookup::isEventExists(const int eventType) const -{ - return m_eventTypeMap.contains(eventType); -} - -QStringList DetailData::EventTypeLookup::getEventTexts() const -{ - return m_eventTypeMap.values(); -} - - - - -DetailData::AttributeEventLookup::AttributeEventLookup() - : LookupBase(QStringLiteral("AttributeEventLookup")) -{ -} - -void DetailData::AttributeEventLookup::addAttributesToEvent(const int eventType, const AttributeList &attributeTypeList) -{ - AttributeList &al = m_attributeEventLookupMap[eventType]; - al += attributeTypeList; -} - -void DetailData::AttributeEventLookup::addAttributesToEvent(const ProjectDataManagement::PdmEventType &eventType, const AttributeList &attributeTypeList) -{ - addAttributesToEvent(eventType.underlying(), attributeTypeList); -} - -bool DetailData::AttributeEventLookup::isAttributeInEvent(const int eventType, const QString &attributeType) -{ - auto eventTypeIt = m_attributeEventLookupMap.constFind(eventType); - - if (eventTypeIt == m_attributeEventLookupMap.constEnd()) - return false; - - const AttributeList &attributeList = *eventTypeIt; - - if (attributeList.contains(attributeType)) - return true; - - return false; -} - -DetailData::AttributeEventLookup::AttributeList DetailData::AttributeEventLookup::getEventsAttributeList(const int eventType) const -{ - return m_attributeEventLookupMap.value(eventType); -} - - - - -DetailData::AttributeTypeLookup::AttributeTypeLookup() - : LookupBase(QStringLiteral("AttributeTypeLookup")) -{ -} - -void DetailData::AttributeTypeLookup::addAttributeText(const QString &attributeType, const QString &attributeText) -{ - m_attributeTypeLookupMap.insert(attributeType, attributeText); -} - -QString DetailData::AttributeTypeLookup::getAttributeType(const QString &attributeText) const -{ - const QString paramText = removeSpaces(attributeText); - - for (auto i = m_attributeTypeLookupMap.constBegin(); i != m_attributeTypeLookupMap.constEnd(); ++i) - { - const QString mapText = removeSpaces(i.value()); - if (mapText == paramText) - return i.key(); - } - - WARNING_LOG(m_logger) << "getAttributeType: attribute type not found by text '" << attributeText << "'"; - return QString(); -} - -DetailData::AttributeTypeLookup::AttributeTypeList DetailData::AttributeTypeLookup::getAttributeTypes() const -{ - return m_attributeTypeLookupMap.keys(); -} - -QString DetailData::AttributeTypeLookup::getAttributeText(const QString &attributeType, const QString &defaultReturnValue) const -{ - return m_attributeTypeLookupMap.value(attributeType, defaultReturnValue); -} - -DetailData::AttributeTypeLookup::AttributeTextList DetailData::AttributeTypeLookup::getAttributeTexts() const -{ - return m_attributeTypeLookupMap.values(); -} - - - -DetailData::AttributeParameterLookup::AttributeParameterLookup() - : LookupBase(QStringLiteral("AttributeParameterLookup")) -{ -} - -void DetailData::AttributeParameterLookup::addParameter(const QString &attributeType, const ParameterMap ¶meterMap) -{ - if (!parameterMap.count()) - { - WARNING_LOG(m_logger) << "addParameter: parameter map is empty!"; - return; - } - - m_attributeParameterMap.insert(attributeType, parameterMap); -} - -DetailData::AttributeParameterLookup::ParameterMap DetailData::AttributeParameterLookup::getParameterMap(const QString &attributeType) const -{ - return m_attributeParameterMap.value(attributeType); -} - -QVariant DetailData::AttributeParameterLookup::getParameterValue(const QString &attributeType, const int parameterType) const -{ - const ParameterMap &pm = getParameterMap(attributeType); - - auto pmci = pm.constFind(parameterType); - - if (pmci == pm.constEnd()) - return QVariant(); - - return *pmci; -} - - - - -DetailData::AttributeUITypeLookup::AttributeUITypeLookup() - : LookupBase(QStringLiteral("AttributeUITypeLookup")) -{ -} - -void DetailData::AttributeUITypeLookup::addUITypeToAttribute(const QString &attributeType, const int uiType) -{ - m_attributeUITypeLookupMap.insert(attributeType, uiType); -} - -int DetailData::AttributeUITypeLookup::getUIType(const QString &attributeType) const -{ - return m_attributeUITypeLookupMap.value(attributeType, -1); -} - - - -DetailData::AttributeInterpreterLookup::AttributeInterpreterLookup() - : LookupBase(QStringLiteral("AttributeInterpreterLookup")) -{ -} - -void DetailData::AttributeInterpreterLookup::addInterpreterTypeToAttribute(const QString &attributeType, const int interpreterType) -{ - m_attributeInterpreterLookupMap.insert(attributeType, interpreterType); -} - -int DetailData::AttributeInterpreterLookup::getInterpreterType(const QString &attributeType) const -{ - return m_attributeInterpreterLookupMap.value(attributeType); -} - - - - -DetailData::AttributeValueLookup::AttributeValueLookup() - : LookupBase(QStringLiteral("AttributeValueLookup")) -{ -} - - -void DetailData::AttributeValueLookup::removeValueFromAttributeValueMap(const QString &attributeType, const int valueKey) -{ - auto attributeTypeValueMapIt = m_attributeTypeValueMap.find(attributeType); - - if (attributeTypeValueMapIt == m_attributeTypeValueMap.end()) - return; - - AttributeValueMap ¤tAttributeValueMap = *attributeTypeValueMapIt; - currentAttributeValueMap.remove(valueKey); -} - - -void DetailData::AttributeValueLookup::addValueToAttributeValueMap(const QString &attributeType, const int valueKey, const QString &valueValue) -{ - AttributeValueMap &avm = m_attributeTypeValueMap[attributeType]; - avm.insert(valueKey, valueValue); -} - - -void DetailData::AttributeValueLookup::addValuesToAttributeValueMap(const QString &attributeType, const AttributeValueMap &avm) -{ - AttributeValueMap &thisAvm = m_attributeTypeValueMap[attributeType]; - for (auto i = avm.constBegin(); i != avm.constEnd(); ++i) - { - thisAvm.insert(i.key(), i.value()); - } -} - -AttributeValueMap DetailData::AttributeValueLookup::getAttributeValueMap(const QString &attributeType) const -{ - return m_attributeTypeValueMap.value(attributeType); -} - -QString DetailData::AttributeValueLookup::getValueStringFromValueId(const QString &attributeType, const int attributeValueId, const QString& defaultValue) const -{ - return getAttributeValueMap(attributeType).value(attributeValueId, defaultValue); -} - -void DetailData::AttributeValueLookup::clear() -{ - m_attributeTypeValueMap.clear(); -} - - - -DetailData::AttributeRedirectionLookup::AttributeRedirectionLookup() - : LookupBase(QStringLiteral("AttributeRedirectionLookup")) -{ -} - -void DetailData::AttributeRedirectionLookup::addRedirection(const QString &attributeType, const QString &redirectTo) -{ - m_attributeRedirectionMap.insert(attributeType, redirectTo); -} - -QString DetailData::AttributeRedirectionLookup::getRedirection(const QString &attributeType) const -{ - auto it = m_attributeRedirectionMap.find(attributeType); - if (it == m_attributeRedirectionMap.end()) - return attributeType; - return it.value(); -} - - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/detail_data.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/detail_data.h deleted file mode 100755 index 46678a75f..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/detail_data.h +++ /dev/null @@ -1,329 +0,0 @@ - - -#pragma once - -#include "logger.h" - -#include -#include - -#include - -#include -#include -#include - -#include "attribute_value_lookup.h" - -namespace LtsSession -{ -class LtsSession; -} -namespace LtsTimelineClassic -{ -class Event; -} -namespace LtsWidgets -{ -class LtsDateTimeEdit; -} - - -namespace Timeline -{ -constexpr int markerTypeId = 999999; - -class DetailData : public QObject -{ - Q_OBJECT - -public: - enum class RequestResult - { - Error = 0, - Okay = 1, - InvalidAttributeType, - NoValueTranslationForAttribute, - NoUiTypeForAttribute, - InvalidAttributeTypeJson, - JsonCorrupted - }; - - struct GetDetailDataForAttributeResult - { - QString attributeType; - QString attributeValue; - - QString attributeTypeId; - int attributeValueId = 0; - RequestResult requestResult = RequestResult::Error; - }; - - using GetDetailDataResultList = QVector; - - enum AttributeUITypes - { - ATTRIBUTE_UI_TYPE_TIME_RANGE_WIDGET = 0, - ATTRIBUTE_UI_TYPE_DEFAULT_RANGE_WIDGET, - ATTRIBUTE_UI_TYPE_AREA_RANGE_WIDGET, - ATTRIBUTE_UI_TYPE_COMBO_BOX, - ATTRIBUTE_UI_TYPE_CHECKBOX, - ATTRIBUTE_UI_TYPE_RAD_RANGE_WIDGET - }; - - enum UIParameterType - { - UI_PARAM_TYPE_N1, - UI_PARAM_TYPE_N2, - UI_PARAM_TYPE_O1, - UI_PARAM_TYPE_O2, - UI_PARAM_TYPE_RAD, - - UI_PARAM_TYPE_MIN, - UI_PARAM_TYPE_MAX, - UI_PARAM_TYPE_PREFIX, - UI_PARAM_TYPE_SUFFIX - }; - - enum InterpreterTypes - { - INTERPRETER_TYPE_NONE = 0, - - INTERPRETER_TYPE_RANGE, - INTERPRETER_TYPE_AREA, - INTERPRETER_TYPE_ID_COMPARE, - INTERPRETER_TYPE_STR_COMPARE, - INTERPRETER_TYPE_POSITION, - INTERPRETER_TYPE_TIME, - INTERPRETER_TYPE_DURATION, - INTERPRETER_TYPE_RAD - }; - - - explicit DetailData(LtsSession::LtsSession *session, QObject *parent = nullptr); - - void populate(); - GetDetailDataResultList getDetailData(const LtsTimelineClassic::Event *event); - GetDetailDataForAttributeResult getDetailDataForAttribute(const LtsTimelineClassic::Event *event, const QString &attributeType); - void createRetrieveCurrentTimeCallback(LtsWidgets::LtsDateTimeEdit *dateTimeEdit); - LtsSession::LtsSession *session() { return m_session; } - - -private: - - - void addRedirectedAttributeType(const QString &newAttributeTypeId, const QString &attributeText, const QString &redirectToAttributeTypeId); - void addAttributeType(const QString &attributeTypeId, const QString &attributeText, const int uiTypeId = ATTRIBUTE_UI_TYPE_COMBO_BOX, const int interpreterTypeId = INTERPRETER_TYPE_ID_COMPARE); - - void addAttributeTypeWithYesAndNo(const QString &attributeTypeId, const QString &attributeText) - { - addAttributeType(attributeTypeId, attributeText, ATTRIBUTE_UI_TYPE_CHECKBOX); - attributeValueLookup.addValueToAttributeValueMap(attributeTypeId, 0, tr("No")); - attributeValueLookup.addValueToAttributeValueMap(attributeTypeId, 1, tr("Yes")); - } - - template - void addAttributeValue(const QString &attributeTypeId, const AttributeEnumType &attributeEnum) - { - - attributeValueLookup.addValueToAttributeValueMap(attributeTypeId, (int)attributeEnum, toString(attributeEnum)); - } - - void addEventType(int eventTypeId, const QString &eventTypeString); - void addEventType(const ProjectDataManagement::PdmEventType &eventType); - - GetDetailDataForAttributeResult getDetailDataForAttribute(const QString &attributeType, const QJsonValue &attributeValueJson); - - LtsSession::LtsSession *m_session; - bool __already_populated__; -public: - - class LookupBase - { - public: - explicit LookupBase(const QString &lookupClassName); - - protected: - NGL::INGLLogger &m_logger; - QString m_lookupClassName; - }; - - - class EventTypeLookup : public LookupBase - { - public: - using EventTypeMap = QMap; - - EventTypeLookup(); - - void addEventType(const int key, const QString &value); - int getEventType(const QString &eventText) const; - QString getEventText(const int eventType) const; - QStringList getEventTexts() const; - bool isEventExists(const int eventType) const; - - private: - EventTypeMap m_eventTypeMap; - }; - EventTypeLookup eventTypeLookup; - - - class AttributeTypeLookup : public LookupBase - { - public: - using AttributeTypeLookupMap = QMap; - using AttributeTypeList = QList; - using AttributeTextList = QStringList; - - AttributeTypeLookup(); - - void addAttributeText(const QString &attributeType, const QString &attributeText); - QString getAttributeType(const QString &attributeText) const; - AttributeTypeList getAttributeTypes() const; - QString getAttributeText(const QString &attributeType, const QString &defaultReturnValue = QString()) const; - AttributeTextList getAttributeTexts() const; - - private: - AttributeTypeLookupMap m_attributeTypeLookupMap; - }; - AttributeTypeLookup attributeTypeLookup; - - - class AttributeEventLookup : public LookupBase - { - public: - using AttributeEventLookupMap = QMap >; - using AttributeList = QList; - - AttributeEventLookup(); - - void addAttributesToEvent(const int eventType, const AttributeList &attributeTypeList); - void addAttributesToEvent(const ProjectDataManagement::PdmEventType &eventType, const AttributeList &attributeTypeList); - bool isAttributeInEvent(const int eventType, const QString &attributeType); - AttributeList getEventsAttributeList(const int eventType) const; - - private: - AttributeEventLookupMap m_attributeEventLookupMap; - }; - AttributeEventLookup attributeEventLookup; - - - class AttributeParameterLookup : public LookupBase - { - public: - using ParameterMap = QMap; - using AttributeParameterMap = QHash; - - AttributeParameterLookup(); - - void addParameter(const QString &attributeType, const ParameterMap ¶meterMap); - ParameterMap getParameterMap(const QString &attributeType) const; - QVariant getParameterValue(const QString &attributeType, const int parameterType) const; - - private: - AttributeParameterMap m_attributeParameterMap; - }; - AttributeParameterLookup attributeParameterLookup; - - - class AttributeUITypeLookup : public LookupBase - { - public: - using AttributeUITypeLookupMap = QHash; - - AttributeUITypeLookup(); - - void addUITypeToAttribute(const QString &attributeType, const int uiType); - int getUIType(const QString &attributeType) const; - - private: - AttributeUITypeLookupMap m_attributeUITypeLookupMap; - }; - AttributeUITypeLookup attributeUITypeLookup; - - - class AttributeInterpreterLookup : public LookupBase - { - public: - using AttributeInterpreterLookupMap = QHash; - - AttributeInterpreterLookup(); - - void addInterpreterTypeToAttribute(const QString &attributeType, const int interpreterType); - int getInterpreterType(const QString &attributeType) const; - - private: - AttributeInterpreterLookupMap m_attributeInterpreterLookupMap; - }; - AttributeInterpreterLookup attributeInterpreterLookup; - - - class AttributeValueLookup : public LookupBase - { - public: - AttributeValueLookup(); - - void addValueToAttributeValueMap(const QString &attributeType, const int valueKey, const QString &valueValue ); - void removeValueFromAttributeValueMap(const QString &attributeType, const int valueKey); - void addValuesToAttributeValueMap(const QString &attributeType, const AttributeValueMap &avm); - void clear(); - - AttributeValueMap getAttributeValueMap(const QString &attributeType) const; - QString getValueStringFromValueId(const QString &attributeType, const int attributeValueId, const QString &defaultValue = QString()) const; - - private: - AtributeValueLookupMap m_attributeTypeValueMap; - }; - AttributeValueLookup attributeValueLookup; - - class AttributeValueLookupDtc : public LookupBase - { - public: - AttributeValueLookupDtc() : LookupBase(QStringLiteral("AttributeValueLookupDtc")) {} - ~AttributeValueLookupDtc() { qDeleteAll(m_provider); } - - - void addHandlerForDtc(const QString &attributeType, AttributeValueLookupProvider *provider) - { - auto &p = m_provider[attributeType]; - delete p; - p = provider; - } - AttributeValueMap getAttributeValueMap(int eventType, const QString &attributeType) const - { - const auto provider = m_provider.value(attributeType); - if (!provider) - return {}; - return provider->getAttributeValueMap(eventType); - } - QString getValueStringFromValueId(const QString &attributeType, int attributeValueId) const - { - const auto provider = m_provider.value(attributeType); - if (!provider) - return {}; - return provider->getValueStringFromValueId(attributeValueId); - } - private: - QHash m_provider; - }; - AttributeValueLookupDtc m_attributeValueLookupDtc; - AttributeValueMap operatorsForEventType(int eventType) const; - QString operatorNameFromId(int id) const; - - class AttributeRedirectionLookup : public LookupBase - { - public: - using AttributeRedirectionMap = QHash; - - explicit AttributeRedirectionLookup(); - - void addRedirection(const QString &attributeType, const QString &redirectTo); - QString getRedirection(const QString &attributeType) const; - - private: - AttributeRedirectionMap m_attributeRedirectionMap; - }; - AttributeRedirectionLookup attributeRedirectionLookup; -}; - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/excon_filter.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/excon_filter.cpp deleted file mode 100755 index 4dfe92d8e..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/excon_filter.cpp +++ /dev/null @@ -1,200 +0,0 @@ -#include "excon_filter.h" -#include "detail_data.h" -#include "EventFilter/interpreter/FilterWorker.h" -#include "EventFilter/interpreter/FilterEquationFunctions.h" - -#include -#include -#include -#include "logger.h" - -#include - - -namespace Timeline -{ - - -static LtsTimelineClassic::EventList applyFilter(DetailData *detailData, - const LtsTimelineClassic::EventList &eventList, - const ModelFilterList &modelFilterList, - bool simulation) -{ - NGL::INGLLogger &logger(getLogger("ExconFilter")); - - - - - - LtsTimelineClassic::EventList visibleEvents; - - bool resetFilterOnly = false; - - if (!modelFilterList.count()) - { - DEBUG_LOG(logger) << "applyFilter: Model Filter List is EMPTY"; - - if (simulation) - return visibleEvents; - - resetFilterOnly = true; - } - - visibleEvents = eventList; - - - QSet mentionedEventTypes; - mentionedEventTypes.insert(markerTypeId); - - for (const FilterWorker::ModelFilter &mf : modelFilterList) - { - if (mf.active) - mentionedEventTypes.insert(mf.eventType); - } - - - - - bool showAllEvents = false; - - if (mentionedEventTypes.count() == 1 && mentionedEventTypes.contains(0 )) - showAllEvents = true; - - - - for (LtsTimelineClassic::Event *event : eventList) - { - if (!event) - { - WARNING_LOG(logger) << "applyFilter: Erroneous event!"; - continue; - } - - int eventType = event->typeId(); - - - if (resetFilterOnly ) - { - if (!simulation) - event->show(); - - - - continue; - } - - bool eventVisible = true; - - - if (!showAllEvents && !mentionedEventTypes.contains(eventType)) - eventVisible = false; - - if (!eventVisible ) - { - if (!simulation) - event->hide(); - - visibleEvents.removeAll(event); - continue; - } - - const auto eventsAttributeList = detailData->attributeEventLookup.getEventsAttributeList(eventType); - - - for (const QString &attributeType : eventsAttributeList) - { - QString concreteAttributeType = detailData->attributeRedirectionLookup.getRedirection(attributeType); - bool visibleByAttribute = false; - bool attributeTypeMentioned = false; - - - - for (const FilterWorker::ModelFilter &mf : modelFilterList) - { - if (mf.eventType == eventType || mf.eventType == 0 ) - { - if (mf.attributeType == concreteAttributeType && mf.active) - { - attributeTypeMentioned = true; - - DetailData::GetDetailDataForAttributeResult result = detailData->getDetailDataForAttribute(event, attributeType); - if (result.requestResult != DetailData::RequestResult::Okay) - result = detailData->getDetailDataForAttribute(event, concreteAttributeType); - - - - - - - - if (result.requestResult != DetailData::RequestResult::Okay) - { - WARNING_LOG(logger) << "applyFilter: result.requestResult != DetailData::OKAY -" << (int)result.requestResult; - continue; - } - - - visibleByAttribute = FilterEquationFunctions::checkValue(detailData, concreteAttributeType, result.attributeValueId, mf.attributeValue); - - if (visibleByAttribute) - break; - - #ifdef DEBUG - DEBUG_LOG(logger) - << "\r\napplyFilter:\r\n" - << "Evnt Type (" << eventType << ")\r\n" - << "Attr Type (" << attributeType << ")\r\n" - << "Evnt Val (" << result.resultValue << ")\r\n" - << "Fltr Val (" << mf.attributeValue << ")\r\n" - << "Evnt SHOW (" << eventVisible << ")\r\n" - << "Attr SHOW (" << visibleByAttribute << ")\r\n"; - #endif - } - } - } - - - if (attributeTypeMentioned && !visibleByAttribute) - { - eventVisible = false; - break; - } - } - - if (!simulation) - event->setVisible(eventVisible); - - if (!eventVisible) - visibleEvents.removeAll(event); - } - - DEBUG_LOG(logger) << "applyFilter: Visible Events after applying filter:" << visibleEvents.count(); - - return visibleEvents; -} - - -LtsTimelineClassic::EventList setFilter(DetailData *detailData, - const LtsTimelineClassic::EventList &eventListToFilter, - const QJsonArray &filter, - QWidget *parentWidget, - bool simulation, - bool handleResult) -{ - - - - LtsTimelineClassic::EventList visibleEvents; - - FilterWorker::GetModelFilterListResult result = FilterWorker::getModelFilterList(detailData, filter, true ); - ModelFilterList modelFilterList = result.result; - if (handleResult) - FilterWorker::getInstance()->handleResultValues(result.resultValueList, parentWidget); - - visibleEvents = applyFilter(detailData, eventListToFilter, modelFilterList, simulation); - - - return visibleEvents; -} - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/excon_filter.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/excon_filter.h deleted file mode 100755 index ef04e514f..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/excon_filter.h +++ /dev/null @@ -1,22 +0,0 @@ -#pragma once - -#include - -#include - - -class QWidget; - - -namespace Timeline -{ -class DetailData; - -LtsTimelineClassic::EventList setFilter(DetailData *detailData, - const LtsTimelineClassic::EventList &eventListToFilter, - const QJsonArray &filter, - QWidget *parentWidget, - bool simulation = false, - bool handleResult = true); -} - diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/logger.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/logger.cpp deleted file mode 100755 index 74ac1cb2b..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/logger.cpp +++ /dev/null @@ -1,32 +0,0 @@ - - - -#include "logger.h" - -#include - -namespace Timeline -{ - -LOGGER_T getLogger(const char *name) -{ - static const char ns[] = "Plugins.Timeline.Gui."; - std::string loggerName; - const size_t len = strlen(name); - loggerName.reserve(sizeof(ns) + len); - loggerName.append(ns, sizeof(ns) - 1); - loggerName.append(name, len); - - try - { - return NGL::NGLLoggerBootstrap::getNGLRootLogger(). - getNGLLogger(loggerName); - } - catch (const std::exception &ex) - { - fprintf(stderr, "Error retrieving logger: %s", ex.what()); - abort(); - } -} - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/logger.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/logger.h deleted file mode 100755 index 03c309b58..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/logger.h +++ /dev/null @@ -1,17 +0,0 @@ - - - -#pragma once - -#include - -namespace Timeline -{ -using LOGGER_T = NGL::INGLLogger &; - -LOGGER_T getLogger(const char *name); -inline LOGGER_T getLogger(const QString &loggerName) -{ - return getLogger(loggerName.toUtf8().constData()); -} -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_cache_dialog.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_cache_dialog.cpp deleted file mode 100755 index 81bdc5aa4..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_cache_dialog.cpp +++ /dev/null @@ -1,104 +0,0 @@ - - - -#include "tln_cache_dialog.h" -#include "ui_tln_cache_dialog.h" - -#include - -#include - - -namespace Timeline -{ - -TimelineCacheDialog::TimelineCacheDialog(QWidget *parent) - : QDialog(parent) - , m_ui(new Ui::TimelineCacheDialog) -{ - m_ui->setupUi(this); - - connect(m_ui->pbUncache, &QPushButton::clicked, - this, [this]() - { - bool k = false; - int index = m_ui->twCaches->item(m_ui->twCaches->selectionModel()->currentIndex().row(), 0)->text().toInt(&k); - - if (!k) - return; - - emit signalUncache(index); - close(); - }); - - - connect(m_ui->pbDelete, &QPushButton::clicked, - this, [this]() - { - bool k = false; - int index = m_ui->twCaches->item(m_ui->twCaches->selectionModel()->currentIndex().row(), 0)->text().toInt(&k); - - if (!k) - return; - - emit signalDelete(index); - close(); - }); -} - - -TimelineCacheDialog::~TimelineCacheDialog() -{ - delete m_ui; -} - - -void TimelineCacheDialog::addCache(const CacheRange &cr, const QString &indexString) -{ - int rowCount = m_ui->twCaches->rowCount(); - m_ui->twCaches->insertRow(rowCount); - int row = m_ui->twCaches->rowCount() - 1; - int c = 0; - - m_ui->twCaches->setItem(row, c++ , new QTableWidgetItem(indexString)); - - QString hash(QStringLiteral("<%1:%2:%3>").arg(cr.start).arg(cr.end).arg(cr.events.count())); - m_ui->twCaches->setItem(row, c++, new QTableWidgetItem(QString::number(qHash(hash), 16))); - - m_ui->twCaches->setItem(row, c++, new QTableWidgetItem(QStringLiteral("%1 (%2)").arg(QDateTime::fromMSecsSinceEpoch(cr.start).toString()).arg(cr.start))); - m_ui->twCaches->setItem(row, c++, new QTableWidgetItem(QStringLiteral("%1 (%2)").arg(QDateTime::fromMSecsSinceEpoch(cr.end).toString()).arg(cr.end))); - m_ui->twCaches->setItem(row, c++, new QTableWidgetItem(QString::number(cr.events.count()))); -} - - -bool TimelineCacheDialog::init(const QVector> &cachedRanges, const CacheRange &liveCache) -{ - m_ui->twCaches->setRowCount(0); - - int eventCount = 0; - { - int i = 0; - for (auto it = cachedRanges.constBegin(); it != cachedRanges.constEnd(); ++it) - { - const CacheRange &cr = it->second; - - eventCount += cr.events.count(); - addCache(cr, QString::number(i)); - - i++; - } - } - - addCache(liveCache, QStringLiteral("live")); - m_ui->lblEventCount->setText(QString::number(eventCount)); - - - for (int i = 0; i < m_ui->twCaches->columnCount(); i++) - { - m_ui->twCaches->resizeColumnToContents(i); - } - - return true; -} - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_cache_dialog.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_cache_dialog.h deleted file mode 100755 index afc828183..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_cache_dialog.h +++ /dev/null @@ -1,41 +0,0 @@ - - - -#pragma once - -#include "tln_dialog_model.h" - -#include -#include - - -namespace Ui -{ -class TimelineCacheDialog; -} - - -namespace Timeline -{ - -class TimelineCacheDialog : public QDialog -{ - Q_OBJECT - -public: - explicit TimelineCacheDialog(QWidget *parent = nullptr); - ~TimelineCacheDialog(); - - bool init(const QVector > &cachedRanges, const CacheRange &liveCache); - -private: - void addCache(const CacheRange &cache, const QString &indexString); - - Ui::TimelineCacheDialog *m_ui; - -signals: - void signalUncache(int index); - void signalDelete(int index); -}; - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_cache_dialog.ui b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_cache_dialog.ui deleted file mode 100755 index c8759f358..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_cache_dialog.ui +++ /dev/null @@ -1,134 +0,0 @@ - - - TimelineCacheDialog - - - - 0 - 0 - 846 - 500 - - - - Cache View - - - - - - - - Event count: - - - - - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Never uncache events from a stale cache vector ! - - - - - - - - - true - - - QAbstractItemView::SingleSelection - - - QAbstractItemView::SelectRows - - - true - - - 100 - - - - idx - - - - - hash - - - - - start - - - - - end - - - - - event count - - - - - - - - - - uncache selected - - - - - - - delete selected - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_dialog.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_dialog.cpp deleted file mode 100755 index 74138160f..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_dialog.cpp +++ /dev/null @@ -1,1077 +0,0 @@ - - - -#include "tln_dialog.h" -#include "ui_tln_dialog.h" -#include "tln_dialog_model.h" -#include "tln_cache_dialog.h" -#include "tln_show_details.h" -#include "tln_event_list.h" -#include "tln_legend.h" -#include "detail_data.h" -#include "excon_filter.h" -#include "logger.h" -#include "EventFilter/FilterWindow.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -using namespace LtsTimelineClassic; - -namespace Timeline -{ - -TimelineViewDialog::TimelineViewDialog(const QString &menuGroup, const LtsWidgets::ButtonCombination &buttonCombo, bool isMain, QWidget *parent) - : LtsWidgets::LtsDialog(parent, buttonCombo, !isMain) - , m_ui(new Ui::TimelineViewDialog) - , m_menuGroup(menuGroup) - , m_model(new DDSTimelineModel(this)) - , m_detailData(nullptr) - , m_filterWindow(nullptr) - , m_eventListDialog(nullptr) - , m_allEventsListDialog(nullptr) - , m_session(nullptr) - , m_requestHelper(new LtsUtils::RequestHelper(this)) - , m_streamNameMapping(nullptr) - , m_rangeChanged(false) - , m_loadingCount(0) - , m_armed(false) - , m_exerciseStart(0) - , m_legendDialog(nullptr) -{ - m_ui->setupUi(this); - -#ifndef LTS_DEBUG - if (LtsSessionData::LtsSessionData::getInstance()->debugFlagValue(QStringLiteral("Timeline.DebugWidget")) != QVariant(true)) - { - m_ui->debugWidget->hide(); - m_ui->widget->hideDebugWidget(); - } -#endif - - m_buttonBox->connectButton(LtsWidgets::DialogButton::Edit, this, &TimelineViewDialog::slotShowFiltersDialog); - m_buttonBox->connectButton(LtsWidgets::DialogButton::Show, this, &TimelineViewDialog::slotShowLegend); - m_buttonBox->connectButton(LtsWidgets::DialogButton::Import, this, &TimelineViewDialog::slotStartReplaySituation); - - connect(m_ui->pbDebugCreateFakeEvent, &QPushButton::clicked, - this, &TimelineViewDialog::slotDebugCreateFakeEvent); - - LtsUtils::ProjectSettings *ps = LtsUtils::ProjectSettings::getInstance(); - const bool enableListEvents = ps->value(QStringLiteral("tln"), - QStringLiteral("enableListEvents")).toBool(); - - if (enableListEvents) - m_buttonBox->connectButton(LtsWidgets::DialogButton::Load, this, &TimelineViewDialog::loadAllEvents); - - connect(m_ui->widget, &TimelineWidget::signalZoomChanged, - this, [this]() - { - m_model->invalidateTimeline(); - }); - - connect(this, &TimelineViewDialog::signalWaitForReady, - this, &TimelineViewDialog::slotWaitForReady, Qt::QueuedConnection); - - connect(m_ui->widget, &TimelineWidget::signalEventAction, - this, &TimelineViewDialog::showDetailsAction); - - setOnlineHelpFilename(QStringLiteral("Timeline-Application")); -} - - -TimelineViewDialog::~TimelineViewDialog() -{ - if (m_allEventsListDialog) - { - delete m_allEventsListDialog.data(); - m_allEventsListDialog = nullptr; - } - - if (m_eventListDialog) - { - delete m_eventListDialog.data(); - m_eventListDialog = nullptr; - } - - delete m_ui; - delete m_filterWindow; - delete m_legendDialog; - - EventTools::s_inUse = false; -} - - -void TimelineViewDialog::slotDebugCreateFakeEvent() -{ - QFormLayout *fl = new QFormLayout; - - QLineEdit *typeIdWidget = new QLineEdit; - typeIdWidget->setText(QStringLiteral("8")); - fl->addRow(QStringLiteral("typeId"), typeIdWidget); - - QLineEdit *startWidget = new QLineEdit; - startWidget->setText(QStringLiteral("1571141793040")); - fl->addRow(QStringLiteral("start"), startWidget); - - QSpinBox *sb = new QSpinBox; - sb->setMaximum(INT_MAX); - sb->setValue(26); - fl->addRow(QStringLiteral("duration [s]"), sb); - - QTextEdit *te = new QTextEdit; - te->setPlainText(QStringLiteral("{ \"streamName\": \"00003\", \"endTime\": 1571141819620 }")); - fl->addRow(QStringLiteral("detail"), te); - - QPushButton *goBtn = new QPushButton(QStringLiteral("Go")); - connect(goBtn, &QPushButton::clicked, this, [this, typeIdWidget, startWidget, sb, te]() - { - bool k = false; - int typeId = typeIdWidget->text().toInt(&k); - if (!k) - { - new LtsWidgets::LtsMessageDialogNew(this, QStringLiteral("TypeId invalid")); - return; - } - - qint64 start = startWidget->text().toLongLong(&k); - if (!k) - { - new LtsWidgets::LtsMessageDialogNew(this, QStringLiteral("start invalid")); - return; - } - - qint64 end = start + (sb->value() * 1000); - - QJsonParseError error; - const QJsonObject root(QJsonDocument::fromJson(te->toPlainText().toUtf8(), &error).object()); - - if (error.error != QJsonParseError::NoError) - { - new LtsWidgets::LtsMessageDialogNew(this, QStringLiteral("Detail data json invalid: '%1' at offset %2").arg(error.errorString()).arg(error.offset)); - return; - } - - static int uniqueId = 9999999; - Event *e = new Event(uniqueId++, typeId, start, end, -1, -1, 1, { QStringLiteral("none") }, LtsTimelineClassic::Event::drawCustomEventGraphicRect, {}, root, -1); - - showDetails({e}); - }); - - - fl->addRow({}, goBtn); - - QDialog *d = new QDialog(this); - d->setLayout(fl); - d->show(); - d->activateWindow(); -} - - -void TimelineViewDialog::aboutToClose() -{ - if (m_allEventsListDialog) - { - delete m_allEventsListDialog.data(); - m_allEventsListDialog = nullptr; - } - - if (m_eventListDialog) - { - delete m_eventListDialog.data(); - m_eventListDialog = nullptr; - } - - if (m_replayApp != nullptr) - m_replayApp->deleteLater(); -} - - -void TimelineViewDialog::retranslate() -{ - translate(m_ui, tr("Timeline")); - m_detailData->populate(); - m_buttonBox->getButton(LtsWidgets::DialogButton::Edit)->setText(tr("Filters")); - m_buttonBox->getButton(LtsWidgets::DialogButton::Show)->setText(tr("Legend", "Deutsch: Legende (erklärende Ergänzung zu einer Grafik)")); - m_buttonBox->getButton(LtsWidgets::DialogButton::Load)->setText(tr("List events")); - - m_buttonBox->getButton(LtsWidgets::DialogButton::Import)->setText(tr("Start Situation Replay App")); - m_buttonBox->getButton(LtsWidgets::DialogButton::Import)->setToolTip(tr("Replays started from the Show Details dialog will play in the Situation Replay App.")); -} - - -bool TimelineViewDialog::init(const std::shared_ptr &eemForeign, - const std::shared_ptr &mrkDtc, - const std::shared_ptr &exmDtc, - const std::shared_ptr &flmIfc, - const std::shared_ptr &ppmDtc, - const std::shared_ptr &ppmInfoIfc, - const std::shared_ptr &avmIfc, - const std::shared_ptr &mrkIfc, - const std::shared_ptr &srmDataIfc, - const std::shared_ptr &coreDtc, - const std::shared_ptr &pdmDtc, - const std::shared_ptr &ismDtc, - const std::shared_ptr &fltParticipantIfc, - const std::shared_ptr &fltAesIfc, - const std::shared_ptr &fltBuildingComponentIfc, - LtsSession::LtsSession *session, - AudioVideoManagement::StreamNameMapping *streamNameMapping) -{ - if (EventTools::s_inUse) - { - new LtsWidgets::LtsMessageDialogNew(session->baseLayout(), tr("Cannot open timeline as there is already another timeline instance running in the application."), tr("Another timeline instance already in use")); - return false; - } - - EventTools::s_inUse = true; - - m_session = session; - m_exmDtc = exmDtc; - m_flmIfc = flmIfc; - m_ppmDtc = ppmDtc; - m_ppmInfoIfc = ppmInfoIfc; - m_avmIfc = avmIfc; - m_mrkIfc = mrkIfc; - m_srmDataIfc = srmDataIfc; - m_coreDtc = coreDtc; - m_pdmDtc = pdmDtc; - m_ismDtc = ismDtc; - m_mrkDtc = mrkDtc; - m_fltParticipantIfc = fltParticipantIfc; - m_fltAesIfc = fltAesIfc; - m_fltBuildingComponentIfc = fltBuildingComponentIfc; - m_streamNameMapping = streamNameMapping; - - if (m_coreDtc == nullptr || m_srmDataIfc == nullptr) - { - m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Import, false); - m_buttonBox->getButton(LtsWidgets::DialogButton::Import)->setToolTip(tr("Required interfaces missing for starting the Situation Replay App.")); - } - - m_detailData = new DetailData(session, this); - - if (!m_model->init(eemForeign, mrkDtc, exmDtc, ppmDtc, pdmDtc, ismDtc, session, m_detailData, m_streamNameMapping)) - { - ERROR_LOG(m_logger) << "model init failed"; - return false; - } - - m_ui->widget->setTimelineModel(m_model); - - - connect(m_model, &DDSTimelineModel::signalRebuildTimelineKnownRanges, - this, [this]() - { - m_ui->widget->knownRangesChanged(m_model->getKnownRanges()); - - emit m_model->dataChanged(QModelIndex(), QModelIndex()); - }); - - connect(m_model, &DDSTimelineModel::signalLoading, - this, &TimelineViewDialog::slotLoading); - connect(m_model, &DDSTimelineModel::signalLoadingDone, - this, &TimelineViewDialog::slotLoadingDone); - - connect(this, &TimelineViewDialog::signalInitEventList, - this, [this]() - { - if (m_allEventsListDialog) - { - - EventList visibleEvents = setFilter(m_detailData, m_model->getRootItem()->getFullEventList(true, true), m_filter, this, true, false); - m_allEventsListDialog->reInitEventList(visibleEvents, m_ui->widget->getRangeMinimum(), m_ui->widget->getRangeMaximum()); - } - }); - - - QTimer *armTimer = new QTimer(this); - armTimer->setInterval(750); - connect(armTimer, &QTimer::timeout, - this, [this]() - { - if (!m_rangeChanged) - return; - m_rangeChanged = false; - - qint64 rangeMin = m_ui->widget->getRangeMinimum(); - qint64 rangeMax = m_ui->widget->getRangeMaximum(); - - if (rangeMin > rangeMax) - return; - - qint64 now = m_session->partitionTime(); - - if (rangeMin >= now) - return; - - if (rangeMax >= now) - { - rangeMax = m_session->partitionTime() -1; - - } - - - m_model->getEvents(rangeMin, rangeMax); - }); - -#ifndef LTS_DEBUG - m_armed = true; - armTimer->start(); -#endif - - -#ifndef LTS_DEBUG - if (LtsSessionData::LtsSessionData::getInstance()->debugFlagValue(QStringLiteral("Timeline.DebugWidget")) == QVariant(true)) -#endif - { - - QTimer *tCursor = new QTimer(this); - tCursor->setInterval(500); - connect(tCursor, &QTimer::timeout, - this, [this]() - { - qint64 cursorTime = EventTools::getEventTime(m_ui->widget->mapFromGlobal(QCursor::pos()).x()); - m_ui->lblCursorTime->setText(QStringLiteral("%1 (%2)").arg(QDateTime::fromMSecsSinceEpoch(cursorTime).toString()).arg(cursorTime)); - }); - tCursor->start(); - - - - QTimer *tDraws = new QTimer(this); - tDraws->setInterval(1000); - connect(tDraws, &QTimer::timeout, - this, [this]() - { - int paints = EventTools::s_test; - EventTools::s_test = 0; - m_ui->label_8->setText(QStringLiteral("%1 draw(s) per second").arg(paints)); - }); - tDraws->start(); - - - - connect(m_ui->cbFake, &QCheckBox::toggled, - this, [this](bool toggled) - { - qWarning() << "fake toggled? " << toggled; - m_model->setCreateFakeEvents(toggled); - }); - - - - connect(m_ui->widget, &TimelineWidget::signalArm, - this, [this, armTimer](bool arm) - { - m_armed = arm; - if (arm) - armTimer->start(); - else - armTimer->stop(); - }); - - - - connect(m_ui->pbShowCache, &QPushButton::clicked, - this, [this]() - { - TimelineCacheDialog *cacheDialog = new TimelineCacheDialog(this); - - connect(cacheDialog, &TimelineCacheDialog::signalUncache, - this, [this](int ) - { - - - WARNING_LOG(m_logger) << "reimpl me!!"; - }); - - cacheDialog->setAttribute(Qt::WA_DeleteOnClose, true); - cacheDialog->init(m_model->cachedEvents(), m_model->liveCache()); - cacheDialog->show(); - }); - - - - - - - - - } - - - - - connect(m_ui->widget, &TimelineWidget::signalRangeChanged, - this, [this, armTimer]() - { - - - if (!m_model->hasActiveEventTypes()) - { - DEBUG_LOG(m_logger) << "range changed, but no active event types! not arming timer.."; - return; - } - - if (m_armed) - armTimer->start(); - - m_rangeChanged = true; - }); - - - - connect(m_session, &LtsSession::LtsSession::partitionTimeChanged, - this, [this](qint64 ) - { -#ifdef LTS_DEBUG - if (m_ui->cbUpdate->isChecked()) -#endif - updateRange(); - }); - - - - updateRange(); - m_ui->widget->setPos(m_session->partitionTime()); - - connect(m_ui->sbSpan, &QScrollBar::valueChanged, - this, &TimelineViewDialog::slotSpanChanged); - - connect(m_ui->pbLive, &QPushButton::clicked, - this, [this]() - { - updateRange(true ); - }); - - m_exerciseStart = m_exmDtc->exercise(m_session->exerciseId()).beginTime(); - - if (m_exerciseStart < 1) - { - LtsWidgets::LtsMessageDialog::showMessage(m_session->baseLayout(), tr("Exercise data not available or exercise not started yet."), tr("Cannot open timeline")); - ERROR_LOG(m_logger) << "exercise data not available - exercise start: " << m_exerciseStart; - return false; - } - - { - - QSignalBlocker block(m_ui->sbSpan); - (void)block; - updateRange(true ); - } - - m_ui->widget->setMaxPos(); - - - - m_ui->widget->setEnabled(false); - m_ui->sbSpan->setEnabled(false); - m_ui->pbLive->setEnabled(false); - - - LtsWidgets::LtsGlobalWaitDialog::getInstance()->wait(); - emit signalWaitForReady(); - - return true; -} - - -void TimelineViewDialog::slotSpanChanged() -{ - qint64 end = currentSpanTime(); - qint64 start = end - (8 * 60 * 60 * 1000); - m_model->setTimeRange(start, end); - - m_ui->lbStartTime->setText(DTG::toStringMSec(start)); - m_ui->lbEndTime->setText(DTG::toStringMSec(end)); - - bool live = (m_ui->sbSpan->value() == m_ui->sbSpan->maximum()); - - m_model->setLive(live); - m_ui->widget->slotUpdateTimeline(); -} - - -void TimelineViewDialog::slotLoading() -{ -#ifdef LTS_DEBUG - m_ui->lblStartTime->setStyleSheet(QLatin1String("background-color: green;")); - m_ui->lblEndTime->setStyleSheet(QLatin1String("background-color: green;")); -#endif - m_loadingCount++; - -} - - -void TimelineViewDialog::slotLoadingDone() -{ - if (m_loadingCount > 0) - m_loadingCount--; -#ifdef LTS_DEBUG - if (m_loadingCount == 0) - { - m_ui->lblStartTime->setStyleSheet(QString()); - m_ui->lblEndTime->setStyleSheet(QString()); - } -#endif - - - - emit signalInitEventList(); -} - - -qint64 TimelineViewDialog::currentSpanTime() const -{ - qint64 value = m_ui->sbSpan->value(); - value *= 1000; - - return value; -} - - -void TimelineViewDialog::updateRange(bool initial) -{ - qint64 start = m_exerciseStart; - qint64 partitionTime = m_session->partitionTime(); - qint64 now = partitionTime; - - if (now < 1) - now = start; - if (now == 0) - return; - - now = (now / 1000); - - bool liveSpan = (m_ui->sbSpan->value() == m_ui->sbSpan->maximum()); - - m_ui->sbSpan->setMinimum(start / 1000); - m_ui->sbSpan->setMaximum(now); - - if (initial || liveSpan) - { - QSignalBlocker block(m_ui->sbSpan); - (void)block; - m_ui->sbSpan->setValue(now); - } - - m_ui->widget->setLiveTime(partitionTime); - slotSpanChanged(); - - - bool liveRange = (m_ui->widget->getPos() >= m_ui->widget->getMaxPos() - 1); - - - - if (initial || liveRange) - { - - m_ui->widget->setPos(EventTools::getTimelineMax()); - } -} - - -void TimelineViewDialog::slotStartReplaySituation() -{ - if (m_replayApp != nullptr) - return; - - m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Import, false); - - if (m_requestHelper->startSingleRequest([&]() - { - - return m_srmDataIfc->replayPartitionCreateRequest(m_session->exerciseId(), - LtsSessionData::LtsSessionData::getInstance()->getWorkstationId(), - LtsSessionData::LtsSessionData::getInstance()->getOperatorId(), - Core::ReplayType::SituationData, - this); - })) - { - Core::ReplayPartition rp; - for (int i = 0; i < 50; i++) - { - - - - rp = m_coreDtc->replayPartition(m_requestHelper->getRepliedId()); - - if (rp.id() > 0) - break; - } - - if (rp.id() == 0) - { - LtsWidgets::LtsMessageDialog::showMessage(this, tr("Error trying to create a replay session in stage 1.")); - WARNING_LOG(m_logger) << "[timeout] Error while trying to create a replay session: domainId: " << m_session->domainId() << - " - replay partition does not exist - replay id: " << m_requestHelper->getRepliedId() << - " - url " << m_session->tcpConnectionUrl().toString(); - m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Import, true); - return; - } - else - { - LtsSession::DdsConnectionParams connParams(rp); - m_replayApp = LtsAppManager::LtsAppManager::getInstance()->createApp(LtsAppDescriptor::App::Situation, connParams); - - if (m_replayApp == nullptr) - { - LtsWidgets::LtsMessageDialog::showMessage(this, tr("Error trying to create a replay session in stage 2.")); - WARNING_LOG(m_logger) << "Error while trying to create a replay session: domainId: " << m_session->domainId() << - " - partition create reply (failed) - replay id: " << m_requestHelper->getRepliedId() << - " - url: " << m_session->tcpConnectionUrl().toString(); - m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Import, true); - return; - } - else - { - connect(m_replayApp->m_sessionManager, &LtsSession::LtsSessionManager::signalInitializationFinished, - this, [this, rp]() - { - LtsSession::LtsSession *replayAppSession = m_replayApp->m_sessionManager->getSession(IDL::PartitionType::Replay, rp.id()); - - if (replayAppSession == nullptr) - { - LtsWidgets::LtsMessageDialog::showMessage(this, tr("Error trying to create a replay session in stage 4.")); - return; - } - - m_replayAppSession = replayAppSession; - - - - - - - - - - - - - - - - connect(m_replayApp.data(), &LtsPluginManager::LtsPluginManager::destroyed, - this, [this]() - { - - - m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Import, true); - }); - }); - - LtsSession::LtsSession *replayAppSession = m_replayApp->m_sessionManager->getSession(IDL::PartitionType::Replay, rp.id()); - - - auto fn = [this, replayAppSession]() - { - LtsWidgets::LtsMessageDialog::showMessage(this, tr("Error trying to create a replay session in stage 3.")); - m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Import, true); - return; - }; - - if (replayAppSession->isInitializationDone()) - fn(); - else - connect(replayAppSession, &LtsSession::LtsSession::signalDoneInitializingSession, - this, fn); - } - } - } - else - { - LtsWidgets::LtsMessageDialog::showMessage(this, tr("Error trying to create a replay session.")); - m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Import, true); - } -} - - -void TimelineViewDialog::slotEventTypesChanged(QSet activeEventTypeIds) -{ - if (m_filterWindow != nullptr && m_filterWindow->hasUnsavedChanges()) - { - new LtsWidgets::LtsMessageDialogNew(this, tr("You have unsaved filters in Timeline's Filter dialog. Please save or discard them before you add or remove active events in Timeline's Legend dialog."), tr("Unsaved filters")); - return; - } - - if (m_model->activeEventTypeIds().contains(markerTypeId)) - activeEventTypeIds.insert(markerTypeId); - - if (m_legendDialog != nullptr) - m_legendDialog->__unchange__(); - - setTimelineUsable(!activeEventTypeIds.isEmpty()); - - QSet newActiveEventTypesIds(activeEventTypeIds - m_model->activeEventTypeIds()); - - - m_model->setActiveEventTypeIds(activeEventTypeIds); - updateFiltersByActiveEventTypes(); - - if (!newActiveEventTypesIds.isEmpty()) - m_model->getAllEventsOfType(newActiveEventTypesIds); -} - - -void TimelineViewDialog::slotShowLegend() -{ - QString timelineLegendDialogIdent(QStringLiteral("Timeline.Legend")); - auto layoutArea = LtsWidgets::LayoutArea::eInfoTab; - - if (m_legendDialog != nullptr) - { - focusDialog(m_menuGroup, timelineLegendDialogIdent, layoutArea); - return; - } - - m_legendDialog = new TimelineLegendDialog; - - connect(m_legendDialog, &TimelineLegendDialog::destroyed, - this, [this]() - { - if (static_cast(sender()) == m_legendDialog) - m_legendDialog = nullptr; - }); - - connect(m_legendDialog, &TimelineLegendDialog::signalEventTypesChanged, - this, &TimelineViewDialog::slotEventTypesChanged); - - if (!m_legendDialog->init(m_model, m_model->activeEventTypeIds())) - { - m_legendDialog->deleteLater(); - m_legendDialog = nullptr; - return; - } - - m_session->addWidget(m_legendDialog, m_menuGroup, timelineLegendDialogIdent, layoutArea); -} - - -void TimelineViewDialog::slotShowFiltersDialog() -{ - if (m_detailData == nullptr) - return; - - if (m_filterWindow != nullptr) - { - focusDialog(m_menuGroup, QStringLiteral("timelineFilterDialog"), LtsWidgets::LayoutArea::eDialogTab); - return; - } - - m_filterWindow = new FilterWindow(m_detailData, m_flmIfc, m_session, this); - - connect(m_filterWindow, &FilterWindow::signalShowEvents, - this, &TimelineViewDialog::slotShowEvents); - - connect(m_filterWindow, &FilterWindow::signalApplyFilter, - this, &TimelineViewDialog::slotApplyFilter); - - connect(m_filterWindow, &FilterWindow::destroyed, - this, [this]() - { - if (sender() == static_cast(m_filterWindow)) - m_filterWindow = nullptr; - }); - - m_filterWindow->loadFilters(m_filter); - - addDialog(m_filterWindow, m_menuGroup, QStringLiteral("timelineFilterDialog")); -} - - -void TimelineViewDialog::slotShowEvents(const QJsonArray &filter) -{ - EventList visibleEvents = setFilter(m_detailData, m_model->getRootItem()->getFullEventList(true, true), filter, this, true , false ); - if (visibleEvents.isEmpty()) - { - LtsWidgets::LtsMessageDialog::showMessage(this, tr("This filter has no results"), tr("No Events found")); - return; - } - - showDetails(visibleEvents); -} - -void TimelineViewDialog::loadAllEvents() -{ - LtsTimelineClassic::EventList visibleEvents = setFilter(m_detailData, m_model->getRootItem()->getFullEventList(true, true), m_filter, this, true , false ); - - qint64 endTime = m_ui->widget->getRangeMaximum(); - qint64 startTime = m_ui->widget->getRangeMinimum(); - LtsTimelineClassic::EventList newEventList; - - for (auto i = visibleEvents.constBegin(); i != visibleEvents.constEnd(); ++i) - { - LtsTimelineClassic::Event *e = (*i); - - if (e->startTime() >= startTime && (e->startTime() + e->duration()) <= endTime) - newEventList += e; - } - - if (newEventList.isEmpty()) - { - LtsWidgets::LtsMessageDialog::showMessage(this, tr("This filter has no results"), tr("No Events found")); - return; - } - - if (newEventList.isEmpty()) - { - LtsWidgets::LtsMessageDialog::showMessage(this, tr("No Events to show")); - return; - } - - if (m_allEventsListDialog == nullptr) - { - m_allEventsListDialog = new EventListDialog(m_menuGroup, m_session, m_ppmDtc, m_pdmDtc, m_ismDtc, m_flmIfc, false ); - connect(m_allEventsListDialog.data(), &EventListDialog::signalShowEventDetails, - this, &TimelineViewDialog::slotShowEventDetails); - - if (!m_allEventsListDialog->init(m_detailData, newEventList, true)) - { - m_allEventsListDialog->deleteLater(); - m_allEventsListDialog = nullptr; - return; - } - addDialog(m_allEventsListDialog, m_menuGroup, QStringLiteral("allEventsListDialog"), LtsWidgets::LayoutArea::eDialogTab); - } - else - { - m_allEventsListDialog->clearModel(); - m_allEventsListDialog->appendEventList(newEventList); - focusDialog(m_menuGroup, QStringLiteral("allEventsListDialog"), LtsWidgets::LayoutArea::eDialogTab); - } - -} - -void TimelineViewDialog::setTimelineUsable(bool usable) -{ - m_ui->widget->setEnabled(usable); - m_ui->sbSpan->setEnabled(usable); - m_ui->pbLive->setEnabled(usable); - - m_ui->lblNoEventsSelected->setVisible(!usable); -} - - -void TimelineViewDialog::updateActiveEventTypesByFilters() -{ - QSet activeEventTypes; - - for (auto i1 = m_filter.constBegin(); i1 != m_filter.constEnd(); ++i1) - { - const QJsonObject &filter = (*i1).toObject(); - - QString eventTypeString = filter[QStringLiteral("EventType")].toString(); - bool k = false; - int eventType = eventTypeString.toInt(&k); - - if (!k || eventType < 0 || !filter[QStringLiteral("Active")].toBool(false)) - continue; - - activeEventTypes.insert(eventType); - } - - m_model->setActiveEventTypeIds(activeEventTypes); - - setTimelineUsable(!activeEventTypes.isEmpty()); - - if (m_legendDialog != nullptr) - m_legendDialog->setActiveEventTypeIds(activeEventTypes); -} - - -void TimelineViewDialog::updateFiltersByActiveEventTypes() -{ - const QSet &activeEventTypes = m_model->activeEventTypeIds(); - QVector filterEventTypes; - - - for (QJsonValueRef filter : m_filter) - { - QJsonObject filterObj = filter.toObject(); - - QString eventTypeString = filterObj[QStringLiteral("EventType")].toString(); - bool k = false; - int eventType = eventTypeString.toInt(&k); - - if (!k || eventType < 0) - continue; - - if (!filterEventTypes.contains(eventType)) - filterEventTypes.append(eventType); - - bool active = filterObj[QStringLiteral("Active")].toBool(false); - - if (active && !activeEventTypes.contains(eventType)) - active = false; - else if (!active && activeEventTypes.contains(eventType)) - active = true; - - filterObj[QStringLiteral("Active")] = active; - filter = filterObj; - } - - - - for (int eventType : activeEventTypes) - { - if (!filterEventTypes.contains(eventType)) - { - QJsonObject filter; - - filter[QStringLiteral("EventType")] = QString::number(eventType); - filter[QStringLiteral("Active")] = true; - - m_filter.append(filter); - } - } - - applyFilter(m_filter, false , true); -} - - -void TimelineViewDialog::applyFilter(const QJsonArray &filter, bool doUpdateActiveEventTypes, bool reloadFilterWindow) -{ - m_filter = filter; - setFilter(m_detailData, m_model->getRootItem()->getFullEventList(true, true), filter, this); - m_model->applyFilter(filter); - - if (doUpdateActiveEventTypes) - updateActiveEventTypesByFilters(); - - if (reloadFilterWindow && m_filterWindow != nullptr) - m_filterWindow->loadFilters(filter); -} - - -void TimelineViewDialog::slotApplyFilter(const QJsonArray &filter) -{ - applyFilter(filter, true , false ); -} - - -void TimelineViewDialog::slotWaitForReady() -{ - - ExerciseManagement::Exercise ex = m_exmDtc->exercise(m_session->partitionId()); - if (ex.id() > 0) - { - qint64 partitionTime = 0; - - partitionTime = m_session->partitionTime(); - - if (partitionTime < 1) - { - emit signalWaitForReady(); - return; - } - - if (partitionTime < ex.beginTime()) - { - LtsWidgets::LtsMessageDialog::showMessage(this, tr("The current time is outside of the Exercise's period.
Events are only recorded in Exercise period boundaries."), tr("No Events available")); - WARNING_LOG(m_logger) << "Partition time was " << partitionTime << ", exercise begin time: " << ex.beginTime(); - } - } - else - { - WARNING_LOG(m_logger) << "TimelineViewDialog::init: could not check exercise's boundaries!"; - } - - LtsWidgets::LtsGlobalWaitDialog::getInstance()->done(); -} - - -void TimelineViewDialog::slotShowEventDetails(const Event *event) -{ - switch (event->typeId()) - { - case ProjectDataManagement::PdmEventType::BiteMessage: - { - m_ppmInfoIfc->showBiteWindow(event->detailData()); - break; - } - - default: - { - addDialog(LtsWidgets::initDialog(new ShowDetailsDialog(), - m_detailData, event, - m_session, - m_replayAppSession, m_avmIfc, m_mrkIfc, m_fltParticipantIfc, m_fltAesIfc, m_fltBuildingComponentIfc, - m_session->app() == LtsAppDescriptor::App::Timeline, - this, m_streamNameMapping), - m_menuGroup, QStringLiteral("ShowEventDetails%1").arg(event->uniqueId()), LtsWidgets::LayoutArea::eInfoTab); - - break; - } - } -} - - -void TimelineViewDialog::showDetails(const EventList &eventList) -{ - if (eventList.isEmpty()) - { - LtsWidgets::LtsMessageDialog::showMessage(this, tr("No Events to show")); - return; - } - - if (eventList.count() > 1) - { - if (m_eventListDialog == nullptr) - { - m_eventListDialog = new EventListDialog(m_menuGroup, m_session, m_ppmDtc, m_pdmDtc, m_ismDtc, m_flmIfc, true ); - connect(m_eventListDialog.data(), &EventListDialog::signalShowEventDetails, - this, &TimelineViewDialog::slotShowEventDetails); - - if (!m_eventListDialog->init(m_detailData, eventList, false)) - { - m_eventListDialog->deleteLater(); - m_eventListDialog = nullptr; - return; - } - - addDialog(m_eventListDialog, m_menuGroup, QStringLiteral("eventListDialog"), LtsWidgets::LayoutArea::eDialogTab); - } - else - { - m_eventListDialog->appendEventList(eventList); - focusDialog(m_menuGroup, QStringLiteral("eventListDialog"), LtsWidgets::LayoutArea::eDialogTab); - } - - } - else - { - slotShowEventDetails(eventList.at(0)); - } -} - - -void TimelineViewDialog::showDetailsAction(EventGraphic *eg, int action) -{ - if (action != EventGraphic::ACTION_LEFT_CLICKED) - return; - - showDetails(eg->eventList()); -} - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_dialog.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_dialog.h deleted file mode 100755 index 98cce949f..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_dialog.h +++ /dev/null @@ -1,167 +0,0 @@ - - - -#pragma once - -#include "tln_view_gui_plugin.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#include - -#include - - -namespace AudioVideoManagement -{ -class StreamNameMapping; -} - -namespace LtsTimelineClassic -{ -class EventGraphic; -class Event; -} - -namespace Ui -{ -class TimelineViewDialog; -} - -namespace LtsSession -{ -class LtsSession; -} - -namespace LtsPluginManager -{ -class LtsPluginManager; -} - - -namespace Timeline -{ - -class FilterWindow; -class DetailData; -class DDSTimelineModel; -class EventListDialog; -class TimelineLegendDialog; - - -class TimelineViewDialog : public LtsWidgets::LtsDialog - , protected SituationReplayManagement::Interface::Ftc::ReplayPartitionCreateReplyHandler -{ - Q_OBJECT - -public: - explicit TimelineViewDialog(const QString &menuGroup, const LtsWidgets::ButtonCombination &buttonCombo, bool isMain, QWidget *parent = nullptr); - ~TimelineViewDialog(); - - bool init(const std::shared_ptr &eemForeign, - const std::shared_ptr &mrkDtc, - const std::shared_ptr &exmDtc, - const std::shared_ptr &flmIfc, - const std::shared_ptr &ppmDtc, - const std::shared_ptr &ppmInfoIfc, - const std::shared_ptr &avmIfc, - const std::shared_ptr &mrkIfc, - const std::shared_ptr &srmDataIfc, - const std::shared_ptr &coreDtc, - const std::shared_ptr &pdmDtc, - const std::shared_ptr &ismDtc, - const std::shared_ptr &fltParticipantIfc, - const std::shared_ptr &fltAesIfc, - const std::shared_ptr &fltBuildingComponentIfc, - LtsSession::LtsSession *session, - AudioVideoManagement::StreamNameMapping *streamNameMapping); - -private slots: - void showDetailsAction(LtsTimelineClassic::EventGraphic *eg, int action); - void showDetails(const LtsTimelineClassic::EventList &eventList); - void slotApplyFilter(const QJsonArray &filter); - void slotShowEventDetails(const LtsTimelineClassic::Event *event); - void slotShowEvents(const QJsonArray &filter); - void slotWaitForReady(); - void slotShowFiltersDialog(); - void slotShowLegend(); - void slotStartReplaySituation(); - void updateRange(bool initial = false); - void slotLoading(); - void slotLoadingDone(); - void slotSpanChanged(); - void slotEventTypesChanged(QSet activeEventTypeIds); - void loadAllEvents(); - void slotDebugCreateFakeEvent(); - -signals: - void signalWaitForReady(); - void signalInitEventList(); - -private: - -NGL::INGLLogger &m_logger; - void retranslate() override; - void onReplayPartitionCreateReply(const Core::FunctionReplyObject &reply) override { m_requestHelper->requestReply(reply); } - qint64 currentSpanTime() const; - - - std::shared_ptr m_coreDtc; - std::shared_ptr m_exmDtc; - std::shared_ptr m_pdmDtc; - std::shared_ptr m_ismDtc; - std::shared_ptr m_mrkDtc; - std::shared_ptr m_ppmDtc; - - - std::shared_ptr m_flmIfc; - std::shared_ptr m_ppmInfoIfc; - std::shared_ptr m_avmIfc; - std::shared_ptr m_mrkIfc; - std::shared_ptr m_srmDataIfc; - std::shared_ptr m_fltParticipantIfc; - std::shared_ptr m_fltAesIfc; - std::shared_ptr m_fltBuildingComponentIfc; - - Ui::TimelineViewDialog *m_ui; - QString m_menuGroup; - DDSTimelineModel *m_model; - DetailData *m_detailData; - FilterWindow *m_filterWindow; - QPointer m_eventListDialog; - QPointer m_allEventsListDialog; - LtsSession::LtsSession *m_session; - LtsUtils::RequestHelper *m_requestHelper; - QPointer m_replayApp; - QPointer m_replayAppSession; - AudioVideoManagement::StreamNameMapping *m_streamNameMapping; - bool m_rangeChanged; - QJsonArray m_filter; - int m_loadingCount; - bool m_armed; - qint64 m_exerciseStart; - TimelineLegendDialog *m_legendDialog; - QTimer *m_armTimer; - void setCustomSpan(); - void calculateAndSetRange(); - void setRange(qint64 min, qint64 max); - void updateActiveEventTypesByFilters(); - void updateFiltersByActiveEventTypes(); - void applyFilter(const QJsonArray &filter, bool doUpdateActiveEventTypes = true, bool reloadFilterWindow = false); - void rangeChanged(); - void setTimelineUsable(bool usable = true); - void aboutToClose() override; -}; - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_dialog.ui b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_dialog.ui deleted file mode 100755 index 1303ae5ff..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_dialog.ui +++ /dev/null @@ -1,215 +0,0 @@ - - - TimelineViewDialog - - - - 0 - 0 - 1401 - 519 - - - - Timeline View - - - - - - - - Time span: - - - - - - - - 0 - 0 - - - - Live - - - - - - - Qt::Vertical - - - - - - - Start: - - - - - - - - - - - - - - - - 0 - 0 - - - - 0 - - - 3600 - - - 3600 - - - true - - - Qt::Horizontal - - - - - - - End: - - - - - - - - - - - - - - - Qt::Vertical - - - - - - - <html><head/><body><p><span style=" color:#ff5656;">Please create at least one filter of any event type to see events.</span></p></body></html> - - - - - - - - - - 0 - 0 - - - - - - - - - - - - - - - - - - - - - - 0 - 0 - - - - Cursor at - - - - - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - [fake] - - - - - - - [update] - - - - - - - [show cache] - - - - - - - [create fake event] - - - - - - - - - - - - - LtsTimelineClassic::TimelineWidget - QWidget -
LtsTimelineClassic/TimelineWidget.h
- 1 -
-
- - -
diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_dialog_model.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_dialog_model.cpp deleted file mode 100755 index b6092aade..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_dialog_model.cpp +++ /dev/null @@ -1,1712 +0,0 @@ - - - -#include "excon_filter.h" -#include -#include "tln_dialog_model.h" -#include "detail_data.h" -#include "logger.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -using namespace LtsTimelineClassic; - - -namespace Timeline -{ - -DDSTimelineModel::DDSTimelineModel(QObject *parent) - : LtsTimelineClassic::AbstractTimelineModel(parent) - , m_session(nullptr) - , m_startTime(-1) - , m_endTime(-1) - , m_detailData(nullptr) - , m_streamNameMapping(nullptr) - , m_isLive(false) - , m_cacheSize(15000) - , m_maxCacheRanges(20) - , m_eventCount(0) - , m_lastCachedEventsId(0) - , m_createFakeEvents(false) -{ - m_liveCache.visible = false; - m_liveCache.start = 0; - m_liveCache.end = 0; - m_liveCache.incomplete = false; -} - - -DDSTimelineModel::~DDSTimelineModel() -{ - - - - - - - - - - - - - - - - - - - -} - - -bool DDSTimelineModel::init(const std::shared_ptr &eemForeign, - const std::shared_ptr &mrkDtc, - const std::shared_ptr &exmDtc, - const std::shared_ptr &ppmDtc, - const std::shared_ptr &pdmDtc, - const std::shared_ptr &ismDtc, - LtsSession::LtsSession *session, - DetailData *detailData, - AudioVideoManagement::StreamNameMapping *streamNameMapping) -{ - - m_eemForeign = eemForeign; - m_dtcExm = exmDtc; - m_ppmDtc = ppmDtc; - m_pdmDtc = pdmDtc; - m_ismDtc = ismDtc; - m_mrkDtc = mrkDtc; - m_session = session; - m_detailData = detailData; - m_streamNameMapping = streamNameMapping; - - connect(m_eemForeign.get(), &TimeLineManagement::ForeignDataInterface::liveEvent, - this, &DDSTimelineModel::slotAddLiveEvent); - -#ifndef LTS_DEBUG - if (LtsSessionData::LtsSessionData::getInstance()->debugFlagValue(QStringLiteral("Timeline.DebugWidget")) != QVariant(true)) -#endif - { - - QTimer *liveTimer = new QTimer(this); - liveTimer->setInterval(4000); - connect(liveTimer, &QTimer::timeout, - this, [this]() - { - if (m_createFakeEvents && m_isLive) - slotAddLiveEventsFake(); - }); - - liveTimer->start(); - } - - connect(m_mrkDtc.get(), &MarkerManagement::Interface::Dtc::markerChanged, - this, &DDSTimelineModel::slotMarkerChanged); - - - auto cb = [this](const MarkerManagement::Marker &marker) - { - addMarkerManagementMarker(marker); - }; - m_mrkDtc->markers(cb); - - return true; -} - - -static int testLiveEventId = 0; -void DDSTimelineModel::slotAddLiveEventsFake() -{ - ExerciseEventManagement::Event event; - - event.id(testLiveEventId++); - event.eventTypeId(ProjectDataManagement::PdmEventType::Hit); - event.sampleTime(currentTime()); - event.properties(QStringLiteral("{}").toStdString()); - - slotAddLiveEvent(event); -} - - -void DDSTimelineModel::saveAndClearLiveCache() -{ - addCacheRange(m_liveCache, m_liveCache.events, false , false ); - m_liveCache.events.clear(); - m_liveCache.start = 0; - m_liveCache.end = 0; -} - - -void DDSTimelineModel::setActiveEventTypeIds(const QSet &activeEventTypeIds) -{ - m_activeEventTypeIds = activeEventTypeIds; -} - - -void DDSTimelineModel::slotAddLiveEvent(const ExerciseEventManagement::Event &event) -{ - Event *ev = getEvent(event.id()); - - if (ev != nullptr) - { - QJsonObject root(getDetailData(event)); - ev->setEndT(root[QStringLiteral("endTime")].toDouble()); - ev->setDetailData(root); - DEBUG_LOG(m_logger) << "live event not added - already exists - modified instead - end"; - - return; - } - - if (!isLive()) - { - DEBUG_LOG(m_logger) << "not adding live event because we're not live"; - return; - } - - - - int eventType = static_cast(event.eventTypeId().underlying()); - if (!m_activeEventTypeIds.contains(eventType)) - { - DEBUG_LOG(m_logger) << "live event not added - event type ("< m_cacheSize) - { - DEBUG_LOG(m_logger) << "more than " << m_cacheSize << " live events - archiving and clearing"; - saveAndClearLiveCache(); - } - - qint64 start = m_liveCache.start; - qint64 end = m_liveCache.end; - qint64 eventTime = event.sampleTime(); - - if (start > eventTime || start == 0) - m_liveCache.start = eventTime; - - if (end < eventTime) - m_liveCache.end = eventTime; - - LtsTimelineClassic::Event *ltsEvent = createEvent(event); - m_liveCache.events.append(ltsEvent); - - rebuildTimelineKnownRanges(); - -#ifdef LTS_DEBUG - DEBUG_LOG(m_logger) << "added live event at " << eventTime << " - cache: " << start << " " << end << ", " << m_liveCache.events.count() << " events"; -#endif - - addEventAndFilter(ltsEvent); -} - - -void DDSTimelineModel::setTimeRange(qint64 min, qint64 max) -{ - m_lowestPositionedItem = min; - m_highestPositionedItem = max; -} - - -qint64 DDSTimelineModel::currentTime() const -{ - return m_session->partitionTime(); -} - - -void DDSTimelineModel::applyFilter(const QJsonArray &filter) -{ - m_filter = filter; - invalidateTimeline(); - beginResetModel(); - endResetModel(); -} - - -void DDSTimelineModel::addCacheRangeToTimeline(const CacheRange &cr) -{ - for (auto i = cr.events.begin(); i != cr.events.end(); ++i) - { - LtsTimelineClassic::Event *event = *i; - addEventAndFilter(event); - } -} - - -void DDSTimelineModel::addCacheRange(const LtsTimelineClassic::Range &range, const QVector &cachedEvents, qint64 incompleteEnd, bool addToTimeline) -{ - CacheRange cr; - - cr.visible = true; - cr.start = range.start; - cr.end = range.end; - cr.events = cachedEvents; - cr.incomplete = (incompleteEnd > 0); - - m_eventCount += cachedEvents.count(); - m_cachedEvents.append(QPair(m_lastCachedEventsId++, cr)); - - std::sort(m_cachedEvents.begin(), m_cachedEvents.end(), [](const QPair &cr1, const QPair &cr2) { return cr1.second.start < cr2.second.start; }); - - if (addToTimeline) - { - addCacheRangeToTimeline(cr); - rebuildTimelineKnownRanges(); - } - - DEBUG_LOG(m_logger) << "added cache for " << range.start << " to " << range.end << " - event count now: " << m_eventCount; -} - - -bool DDSTimelineModel::isCacheFull() const -{ - return (m_cachedEvents.count() > m_maxCacheRanges) ; -} - - -void DDSTimelineModel::_uncache(const CacheRange &cr) -{ - - for (const LtsTimelineClassic::Event *event : std::as_const(cr.events)) - removeEvent(event->uniqueId()); - - rebuildTimelineKnownRanges(); -} - - -void DDSTimelineModel::uncache(CacheRange &cr) -{ - QString hash(QStringLiteral("<%1:%2:%3>").arg(cr.start).arg(cr.end).arg(cr.events.count())); - DEBUG_LOG(m_logger) << "uncaching " << QString::number(qHash(hash), 16) << " " << cr.start << " "<< cr.end; - - cr.visible = false; - _uncache(cr); -} - - - - - - - - - - - - - - - - - - - - - - -void DDSTimelineModel::forceUncache() -{ - if (m_cachedEvents.isEmpty()) - return; - - - for (auto i = m_cachedEvents.begin(); i != m_cachedEvents.end(); ++i) - { - CacheRange &cr = i->second; - if (!cr.visible && cr.incomplete) - { - uncache(cr); - m_eventCount -= cr.events.count(); - m_cachedEvents.erase(i); - DEBUG_LOG(m_logger) << "removed an invisible & incomplete cache - event count now: " << m_eventCount; - return; - } - } - - - for (auto i = m_cachedEvents.begin(); i != m_cachedEvents.end(); ++i) - { - CacheRange &cr = i->second; - if (!cr.visible) - { - uncache(cr); - m_eventCount -= cr.events.count(); - m_cachedEvents.erase(i); - DEBUG_LOG(m_logger) << "removed an invisible cache - event count now: " << m_eventCount; - return; - } - } - - - auto i = m_cachedEvents.begin(); - - auto highestStart = i; - auto lowestEnd = i; - - for (; i != m_cachedEvents.end(); ++i) - { - CacheRange &cr = i->second; - - if (highestStart->second.start < cr.start) - highestStart = i; - if (lowestEnd->second.end > cr.end) - lowestEnd = i; - } - - qint64 sbpos = EventTools::getScrollbarPosition(); - - qint64 highestDiff = highestStart->second.start - sbpos; - qint64 lowestDiff = sbpos - lowestEnd->second.end; - - if (highestDiff > lowestDiff) - { - uncache(highestStart->second); - m_eventCount -= highestStart->second.events.count(); - m_cachedEvents.erase(highestStart); - } - else - { - uncache(lowestEnd->second); - m_eventCount -= lowestEnd->second.events.count(); - m_cachedEvents.erase(lowestEnd); - } - - WARNING_LOG(m_logger) << "force-removing a visible cache ... - event count now: " << m_eventCount; -} - - -QVector DDSTimelineModel::getKnownRanges() const -{ - QVector knownRanges; - knownRanges.reserve(m_cachedEvents.count() + 1); - - for (const auto &i : std::as_const(m_cachedEvents)) - { - const CacheRange &cr = i.second; - - if (!cr.incomplete) - knownRanges.append(Range(cr.start, cr.end)); - } - - knownRanges.append(Range(m_liveCache.start, m_liveCache.end)); - return knownRanges; -} - - -void DDSTimelineModel::rebuildTimelineKnownRanges() -{ - QTimer::singleShot(0, this, &DDSTimelineModel::signalRebuildTimelineKnownRanges); -} - - -void DDSTimelineModel::processEventList(qint64 &highest, bool &incomplete, QVector &cachedEvents, QVector &eventList, const int initialCount) -{ - int count = initialCount; - - QMutableVectorIterator i(eventList); - while (i.hasNext()) - { - count++; - if (count > m_cacheSize) - { - WARNING_LOG(m_logger) << "max cache exceeded - not adding more than " << m_cacheSize << " events"; - incomplete = true; - emit signalTooMuchEvents(); - break; - } - - LtsTimelineClassic::Event *event = i.next(); - i.remove(); - - cachedEvents.append(event); - - if (event->startTime() + event->duration(true ) > highest) - highest = event->startTime() + event->duration(true ); - } - - - qDeleteAll(eventList); -} - - -void DDSTimelineModel::receivedEvents(const LtsTimelineClassic::Range &range, QVector &receivedEventsList ) -{ - - if (isCacheFull()) - { - DEBUG_LOG(m_logger) << "receivedEvents: cache full - force uncache"; - forceUncache(); - } - -#ifdef LTS_DEBUG - DEBUG_LOG(m_logger) << "received events count: " << receivedEventsList.count(); -#endif - - qint64 highest = 0; - bool incomplete = false; - QVector cachedEvents; - - processEventList(highest, incomplete, cachedEvents, receivedEventsList); - addCacheRange(range, cachedEvents, incomplete ? highest : 0); - - DEBUG_LOG(m_logger) << "receivedEvents: loading done"; - emit signalLoadingDone(); -} - - -void DDSTimelineModel::setLive(bool isLive) -{ - if (m_isLive == isLive) - return; - - m_isLive = isLive; - m_liveCache.visible = isLive; - - if (isLive) - { - m_liveCache.start = m_session->partitionTime(); - m_liveCache.end = m_liveCache.start; - } - else - { - saveAndClearLiveCache(); - } -} - - - -void DDSTimelineModel::slotRequestMessageReceived(const QString &message) -{ - EventRequest *er = qobject_cast(sender()); - if (er == nullptr) - { - DEBUG_LOG(m_logger) << "not an EventRequest: " << sender(); - return; - } - - - - const QJsonDocument msgDoc(QJsonDocument::fromJson(message.toUtf8())); - const QJsonArray eventArray(msgDoc.array()); - - for (auto i = eventArray.constBegin(); i != eventArray.constEnd(); ++i) - { - const QJsonObject &eventObj = (*i).toObject(); - - int id = eventObj[QStringLiteral("id")].toInt(-1); - int eventTypeId = eventObj[QStringLiteral("eventTypeId")].toInt(-1); - qint64 startTime = eventObj[QStringLiteral("sampleTime")].toDouble(-1); - const QString &properties = eventObj[QStringLiteral("properties")].toString(QStringLiteral("{}")); - int partyId = eventObj[QStringLiteral("partyId")].toInt(-1); - int participantId = eventObj[QStringLiteral("participantId")].toInt(-1); - int equipmentNumber = eventObj[QStringLiteral("equipmentNumber")].toInt(-1); - - QJsonObject positionObj(eventObj[QStringLiteral("position")].toObject()); - const LtsUtils::QPoint3D pos(positionObj[QStringLiteral("x")].toDouble(), - positionObj[QStringLiteral("y")].toDouble(), - positionObj[QStringLiteral("z")].toDouble()); - - - QJsonParseError err; - const QJsonDocument doc(QJsonDocument::fromJson(properties.toUtf8(), &err)); - const QJsonObject root(doc.object()); - - if (err.error != QJsonParseError::NoError) - { - ERROR_LOG(m_logger) << "Event #" << id << " with event type id " << eventTypeId << " and start time " << startTime << " json detail data cannot be parsed: " << err.errorString() << " at offset " << err.offset; - continue; - } - - QString partyStr(ParticipantManagement::trPartyName(m_ppmDtc->party(partyId).name())); - - if (partyStr.isEmpty()) - partyStr = tr("Unknown Party"); - - QStringList path; - path.append(partyStr); - - switch (eventTypeId) - { - case ProjectDataManagement::PdmEventType::HitBuilding: - path = getPathForBuildingEvents(tr("Buildings"), root); - break; - case ProjectDataManagement::PdmEventType::CameraVideo: - path = getPathForAvsEvents(tr("Camera Video"), root); - break; - case ProjectDataManagement::PdmEventType::RadioCnr: - path = getPathForAvsEvents(tr("CNR Radio"), root); - break; - case ProjectDataManagement::PdmEventType::RadioTvc: - path = getPathForAvsEvents(tr("TVC Radio"), root); - break; - - case ProjectDataManagement::PdmEventType_def::MineArea: - path = getPathForAesEvents(tr("Mine Area"), root); - break; - - case ProjectDataManagement::PdmEventType_def::Borderline: - path = getPathForAesEvents(tr("Borderline"), root); - break; - - case ProjectDataManagement::PdmEventType_def::BCContamination: - path = getPathForAesEvents(tr("B/C Contamination"), root); - break; - - case ProjectDataManagement::PdmEventType_def::NContamination: - path = getPathForAesEvents(tr("N Contamination"), root); - break; - - case ProjectDataManagement::PdmEventType_def::DangerArea: - path = getPathForAesEvents(tr("Danger Area"), root); - break; - - case ProjectDataManagement::PdmEventType_def::FunctionalArea: - path = getPathForAesEvents(tr("Functional Area"), root); - break; - - case ProjectDataManagement::PdmEventType_def::MineCorridor: - path = getPathForAesEvents(tr("Mine Corridor"), root); - break; - - case ProjectDataManagement::PdmEventType_def::TechnicalArea: - path = getPathForAesEvents(tr("Technical Area"), root); - break; - - case ProjectDataManagement::PdmEventType_def::GasPipe: - path = getPathForAesEvents(tr("Gas Pipe"), root); - break; - - default: - path << m_ppmDtc->hierarchyFromParticipant(participantId, m_ppmDtc->participants()).split(QLatin1Char(',')); - path << QString::number(equipmentNumber); - break; - } - - LtsTimelineClassic::Event::EventPaintFunc paintFunc; - QColor color; - setColorPaintFun(paintFunc, color, ProjectDataManagement::PdmEventType_def::type(eventTypeId)); - - - qint64 endTime = root[QStringLiteral("endTime")].toDouble(); - - LtsTimelineClassic::Event *event = new LtsTimelineClassic::Event(id, eventTypeId, startTime, endTime, participantId, partyId, equipmentNumber, - path, paintFunc, color, root, -1, pos, m_session); - -#ifdef LTS_DEBUG - DEBUG_LOG(m_logger) << "Event #" << event->uniqueId() << " with event type id " << event->typeId() << " and start time " << event->startTime() << " created"; -#endif - - er->append(event); - } -} - - -void DDSTimelineModel::requestEvents(const LtsTimelineClassic::Range &range) -{ - DEBUG_LOG(m_logger) << "requesting events from " << QDateTime::fromMSecsSinceEpoch(range.start).toString() - << " to " << QDateTime::fromMSecsSinceEpoch(range.end).toString(); - - if (m_createFakeEvents) - DEBUG_LOG(m_logger) << "requesting fake events .."; - else - DEBUG_LOG(m_logger) << "requesting real events .."; - - EventRequest *request = new EventRequest(m_createFakeEvents ? QUrl(QStringLiteral("ws://127.0.0.1:10090")) : m_eemForeign->eemUrl(), - range.start, range.end, m_activeEventTypeIds, m_cacheSize); - - connect(request, &EventRequest::signalDone, - this, [this, range, request]() - { - QVector eventList = request->eventList(); - DEBUG_LOG(m_logger) << ".. received real events! " << range.start << " - " << range.end; - - receivedEvents(range, eventList); - request->deleteLater(); - }); - - connect(request, &EventRequest::signalRequestFailed, - this, [this, request](const QString &errorString) - { - ERROR_LOG(m_logger) << ".. event request from " << request->start() << " to " << request->end() << " failed! '" << errorString << "'"; - emit signalLoadingDone(); - }); - - connect(request, &EventRequest::signalMessageReceived, - this, &DDSTimelineModel::slotRequestMessageReceived); - - emit signalLoading(); -} - - -bool DDSTimelineModel::isCached(int eventId) const -{ - for (const auto &it : m_cachedEvents) - { - const CacheRange &cr = it.second; - for (const LtsTimelineClassic::Event *ev :cr.events) - { - if (ev->uniqueId() == eventId) - return true; - } - } - - for (const LtsTimelineClassic::Event *ev : m_liveCache.events) - { - if (ev->uniqueId() == eventId) - return true; - } - - return false; -} - - -void DDSTimelineModel::showCached(CacheRange &cacheRange) -{ - cacheRange.visible = true; - addCacheRangeToTimeline(cacheRange); -} - - -bool DDSTimelineModel::splitLowest(qint64 &rangeMin , qint64 rangeMax , qint64 &requestMin , qint64 &requestMax , const CacheRange &lowestCache ) const -{ - qint64 oldRangeMin = rangeMin; - bool spaceBeforeCache = (rangeMin < lowestCache.start); - - if (spaceBeforeCache) - { - - - requestMin = rangeMin; - requestMax = lowestCache.start - 1; - - DEBUG_LOG(m_logger) << "splitLowest: there is an uncached range before the lowest cache, adding this uncached range to the request " << requestMin << " - " << requestMax << " and set rangeMin now to " << rangeMin << " while rangeMax keeps being " << rangeMax; - } - else - { - - DEBUG_LOG(m_logger) << "splitLowest: no uncached range at the start of the requested range, no need to request events here - skipping"; - } - - - rangeMin = lowestCache.end + 1; - - if (rangeMin > rangeMax) - { - DEBUG_LOG(m_logger) << "splitLowest: rangeMin > rangeMax - lowestCache.end " << lowestCache.end; - rangeMin = rangeMax; - } - - DEBUG_LOG(m_logger) << "splitLowest: space? " << spaceBeforeCache << " | requestMin" << requestMin << " - requestMax " << requestMax << " | oldRangeMin " << oldRangeMin << " - rangeMin " << rangeMin; - - return spaceBeforeCache; -} - - -bool DDSTimelineModel::isInsideCachedRange(const CacheRange &cr, qint64 start, qint64 end) -{ - - return (cr.end >= start && cr.start <= end); -} - - -void DDSTimelineModel::setCreateFakeEvents(bool createFakeEvents) -{ - m_createFakeEvents = createFakeEvents; -} - - -void DDSTimelineModel::getAllEventsOfType(const QSet &eventTypeIds) -{ - - for (auto i = m_cachedEvents.begin(); i != m_cachedEvents.end(); ++i) - { - CacheRange &cr = i->second; - qint64 crId = i->first; - EventRequest *request = new EventRequest(m_createFakeEvents ? QUrl(QStringLiteral("ws://127.0.0.1:10090")) : m_eemForeign->eemUrl(), cr.start, cr.end, eventTypeIds, m_cacheSize); - - connect(request, &EventRequest::signalDone, - this, [this, crId, request]() - { - auto icr = std::find_if(m_cachedEvents.begin(), m_cachedEvents.end(), [crId](const QPair &pair) - { - return (pair.first == crId); - }); - - if (icr == m_cachedEvents.end()) - { - WARNING_LOG(m_logger) << "cr after request for crId " << crId << " not available anymore"; - return; - } - - CacheRange &cr = icr->second; - - QVector eventList = request->eventList(); - DEBUG_LOG(m_logger) << "getAllEventsOfType: .. received real events! " << cr.start << " - " << cr.end; - - - - if (isCacheFull()) - { - DEBUG_LOG(m_logger) << "getAllEventsOfType: receivedEvents: cache full - not adding new events"; - cr.incomplete = true; - return; - } - - -#ifdef LTS_DEBUG - DEBUG_LOG(m_logger) << "getAllEventsOfType: received events count: " << eventList.count(); -#endif - - qint64 highest = 0; - bool incomplete = false; - QVector cachedEvents; - - processEventList(highest, incomplete, cachedEvents, eventList, cr.events.count()); - - cr.incomplete = incomplete; - - - - - QMutableVectorIterator i(cachedEvents); - while (i.hasNext()) - { - LtsTimelineClassic::Event *eNew = i.next(); - - for (LtsTimelineClassic::Event *eOld : std::as_const(cr.events)) - { - if (eNew->uniqueId() == eOld->uniqueId()) - { - delete eNew; - i.remove(); - break; - } - } - } - - - cr.events += cachedEvents; - - - addEventsAndFilter(cachedEvents); - rebuildTimelineKnownRanges(); - - - DEBUG_LOG(m_logger) << "getAllEventsOfType: receivedEvents: loading done"; - request->deleteLater(); - }); - - connect(request, &EventRequest::signalRequestFailed, - this, [this, request](const QString &errorString) - { - ERROR_LOG(m_logger) << "getAllEventsOfType: event request from " << request->start() << " to " << request->end() << " failed! '" << errorString << "'"; - emit signalLoadingDone(); - }); - - connect(request, &EventRequest::signalMessageReceived, - this, &DDSTimelineModel::slotRequestMessageReceived); - } -} - - -void DDSTimelineModel::getEvents(qint64 rangeMin, qint64 rangeMax) -{ - DEBUG_LOG(m_logger) << "getEvents: requesting events from " << QDateTime::fromMSecsSinceEpoch(rangeMin).toString() << rangeMin << " to " << QDateTime::fromMSecsSinceEpoch(rangeMax).toString() << rangeMax; - - if (!hasActiveEventTypes()) - { - DEBUG_LOG(m_logger) << "no active event types selected"; - return; - } - - if (m_liveCache.start != 0 && rangeMax > m_liveCache.start) - { - DEBUG_LOG(m_logger) << "live cache active & in range - limited range max from " << rangeMax << " to " << m_liveCache.start - 1; - rangeMax = m_liveCache.start - 1; - } - - - QVector requestRanges; - for (auto &it : m_cachedEvents) - { - CacheRange &cr = it.second; - DEBUG_LOG(m_logger) << "> start " << cr.start << " end " << cr.end; - - bool inside = isInsideCachedRange(cr, rangeMin, rangeMax); - if (!inside) - continue; - - DEBUG_LOG(m_logger) << "found range that was cached, using it instead of requesting new events"; - - if (!cr.visible) - { - DEBUG_LOG(m_logger) << "found range that was cached AND not visible, showing it again"; - showCached(cr); - } - - qint64 requestMin = 0; - qint64 requestMax = 0; - - if (!splitLowest(rangeMin, rangeMax, requestMin, requestMax, cr)) - continue; - requestRanges.append(Range(requestMin, requestMax)); - - - - - - - - } - - - - if (rangeMin < rangeMax && m_liveCache.start != 0) - { - if (isInsideCachedRange(m_liveCache, rangeMin, rangeMax)) - { - qint64 requestMin = 0; - qint64 requestMax = 0; - - if (splitLowest(rangeMin, rangeMax, requestMin, requestMax, m_liveCache)) - requestRanges.append(Range(requestMin, requestMax)); - } - } - - if (rangeMin < rangeMax) - { - DEBUG_LOG(m_logger) << "adding request for leftovers from " << rangeMin << " - " << rangeMax; - requestRanges.append(Range(rangeMin, rangeMax)); - } - - int requestRangesCount = requestRanges.count(); - DEBUG_LOG(m_logger) << "requestRanges: " << requestRangesCount; - - for (const auto &range : std::as_const(requestRanges)) - requestEvents(range); - - if (requestRangesCount < 1) - DEBUG_LOG(m_logger) << "nothing requested (requestRangesCount empty)"; -} - - -void DDSTimelineModel::setColorPaintFun(LtsTimelineClassic::Event::EventPaintFunc &paintFunc, QColor &color, - ProjectDataManagement::PdmEventType eventType) const -{ - paintFunc = nullptr; - color = QColor(); - switch (eventType.underlying()) - { - case ProjectDataManagement::PdmEventType::BiteMessage: - paintFunc = LtsTimelineClassic::Event::drawCustomEventGraphicRect; - color = QColor("red"); - return; - case ProjectDataManagement::PdmEventType::CameraVideo: - paintFunc = LtsTimelineClassic::Event::drawCustomEventGraphicRect; - color = QColor("yellow"); - return; - case ProjectDataManagement::PdmEventType::CrossGlobalBorderline: - case ProjectDataManagement::PdmEventType::CrossLocalBorderline: - paintFunc = LtsTimelineClassic::Event::drawCustomEventGraphicRect; - color = QColor("orange"); - return; - case ProjectDataManagement::PdmEventType::EnterDangerArea: - paintFunc = LtsTimelineClassic::Event::drawCustomEventGraphicRoundedRect; - color = QColor("blue"); - return; - case ProjectDataManagement::PdmEventType::LeaveDangerArea: - paintFunc = LtsTimelineClassic::Event::drawCustomEventGraphicRoundedRect; - color = QColor("red"); - return; - case ProjectDataManagement::PdmEventType::EnterFunctionalArea: - paintFunc = LtsTimelineClassic::Event::drawCustomEventGraphicRoundedRect; - color = QColor("green"); - return; - case ProjectDataManagement::PdmEventType::LeaveFunctionalArea: - paintFunc = LtsTimelineClassic::Event::drawCustomEventGraphicRoundedRect; - color = QColor("yellow"); - return; - case ProjectDataManagement::PdmEventType::EnterMineArea: - paintFunc = LtsTimelineClassic::Event::drawCustomEventGraphicRoundedRect; - color = QColor("orange"); - return; - case ProjectDataManagement::PdmEventType::LeaveMineArea: - paintFunc = LtsTimelineClassic::Event::drawCustomEventGraphicRoundedRect; - color = QColor("brown"); - return; - case ProjectDataManagement::PdmEventType::FireEvent: - paintFunc = LtsTimelineClassic::Event::drawCustomEventGraphicEllipse; - color = QColor("blue"); - return; - case ProjectDataManagement::PdmEventType::Hit: - paintFunc = LtsTimelineClassic::Event::drawCustomEventGraphicEllipse; - color = QColor("green"); - return; - case ProjectDataManagement::PdmEventType::Sanitation: - paintFunc = LtsTimelineClassic::Event::drawCustomEventGraphicEllipse; - color = QColor("magenta"); - return; - case ProjectDataManagement::PdmEventType::HitBuilding: - paintFunc = LtsTimelineClassic::Event::drawCustomEventGraphicEllipse; - color = QColor("cyan"); - return; - case ProjectDataManagement::PdmEventType::HitEffectSimulation: - paintFunc = LtsTimelineClassic::Event::drawCustomEventGraphicEllipse; - color = QColor("orange"); - return; - case ProjectDataManagement::PdmEventType::Manipulation: - paintFunc = LtsTimelineClassic::Event::drawCustomEventGraphicTriangle; - color = QColor("blue"); - return; - case ProjectDataManagement::PdmEventType::RadioCnr: - paintFunc = LtsTimelineClassic::Event::drawCustomEventGraphicTriangle; - color = QColor("red"); - return; - case ProjectDataManagement::PdmEventType::RadioTvc: - paintFunc = LtsTimelineClassic::Event::drawCustomEventGraphicTriangle; - color = QColor("green"); - return; - case ProjectDataManagement::PdmEventType::WeaponAssignment: - paintFunc = LtsTimelineClassic::Event::drawCustomEventGraphicTriangle; - color = QColor("orange"); - return; - case ProjectDataManagement::PdmEventType::MineArea: - paintFunc = LtsTimelineClassic::Event::drawCustomEventGraphicInvertTriangle; - color = QColor("green"); - return; - case ProjectDataManagement::PdmEventType::NContamination: - paintFunc = LtsTimelineClassic::Event::drawCustomEventGraphicInvertTriangle; - color = QColor("pink"); - return; - case ProjectDataManagement::PdmEventType::EnterNuclear: - paintFunc = LtsTimelineClassic::Event::drawCustomEventGraphicRoundedRect; - color = QColor("pink"); - return; - case ProjectDataManagement::PdmEventType::LeaveNuclear: - paintFunc = LtsTimelineClassic::Event::drawCustomEventGraphicRoundedRect; - color = QColor("pink").darker(); - return; - case ProjectDataManagement::PdmEventType::BCContamination: - paintFunc = LtsTimelineClassic::Event::drawCustomEventGraphicInvertTriangle; - color = QColor("blue"); - return; - case ProjectDataManagement::PdmEventType::DangerArea: - paintFunc = LtsTimelineClassic::Event::drawCustomEventGraphicInvertTriangle; - color = QColor("yellow"); - return; - case ProjectDataManagement::PdmEventType::FunctionalArea: - paintFunc = LtsTimelineClassic::Event::drawCustomEventGraphicInvertTriangle; - color = QColor("red"); - return; - case ProjectDataManagement::PdmEventType::MineCorridor: - paintFunc = LtsTimelineClassic::Event::drawCustomEventGraphicInvertTriangle; - color = QColor("brown"); - return; - case ProjectDataManagement::PdmEventType::Borderline: - paintFunc = LtsTimelineClassic::Event::drawCustomEventGraphicInvertTriangle; - color = QColor("orange"); - return; - case ProjectDataManagement::PdmEventType::TechnicalArea: - paintFunc = LtsTimelineClassic::Event::drawCustomEventGraphicInvertTriangle; - color = QColor("black"); - return; - case ProjectDataManagement::PdmEventType::GasPipe: - paintFunc = LtsTimelineClassic::Event::drawCustomEventGraphicRect; - color = QColor("cyan"); - return; - case ProjectDataManagement::PdmEventType::Unknown: - - case ProjectDataManagement::PdmEventType::HitN: - case ProjectDataManagement::PdmEventType::HitB: - case ProjectDataManagement::PdmEventType::HitC: - case ProjectDataManagement::PdmEventType::HitGasPipe: - case ProjectDataManagement::PdmEventType::HitMine: - case ProjectDataManagement::PdmEventType::FriendlyFire: - case ProjectDataManagement::PdmEventType::EquipmentErrorReport: - case ProjectDataManagement::PdmEventType::EmergencyCall: - return; - } - Q_ASSERT(false); -} - - -QJsonObject DDSTimelineModel::createMarkerDetailData(const MarkerManagement::Marker &data) const -{ - QJsonObject root; - root[QStringLiteral("MarkerName")] = QString::fromStdString(data.name()); - root[QStringLiteral("MarkerNote")] = QString::fromStdString(data.note()); - root[QStringLiteral("Operator")] = data.operatorId(); - root[QStringLiteral("MarkerOffset")] = data.timeStampOffset(); - root[QStringLiteral("MapSettings")] = QString::fromStdString(data.mapSettings()); - root[QStringLiteral("Filter")] = QString::fromStdString(data.filter()); - - bool isSit = false; - bool isGfx = false; - bool isSfx = false; - - for (const MarkerManagement::MarkerDescription &md : data.descriptions()) - { - switch (md.markerType().underlying()) - { - case MarkerManagement::MarkerType::Situation: - { - isSit = true; - break; - } - case MarkerManagement::MarkerType::Video: - { - isGfx = true; - break; - } - case MarkerManagement::MarkerType::Audio: - { - isSfx = true; - break; - } - default: - { - WARNING_LOG(m_logger) << "Marker " << data.id() << "'s description has an invalid marker type: " << (int)md.markerType().underlying(); - break; - } - } - } - - root[QStringLiteral("IsSituationType")] = isSit; - root[QStringLiteral("IsVideoType")] = isGfx; - root[QStringLiteral("IsAudioType")] = isSfx; - - return root; -} - - -LtsTimelineClassic::Event *DDSTimelineModel::getMarker(int uniqueId) -{ - const LtsTimelineClassic::ItemList il = m_rootItem->getFullItemList(true); - for (auto i = il.constBegin(); i != il.constEnd(); ++i) - { - LtsTimelineClassic::Item *item = *i; - - if (item != nullptr && item->getIdentifier() == QStringLiteral("Markers")) - { - const LtsTimelineClassic::EventList el = item->getFullEventList(true, true); - - for (LtsTimelineClassic::Event *event : el) - { - if (event->uniqueId() == uniqueId) - return event; - } - } - } - - return nullptr; -} - - -void DDSTimelineModel::modifyMarker(const MarkerManagement::Marker &data) -{ - LtsTimelineClassic::Event *event = getMarker(data.id()); - - if (event == nullptr) - return; - - - - - event->setDetailData(createMarkerDetailData(data)); - - - event->setPosition(LtsUtils::QPoint3D(data.position().lon(), - data.position().lat(), - data.position().z())); - - - -} - - -void DDSTimelineModel::addMarkerManagementMarker(const MarkerManagement::Marker &data) -{ - - if (m_knownMarkerIds.contains(data.id())) - return; - m_knownMarkerIds += data.id(); - - - QStringList path; - path.append(tr("Markers")); - - LtsTimelineClassic::Event::EventPaintFunc paintFunc = LtsTimelineClassic::Event::drawCustomEventGraphicTriangle; - QColor color = QColor(Qt::red); - - const LtsUtils::QPoint3D pos(data.position().lon(), - data.position().lat(), - data.position().z()); - - addEventAndFilter(new LtsTimelineClassic::Event(data.id(), - markerTypeId, - - data.timeStamp(), - 0, - -1, - -1, - -1, - path, - paintFunc, - color, - createMarkerDetailData(data), - -1, - pos, - m_session)); - -#ifdef LTS_DEBUG - DEBUG_LOG(m_logger) << "marker added! uniqueId " << data.id() << ", startTime " << data.timeStamp(); -#endif -} - - - - - - - - - - - - - - - - - - - -const QJsonObject DDSTimelineModel::getDetailData(const ExerciseEventManagement::Event &event) const -{ - return getDetailData(QByteArray::fromRawData(event.properties().c_str(), event.properties().size()), event.id(), event.eventTypeId(), event.sampleTime()); -} - - -const QJsonObject DDSTimelineModel::getDetailData(const QByteArray &data, int id, const ProjectDataManagement::PdmEventType& type, qint64 startTime) const -{ - QJsonParseError err; - QJsonDocument doc(QJsonDocument::fromJson(data, &err)); - if (err.error != QJsonParseError::NoError) - { - ERROR_LOG(m_logger) << "getDetailData: Event #" << id << " with event type id " << type << " and start time " << startTime << " json detail data cannot be parsed: " << err.errorString() << " at offset " << err.offset; - return QJsonObject(); - } - - return doc.object(); -} - - - -LtsTimelineClassic::Event *DDSTimelineModel::createEvent(const ExerciseEventManagement::Event &data) const -{ - - - - - - - QJsonObject root(getDetailData(data)); - - QString partyStr(ParticipantManagement::trPartyName(m_ppmDtc->party(data.partyId()).name())); - - if (partyStr.isEmpty()) - partyStr = tr("Unknown Party"); - - QStringList path; - path.append(partyStr); - - switch (data.eventTypeId().underlying()) - { - case ProjectDataManagement::PdmEventType::HitBuilding: - path = getPathForBuildingEvents(tr("Buildings"), root); - break; - case ProjectDataManagement::PdmEventType::CameraVideo: - path = getPathForAvsEvents(tr("Camera Video"), root); - break; - case ProjectDataManagement::PdmEventType::RadioCnr: - path = getPathForAvsEvents(tr("CNR Radio"), root); - break; - case ProjectDataManagement::PdmEventType::RadioTvc: - path = getPathForAvsEvents(tr("TVC Radio"), root); - break; - case ProjectDataManagement::PdmEventType_def::MineArea: - path = getPathForAesEvents(tr("Mine Area"), root); - break; - case ProjectDataManagement::PdmEventType_def::Borderline: - path = getPathForAesEvents(tr("Borderline"), root); - break; - case ProjectDataManagement::PdmEventType_def::BCContamination: - path = getPathForAesEvents(tr("B/C Contamination"), root); - break; - case ProjectDataManagement::PdmEventType_def::NContamination: - path = getPathForAesEvents(tr("N Contamination"), root); - break; - case ProjectDataManagement::PdmEventType_def::DangerArea: - path = getPathForAesEvents(tr("Danger Area"), root); - break; - case ProjectDataManagement::PdmEventType_def::FunctionalArea: - path = getPathForAesEvents(tr("Functional Area"), root); - break; - case ProjectDataManagement::PdmEventType_def::MineCorridor: - path = getPathForAesEvents(tr("Mine Corridor"), root); - break; - case ProjectDataManagement::PdmEventType_def::TechnicalArea: - path = getPathForAesEvents(tr("Technical Area"), root); - break; - case ProjectDataManagement::PdmEventType_def::GasPipe: - path = getPathForAesEvents(tr("Gas Pipe"), root); - break; - - default: - path << m_ppmDtc->hierarchyFromParticipant(data.participantId()).split(QLatin1Char(',')); - path << QString::number(data.equipmentNumber()); - break; - } - - LtsTimelineClassic::Event::EventPaintFunc paintFunc; - QColor color; - setColorPaintFun(paintFunc, color,data.eventTypeId()); - - - qint64 endTime = root[QStringLiteral("endTime")].toDouble(); - - const LtsUtils::QPoint3D pos(data.position().lon(), - data.position().lat(), - data.position().z()); - LtsTimelineClassic::Event *event = new LtsTimelineClassic::Event(data.id(), data.eventTypeId().underlying(), data.sampleTime(), endTime, - data.participantId(), data.partyId(), data.equipmentNumber(), path, paintFunc, color, - root, -1, - pos, - m_session); - - - - - - - - -#ifdef LTS_DEBUG - DEBUG_LOG(m_logger) << "Event #" << event->uniqueId() << " with event type id " << event->typeId() << " and start time " << event->startTime() << " created"; -#endif - - return event; -} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -QStringList DDSTimelineModel::getPathForAvsEvents(const QString &type, const QJsonObject &obj) const -{ - QStringList result; - - int buildingId = obj[QStringLiteral("MainStructureElementId")].toInt(); - DEBUG_LOG(m_logger) << "Building Id = " << buildingId; - if (buildingId > 0) - { - const QString buildingName = m_ismDtc->getBuildingDisplayName(buildingId); - result << tr("Buildings") << buildingName; - } - - QString streamName = obj[QStringLiteral("streamName")].toString(); - QString displayName = streamName; - - if (m_streamNameMapping != nullptr) - displayName = m_streamNameMapping->displayName(streamName); - - result << type << displayName; - - return result; -} - - -QStringList DDSTimelineModel::getPathForBuildingEvents(const QString &type, const QJsonObject &obj) const -{ - QStringList result; - result << type; - - QString buildingName; - - int buildingId = obj[QStringLiteral("MainStructureElementId")].toInt(); - DEBUG_LOG(m_logger) << "Building Id = " << buildingId; - if (buildingId > 0) - { - buildingName = m_ismDtc->getBuildingDisplayName(buildingId); - result << buildingName; - } - - result << tr("Hits"); - - return result; -} - - -QStringList DDSTimelineModel::getPathForAesEvents(const QString &type, const QJsonObject &obj) const -{ - QStringList result; - result << type; - - QString aesName = obj[QStringLiteral("AesName")].toString(); - DEBUG_LOG(m_logger) << "AesName = " << aesName; - result << aesName; - - return result; -} - - -void DDSTimelineModel::removeEvent(int eventId) -{ - const LtsTimelineClassic::ItemList il = getRootItem()->getFullItemList(true); - - for (LtsTimelineClassic::Item *item : il) - { - if (item->removeEvent(eventId)) - { - - return; - } - } - - WARNING_LOG(m_logger) << "removeEvent: event "<uniqueId() == eventId) - return &it.second; - } - } - - return nullptr; -} - - -void DDSTimelineModel::addEventsAndFilter(const QVector &eventList) -{ - for (LtsTimelineClassic::Event *e : eventList) - addEventAndFilter(e); -} - - -void DDSTimelineModel::addEventAndFilter(LtsTimelineClassic::Event *event) -{ - if (!m_filter.isEmpty()) - setFilter(m_detailData, LtsTimelineClassic::EventList() << event, m_filter, nullptr, false, false ); - - addEvent(event); - - - emit dataChanged(QModelIndex(), QModelIndex()); -} - - -void DDSTimelineModel::deleteMarker(int uniqueId) -{ - m_knownMarkerIds.removeAll(uniqueId); - - LtsTimelineClassic::Event *event = getMarker(uniqueId); - - if (event == nullptr) - return; - - event->setDeleted(); - - - emit dataChanged(QModelIndex(), QModelIndex()); -} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void DDSTimelineModel::slotMarkerChanged(const MarkerManagement::Marker &data, DataModification modType) -{ - switch (modType) - { - case DataModification::eAdded: - { - addMarkerManagementMarker(data); - break; - } - case DataModification::eRemoved: - { - deleteMarker(data.id()); - break; - } - case DataModification::eModified: - { - modifyMarker(data); - break; - } - } -} - - - -static int testId = 0; -QVector DDSTimelineModel::createTestEvents(qint64 time, int count, qint64 distance, qint64 duration) -{ - QVector eventList; - eventList.reserve(count); - LtsTimelineClassic::Event::EventPaintFunc paintFunc = LtsTimelineClassic::Event::drawCustomEventGraphicRect; - - for (int i = 0; i < count; i++) - { - testId++; - - QJsonObject detail; - detail[QStringLiteral("VulnerabilityState")] = testId; - - qint64 pos = time + (i * (distance / count)); - - LtsTimelineClassic::Event *event = - new LtsTimelineClassic::Event( - testId, - 1, - pos, - pos + duration, - 0, - 2, - 0, - QStringList() << QStringLiteral("Test"), - paintFunc, - QColor(Qt::red), - detail, - -1, - LtsUtils::QPoint3D(), - m_session); - - eventList.append(event); - } - - return eventList; -} - - - - - -EventRequest::EventRequest(const QUrl &url, qint64 start, qint64 end, const QSet &eventTypes, int limit) : m_start(start) - , m_end(end) - , m_timeoutTimer(new QTimer(this)), - m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger()) { - QUrl realUrl(url); - realUrl.setPath(QStringLiteral("/request")); - - QUrlQuery query; - query.addQueryItem(QStringLiteral("from"), QString::number(m_start)); - query.addQueryItem(QStringLiteral("to"), QString::number(m_end)); - query.addQueryItem(QStringLiteral("requestId"), QStringLiteral("1")); - query.addQueryItem(QStringLiteral("limit"), QString::number(limit + 1 )); - - if (!eventTypes.isEmpty()) - { - QStringList sl; - sl.reserve(eventTypes.size()); - for (int id : eventTypes) - sl += QString::number(id); - query.addQueryItem(QStringLiteral("eventTypeId"), sl.join(QLatin1Char(','))); - } - - realUrl.setQuery(query); - - - - QWebSocket *ws = new QWebSocket(QString(), QWebSocketProtocol::VersionLatest, this); - - connect(ws, QOverload::of(&QWebSocket::error), - this, &EventRequest::slotRequestFailed); - connect(ws, &QWebSocket::textMessageReceived, - this, &EventRequest::slotMessageReceived); - - ws->open(realUrl); - - - m_timeoutTimer->setInterval(5000); - m_timeoutTimer->setSingleShot(true); - - connect(m_timeoutTimer, &QTimer::timeout, - this, [this]() - { - requestFailed(QStringLiteral("timeout")); - }); - - m_timeoutTimer->start(); -} - - -void EventRequest::slotMessageReceived(const QString &message) -{ - if (message.isEmpty() || message == QStringLiteral("{}")) - { - m_timeoutTimer->stop(); - emit signalDone(); - return; - } - - m_timeoutTimer->start(); - emit signalMessageReceived(message); -} - - -void EventRequest::requestFailed(const QString &errorString) -{ - m_timeoutTimer->stop(); - emit signalRequestFailed(errorString); - deleteLater(); -} - - -void EventRequest::slotRequestFailed() -{ - QWebSocket *ws = qobject_cast(sender()); - - if (ws == nullptr) - { - requestFailed(QStringLiteral("unknown error")); - return; - } - - requestFailed(ws->errorString()); -} - -} - - - diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_dialog_model.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_dialog_model.h deleted file mode 100755 index fcd167f8b..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_dialog_model.h +++ /dev/null @@ -1,203 +0,0 @@ - - - -#pragma once - -#include "detail_data.h" - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - - -namespace LtsUtils -{ -class RequestHelper; -} - -namespace LtsSession -{ -class LtsSession; -} - -namespace AudioVideoManagement -{ -class StreamNameMapping; -} - -namespace Timeline -{ -struct CacheRange : public LtsTimelineClassic::Range -{ - QVector events; - bool incomplete = true; - bool visible = false; -}; - - -class DDSTimelineModel : public LtsTimelineClassic::AbstractTimelineModel -{ - Q_OBJECT - -public: - explicit DDSTimelineModel(QObject *parent); - ~DDSTimelineModel(); - - bool init(const std::shared_ptr &eemForeign, - const std::shared_ptr &mrkDtc, - const std::shared_ptr &exmDtc, - const std::shared_ptr &ppmDtc, - const std::shared_ptr &pdmDtc, - const std::shared_ptr &ismDtc, - LtsSession::LtsSession *session, - Timeline::DetailData *detailData, - AudioVideoManagement::StreamNameMapping *streamNameMapping); - - void applyFilter(const QJsonArray &filter); - void setDetailData(DetailData *detailData) { m_detailData = detailData; } - void setColorPaintFun(LtsTimelineClassic::Event::EventPaintFunc &paintFunc, QColor &color, ProjectDataManagement::PdmEventType eventType) const; - void setTimeRange(qint64 min, qint64 max); - void getEvents(qint64 rangeMin, qint64 rangeMax); - QVector getKnownRanges() const; - const QVector> &cachedEvents() const { return m_cachedEvents; } - const CacheRange &liveCache() const { return m_liveCache; } - void forceUncache(); - void setLive(bool isLive = true); - void setCreateFakeEvents(bool createFakeEvents = true); - void setActiveEventTypeIds(const QSet &activeEventTypeIds); - const QSet &activeEventTypeIds() const { return m_activeEventTypeIds; } - bool hasActiveEventTypes() const { return !m_activeEventTypeIds.isEmpty(); } - void getAllEventsOfType(const QSet &eventTypeIds); - - -private: - - -NGL::INGLLogger &m_logger; - qint64 currentTime() const override; - - QStringList getPathForAvsEvents(const QString &type, const QJsonObject &obj) const; - QStringList getPathForBuildingEvents(const QString &type, const QJsonObject &obj) const; - QStringList getPathForAesEvents(const QString &type, const QJsonObject &obj) const; - void addMarkerManagementMarker(const MarkerManagement::Marker &data); - void addEventsAndFilter(const QVector &eventList); - void addEventAndFilter(LtsTimelineClassic::Event *event); - void deleteMarker(int uniqueId); - void modifyMarker(const MarkerManagement::Marker &data); - QJsonObject createMarkerDetailData(const MarkerManagement::Marker &data) const; - LtsTimelineClassic::Event *getMarker(int uniqueId); - void checkCache(); - void removeEvent(int eventId); - void addCacheRange(const LtsTimelineClassic::Range &range, const QVector &cachedEvents, qint64 incompleteEnd, bool addToTimeline = true); - bool isLive() const { return m_isLive; } - LtsTimelineClassic::Event *createEvent(const ExerciseEventManagement::Event &data) const; - - bool checkDetailData(const LtsTimelineClassic::Event *event) const; - void processEventList(qint64 &highest, bool &incomplete, QVector &cachedEvents, QVector &eventList, const int initialCount = 0); - void receivedEvents(const LtsTimelineClassic::Range &range, QVector &receivedEventsList); - void requestEvents(const LtsTimelineClassic::Range &range); - QVector createTestEvents(qint64 time, int count, qint64 distance, qint64 duration = 0); - static bool isInsideCachedRange(const CacheRange &cacheRange, qint64 start, qint64 end); - bool isCached(int eventId) const; - void showCached(CacheRange &cacheRange); - bool isCacheFull() const; - - void uncache(CacheRange &cr); - const CacheRange *getCache(int eventId) const; - void addCacheRangeToTimeline(const CacheRange &cr); - bool splitLowest(qint64 &rangeMin, qint64 rangeMax, qint64 &requestMin, qint64 &requestMax, const CacheRange &lowestCache) const; - void rebuildTimelineKnownRanges(); - void _uncache(const CacheRange &cr); - void saveAndClearLiveCache(); - const QJsonObject getDetailData(const ExerciseEventManagement::Event &event) const; - const QJsonObject getDetailData(const QByteArray &data, int id, const ProjectDataManagement::PdmEventType& type, qint64 startTime) const; - - std::shared_ptr m_eemForeign; - std::shared_ptr m_dtcExm; - std::shared_ptr m_ppmDtc; - std::shared_ptr m_pdmDtc; - std::shared_ptr m_mrkDtc; - std::shared_ptr m_ismDtc; - - QJsonArray m_filter; - LtsSession::LtsSession *m_session; - int64_t m_startTime; - int64_t m_endTime; - DetailData *m_detailData; - AudioVideoManagement::StreamNameMapping *m_streamNameMapping; - bool m_isLive; - int m_cacheSize; - int m_maxCacheRanges; - int m_eventCount; - - qint64 m_lastCachedEventsId; - QVector> m_cachedEvents; - - CacheRange m_liveCache; - bool m_createFakeEvents; - QSet m_activeEventTypeIds; - - QVector m_knownMarkerIds; -public slots: - void slotAddLiveEvent(const ExerciseEventManagement::Event &event); - - -private slots: - - void slotMarkerChanged(const MarkerManagement::Marker &data, DataModification modType); - void slotAddLiveEventsFake(); - void slotRequestMessageReceived(const QString &message); - - -signals: - void signalTooMuchEvents(); - void signalRebuildTimelineKnownRanges(); - void signalLoading(); - void signalLoadingDone(); - -}; - - -class EventRequest : public QObject -{ - Q_OBJECT - -public: - EventRequest(const QUrl &url, qint64 start, qint64 end, const QSet &eventTypes, int limit); - ~EventRequest() = default; - - void append(LtsTimelineClassic::Event *newEvent) { m_eventList.push_back(newEvent); } - const QVector &eventList() const { return m_eventList; } - qint64 start() const { return m_start; } - qint64 end() const { return m_end; } - -private: - void requestFailed(const QString &errorString); - - qint64 m_start; - qint64 m_end; - QVector m_eventList; - QTimer *m_timeoutTimer; - - -private slots: - void slotRequestFailed(); - void slotMessageReceived(const QString &message); - - -signals: - void signalRequestFailed(const QString &errorString); - void signalMessageReceived(const QString &message); - void signalDone(); - void signalTimeout(); - -}; - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_event_list.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_event_list.cpp deleted file mode 100755 index 3cb29a8bd..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_event_list.cpp +++ /dev/null @@ -1,273 +0,0 @@ -#include "tln_event_list.h" -#include "tln_event_list_columns.h" - -#include "ui_tln_event_list.h" -#include "ui_tln_event_list_columns.h" - -#include "tln_event_list_model.h" -#include "tln_show_details.h" - -#include -#include -#include - -#include -#include - -const int MAX_EVENTS = 30; - -namespace Timeline -{ - -EventListDialog::EventListDialog(const QString &menuGroup, - LtsSession::LtsSession *session, - const std::shared_ptr &ppmDtc, - const std::shared_ptr &pdmDtc, - const std::shared_ptr &ismDtc, - const std::shared_ptr &flmIfc, - bool showMarkers, - QWidget *parent) - : LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::CloseOnly) - , m_ui(new Ui::EventListDialog) - , m_columns(nullptr) - , m_model(new EventListDialogModel(ppmDtc, pdmDtc, ismDtc, this)) - , m_detailData(nullptr) - , m_menuGroup(menuGroup) - , m_listEvents(false) - , m_flmIfc(flmIfc) - , m_session(session) -{ - m_ui->setupUi(this); - - if (showMarkers) - { - m_ui->ltsDataView->setModel(m_model); - } - else - { - m_proxyModel = new EventListDialogProxyModel(this); - m_proxyModel->setSourceModel(m_model); - m_ui->ltsDataView->setModel(m_proxyModel); - } - - connect(m_ui->ltsDataView, &LtsDataView::LtsDataView::signalDoubleClicked, - this, &EventListDialog::slotShowSelected); - - connect(m_ui->ltsDataView, &LtsDataView::LtsDataView::signalSelectionChanged, - this, &EventListDialog::slotEnaDisa); - - connect(this, &EventListDialog::signalAddNewEvents, - m_model, &EventListDialogModel::appendEventList); - - m_buttonBox->connectButton(LtsWidgets::DialogButton::Show, this, &EventListDialog::slotShowSelected); - m_buttonBox->connectButton(LtsWidgets::DialogButton::Print, this, &EventListDialog::onPrint); - m_buttonBox->connectButton(LtsWidgets::DialogButton::Load, this, &EventListDialog::onConfigureColumns); - -#ifndef LTS_DEBUG - addConcealedColumns({ EventListDialogModel::Id, EventListDialogModel::AesId, EventListDialogModel::ParticipantId, - EventListDialogModel::DamagePercentOld }); -#endif - - setUnchangeable(); -} - - -EventListDialog::~EventListDialog() -{ - DEBUG_LOG(m_logger) << "~EventListDialog"; - if (m_proxyModel != nullptr) - m_proxyModel->setInvalid(); - m_model->setInvalid(); - delete m_ui; - delete m_columns; -} - - -void EventListDialog::retranslate() -{ - m_buttonBox->getButton(LtsWidgets::DialogButton::Load)->setText(tr("Configuration")); - if (m_listEvents) - translate(m_ui, QString(), false, tr("All Events")); - else - translate(m_ui, QString(), false, tr("%1 Events").arg(m_model->rowCount())); -} - - -bool EventListDialog::init(DetailData *detailData, const LtsTimelineClassic::EventList &eventList, bool listEvents) -{ - m_detailData = detailData; - m_listEvents = listEvents; - - if (m_listEvents) - m_ui->label->setVisible(false); - - if (eventList.isEmpty()) - return false; - - m_model->setData(eventList); - - m_headerState = m_ui->ltsDataView->saveState(); -#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) - m_ui->ltsDataView->treeView()->header()->setFirstSectionMovable(true); - m_ui->ltsDataView->searchView()->header()->setFirstSectionMovable(true); -#endif - - initColumns(); - - return true; -} - - -void EventListDialog::addConcealedColumns(const QVector &concealedColumns) -{ - for (const int id : concealedColumns) - { - m_ui->ltsDataView->hideColumn(id); - if (!m_concealedColumns.contains(id)) - m_concealedColumns += id; - } -} - - -void EventListDialog::initColumns() -{ - const int colCount = m_model->columnCount(); - if (colCount > 0) - { - m_headerColumns.clear(); - QVector columnInfos; - columnInfos.reserve(colCount); - const auto header = m_ui->ltsDataView->searchView()->header(); - - DEBUG_LOG(m_logger) << "concealed count: " << m_concealedColumns.length(); - for (int visualIndex = 0; visualIndex < colCount; ++visualIndex) - { - DEBUG_LOG(m_logger) << visualIndex << " concealed? " << m_concealedColumns.contains(visualIndex); - if (m_concealedColumns.contains(visualIndex)) - continue; - - ColumnInfo ci; - ci.logicalIndex = header->logicalIndex(visualIndex); - ci.visualIndex = visualIndex; - ci.size = header->sectionSize(ci.logicalIndex); - ci.visible = !header->isSectionHidden(ci.logicalIndex); - ci.name = m_model->headerData(ci.logicalIndex, Qt::Orientation::Horizontal, Qt::DisplayRole).toString(); - - DEBUG_LOG(m_logger) << "InitColumns: Adding column " << ci.name << - " with visual index = " << ci.visualIndex << - ", logical index = " << ci.logicalIndex; - - m_headerColumns.insert(ci.name, ci.logicalIndex); - - columnInfos += ci; - } - - m_columns->deleteLater(); - m_columns = new Timeline::EventListColumns(columnInfos, m_flmIfc, this); - - connect(m_columns, &EventListColumns::accepted, - this, &EventListDialog::showColumns); - - showColumns(); - } -} - - -void EventListDialog::clearModel() -{ - m_model->clear(); -} - - -bool EventListDialog::appendEventList(const LtsTimelineClassic::EventList &eventList) -{ - m_model->appendEventList(eventList); - retranslate(); - return true; -} - - -void EventListDialog::slotEnaDisa() -{ - m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Show, (m_ui->ltsDataView->selectedRows().size() > 0)); -} - - -void EventListDialog::slotShowSelected() -{ - const QModelIndexList indexList = m_ui->ltsDataView->selectedRows(); - - if (!m_listEvents && indexList.count() > MAX_EVENTS) - { - LtsWidgets::LtsMessageDialog::showMessage(this, tr("You selected too many events to show (> %1). Please deselect some.").arg(MAX_EVENTS)); - return; - } - - for (const QModelIndex &idx : indexList) - { - const LtsTimelineClassic::Event *event = m_model->eventList().at(idx.row()); - if (event->uniqueId() > 0) - emit signalShowEventDetails(event); - } -} - -void EventListDialog::onPrint() -{ - LtsPrinting::printView(m_session, this, m_ui->ltsDataView->treeView()); -} - -void EventListDialog::onConfigureColumns() -{ - initColumns(); - m_columns->show(); -} - -void EventListDialog::showColumns() -{ - if (!m_columns) - return; - - - const auto columnInfo = m_columns->currentColumnsState(); - - m_ui->ltsDataView->restoreState(m_headerState); - - auto header = m_ui->ltsDataView->searchView()->header(); - for (const auto &ci : columnInfo) - { - int oldVisualIndex = header->visualIndex(ci.logicalIndex); - - DEBUG_LOG(m_logger) << "ShowColumns: Column " << ci.name - << ", colVisible: " << ci.visible - << ", logical index: " << ci.logicalIndex - << ", old index: " << oldVisualIndex - << ", new index: " << ci.visualIndex; - - if (oldVisualIndex != ci.visualIndex) - header->moveSection(oldVisualIndex, ci.visualIndex); - - header->setSectionHidden(ci.logicalIndex, !ci.visible); - if (ci.visible && ci.size > 0) - header->resizeSection(ci.logicalIndex, ci.size); - } -} - -void EventListDialog::reInitEventList(const LtsTimelineClassic::EventList &eventList, qint64 startTime, qint64 endTime) -{ - LtsTimelineClassic::EventList newEventList; - - for (auto i = eventList.constBegin(); i != eventList.constEnd(); ++i) - { - LtsTimelineClassic::Event *e = (*i); - - if (e->startTime() >= startTime && (e->startTime() + e->duration()) <= endTime) - newEventList += e; - } - - DEBUG_LOG(m_logger) << "reInitEventList size = " << eventList.size(); - DEBUG_LOG(m_logger) << "reInitEventList new size = " << newEventList.size(); - m_model->clear(); - m_model->setData(newEventList); -} - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_event_list.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_event_list.h deleted file mode 100755 index a0e1cd37f..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_event_list.h +++ /dev/null @@ -1,84 +0,0 @@ -#pragma once - -#include "logger.h" - -#include -#include -#include -#include -#include -#include -#include - -namespace Ui -{ -class EventListDialog; -} - -namespace LtsTimelineClassic -{ -class EventGraphic; -class Event; -} - - -namespace Timeline -{ -class EventListDialogProxyModel; -class EventListDialogModel; -class DetailData; -class EventListColumns; - -class EventListDialog : public LtsWidgets::LtsDialog -{ - Q_OBJECT - -public: - EventListDialog(const QString &menuGroup, LtsSession::LtsSession *session, - const std::shared_ptr &ppmDtc, - const std::shared_ptr &pdmDtc, - const std::shared_ptr &ismDtc, - const std::shared_ptr &flmIfc, - bool showMarkers = false, - QWidget *parent = nullptr); - ~EventListDialog(); - - bool init(DetailData *detailData, const LtsTimelineClassic::EventList &eventList, bool listEvents); - bool appendEventList(const LtsTimelineClassic::EventList &eventList); - void clearModel(); - void reInitEventList(const LtsTimelineClassic::EventList &eventList, qint64 startTime, qint64 endTime); - -private: - -NGL::INGLLogger &m_logger; - void retranslate() override; - void initColumns(); - void addConcealedColumns(const QVector &concealedColumns); - - Ui::EventListDialog *m_ui; - EventListColumns *m_columns; - EventListDialogModel *m_model; - DetailData *m_detailData; - QHash m_headerColumns; - QByteArray m_headerState; - - QString m_menuGroup; - bool m_listEvents; - std::shared_ptr m_flmIfc; - LtsSession::LtsSession *m_session; - EventListDialogProxyModel *m_proxyModel { nullptr }; - QVector m_concealedColumns; - -signals: - void signalShowEventDetails(const LtsTimelineClassic::Event *event); - void signalAddNewEvents(const QVector &eventList); - -private slots: - void showColumns(); - void slotShowSelected(); - void slotEnaDisa(); - void onPrint(); - void onConfigureColumns(); -}; - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_event_list.ui b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_event_list.ui deleted file mode 100755 index d4db406d2..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_event_list.ui +++ /dev/null @@ -1,46 +0,0 @@ - - - EventListDialog - - - Qt::ApplicationModal - - - - 0 - 0 - 824 - 445 - - - - Exercise Management - - - - - - Selected event contained more than one event: - - - - - - - QAbstractItemView::ExtendedSelection - - - - - - - - LtsDataView::LtsDataView - QWidget -
LtsDataView/lts_data_view.h
- 1 -
-
- - -
diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_event_list_columns.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_event_list_columns.cpp deleted file mode 100755 index 2143f4c81..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_event_list_columns.cpp +++ /dev/null @@ -1,206 +0,0 @@ - - - -#include "tln_event_list_columns.h" -#include -#include "ui_tln_event_list_columns.h" -#include "tln_event_list_model.h" - -#include -#include - -#include -#include -#include - -#include -#include -#include -#include - -namespace Timeline -{ -static inline QString colObjectName(int idx) -{ - return QStringLiteral("Column_") + QString::number(idx); -} - -EventListColumns::EventListColumns(const QVector &columns, - const std::shared_ptr &flmIfc, - QWidget *parent) - : LtsFramelessDialog(parent, LtsWidgets::Behaviour::Modal ) - , m_ui(new Ui::EventListColumns) - , m_flmIfc(flmIfc) - , m_columns(columns) -{ - m_ui->setupUi(this); - - connect(m_ui->pbOk, &QPushButton::clicked, - this, &EventListColumns::accept); - connect(m_ui->pbClose, &QPushButton::clicked, - this, &EventListColumns::reject); - connect(m_ui->pbLoad, &QPushButton::clicked, - this, &EventListColumns::load); - connect(m_ui->pbSave, &QPushButton::clicked, - this, &EventListColumns::save); - - init(); -} - - -EventListColumns::~EventListColumns() -{ - delete m_ui; -} - -QVector EventListColumns::currentColumnsState() const -{ - const auto children = m_ui->itemLayoutWidget->findChildren(); - QVector result; - result.reserve(children.size()); - for (const EventListColumn *elc : children) - result.push_back(elc->columnInfo()); - std::sort(result.begin(), result.end(), - [](const ColumnInfo &a, const ColumnInfo &b) - { - return a.visualIndex < b.visualIndex; - }); - return result; -} - - -void EventListColumns::init() -{ - qDeleteAll(m_ui->itemLayoutWidget->findChildren()); - - - for (const auto &ci : std::as_const(m_columns)) - { - EventListColumn *rtcItem = new EventListColumn(ci); - rtcItem->setObjectName(colObjectName(ci.logicalIndex)); - m_ui->itemLayoutWidget->layout()->addWidget(rtcItem); - } - - m_ui->lblConfiguration->setText(tr("No configuration file loaded")); -} - -bool EventListColumns::load() -{ - bool ret = false; - QByteArray content; - int fileId = m_flmIfc->loadFileContent(this, content, {FileManagement::FileType::Xml}, 0, FileManagement::toString(FileManagement::XmlType::TLNEventListConfiguration)); - if (fileId > 0) - { - if (!m_flmIfc->isXmlType(content, FileManagement::toString(FileManagement::XmlType::TLNEventListConfiguration))) - { - QHash texts({{LtsWidgets::Button::Yes, tr("Ok")}}); - LtsWidgets::LtsMessageDialog::showMessage(this, - tr("Invalid xml file content"), - windowTitle(), - LtsWidgets::Behaviour::Modal, - LtsWidgets::Button::Yes, - texts); - } - else - { - const QJsonDocument doc(QJsonDocument::fromJson(content)); - const QJsonObject obj(doc.object()); - const QJsonArray elcCols(obj.value(QStringLiteral("Columns")).toArray()); - - loadColumns(elcCols); - - ret = true; - } - } - - if (ret) - { - QString fileName = m_flmIfc->getFileName(fileId); - m_ui->lblConfiguration->setText(tr("Configuration file: %1").arg(fileName)); - LtsWidgets::LtsMessageDialog::showMessage(this, tr("Successfully loaded configuration file")); - } - else - { - m_ui->lblConfiguration->setText(tr("No configuration file loaded")); - LtsWidgets::LtsMessageDialog::showMessage(this, tr("Could not load configuration file")); - } - return ret; -} - -void EventListColumns::loadColumns(const QJsonArray &cols) -{ - qDeleteAll(m_ui->itemLayoutWidget->findChildren()); - - Timeline::ColumnInfo ci; - for (const auto &val : cols) - { - const QJsonObject obj = val.toObject(); - ci.logicalIndex = obj.value(QStringLiteral("logicalIndex")).toInt(); - ci.visualIndex = obj.value(QStringLiteral("visualIndex")).toInt(); - ci.name = obj.value(QStringLiteral("name")).toString(); - ci.size = obj.value(QStringLiteral("size")).toInt(); - ci.visible = obj.value(QStringLiteral("visible")).toBool(); - const QString objName = colObjectName(ci.logicalIndex); - - EventListColumn *elc = m_ui->itemLayoutWidget->findChild(objName); - if (elc) - { - - ERROR_LOG(m_logger) << "Modifed Column: " << ci.visualIndex - << ", " << ci.logicalIndex << ", " << ci.name - << ", " << ci.visible << ", " << objName; - elc->setChecked(ci.visible); - } - else - { - ERROR_LOG(m_logger) << "New Column: " << ci.visualIndex - << ", " << ci.logicalIndex << ", " << ci.name - << ", " << ci.visible << ", " << objName; - elc = new EventListColumn(ci); - elc->setObjectName(objName); - m_ui->itemLayoutWidget->layout()->addWidget(elc); - } - } -} - -bool EventListColumns::save() -{ - int fileId = m_flmIfc->saveFileContent(this, FileManagement::FileType::Xml, 0, columnsToDoc(exportColumns())); - if (fileId > 0) - DEBUG_LOG(m_logger) << "Saved file with id = " << fileId; - else - ERROR_LOG(m_logger) << "Could not save file in library "; - return (fileId > 0); -} - -const QByteArray EventListColumns::columnsToDoc(const QJsonArray &cols) -{ - QJsonObject obj; - obj[QStringLiteral("XmlType")] = FileManagement::toString(FileManagement::XmlType::TLNEventListConfiguration); - obj[QStringLiteral("Columns")] = cols; - - QJsonDocument doc(obj); - return doc.toJson(QJsonDocument::Compact); -} - -const QJsonArray EventListColumns::exportColumns() const -{ - QJsonArray result = QJsonArray(); - const auto children = m_ui->itemLayoutWidget->findChildren(); - for (const EventListColumn *elc : children) - { - const auto &ci = elc->columnInfo(); - DEBUG_LOG(m_logger) << "Saving column: " << ci.visualIndex << ", " << elc->text() << ", " << elc->isChecked(); - QJsonObject elcObj; - elcObj[QStringLiteral("visualIndex")] = ci.visualIndex; - elcObj[QStringLiteral("logicalIndex")] = ci.logicalIndex; - elcObj[QStringLiteral("name")] = ci.name; - elcObj[QStringLiteral("size")] = ci.size; - elcObj[QStringLiteral("visible")] = ci.visible; - result.append(elcObj); - } - return result; -} - - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_event_list_columns.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_event_list_columns.h deleted file mode 100755 index d66825fbd..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_event_list_columns.h +++ /dev/null @@ -1,84 +0,0 @@ - - - -#pragma once - -#include -#include - -#include "logger.h" - -#include - -namespace Ui -{ -class EventListColumns; -} - -class QAbstractItemModel; - -namespace Timeline -{ - -struct ColumnInfo -{ - QString name; - int logicalIndex = 0; - int visualIndex = 0; - int size = 0; - bool visible = false; -}; - -class EventListColumn : public QCheckBox -{ - Q_OBJECT -public: - explicit EventListColumn(const ColumnInfo &ci) - : QCheckBox(ci.name) - , m_ci(ci) - { - setChecked(ci.visible); - connect(this, &EventListColumn::clicked, - this, [this]() { m_ci.visible = isChecked(); }); - } - const ColumnInfo &columnInfo() const { return m_ci; } - -private: - -NGL::INGLLogger &m_logger; - ColumnInfo m_ci; -}; - - - -class EventListColumns : public LtsWidgets::LtsFramelessDialog -{ - Q_OBJECT - -public: - - - EventListColumns(const QVector &columns, - const std::shared_ptr &flmIfc, - QWidget *parent = nullptr); - ~EventListColumns(); - - QVector currentColumnsState() const; -public slots: - bool save(); - bool load(); - -private: - const QJsonArray exportColumns() const; - void init(); - - const QByteArray columnsToDoc(const QJsonArray &cols); - void loadColumns(const QJsonArray &cols); - -private: - QString m_fileLoaded; - Ui::EventListColumns *m_ui; - std::shared_ptr m_flmIfc; - QVector m_columns; -}; -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_event_list_columns.ui b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_event_list_columns.ui deleted file mode 100755 index 7020cda29..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_event_list_columns.ui +++ /dev/null @@ -1,217 +0,0 @@ - - - EventListColumns - - - - 0 - 0 - 368 - 234 - - - - - 0 - 0 - - - - true - - - - - - - 12 - - - - Columns: - - - Qt::AlignCenter - - - - - - - - 75 - true - - - - - - - - - - - - 0 - 1 - - - - - 16777215 - 1 - - - - QFrame::StyledPanel - - - QFrame::Sunken - - - 3 - - - - - - - true - - - - 0 - 0 - - - - Qt::NoFocus - - - QFrame::NoFrame - - - Qt::ScrollBarAlwaysOff - - - QAbstractScrollArea::AdjustToContents - - - true - - - Qt::AlignCenter - - - - - 0 - 0 - 356 - 96 - - - - - 0 - 0 - - - - - 800 - 800 - - - - Qt::NoFocus - - - - 0 - - - QLayout::SetMinAndMaxSize - - - 0 - - - 0 - - - 100 - - - 0 - - - - - - - - - - 0 - 1 - - - - - 16777215 - 1 - - - - QFrame::StyledPanel - - - QFrame::Sunken - - - 3 - - - - - - - - - Save - - - - - - - Load - - - - - - - Ok - - - - - - - Close - - - - - - - - - pbSave - pbClose - - - - diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_event_list_model.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_event_list_model.cpp deleted file mode 100755 index fb1c4ac26..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_event_list_model.cpp +++ /dev/null @@ -1,243 +0,0 @@ -#include "tln_event_list_model.h" -#include "detail_data.h" - -#include -#include -#include -#include - -#include -#include - - -namespace Timeline -{ - -EventListDialogModel::EventListDialogModel(const std::shared_ptr &ppmDtc, - const std::shared_ptr &pdmDtc, - const std::shared_ptr &ismDtc, - QObject *parent) - : LtsWidgets::LtsAbstractTableModel({tr("Id"), - tr("Type"), - tr("Time"), - tr("Duration [s]", "Dauer in Sekunden"), - tr("Party"), - tr("Equipment Number"), - tr("Hierarchy"), - tr("Participant Id"), - tr("Aes Name"), - tr("Aes Type"), - - - tr("Building"), - tr("Charge Type"), - tr("Charge Remain"), - - tr("Damage Percent"), - tr("Damage Percent Old"), - - tr("Friendly Fire"), - tr("Gear Type"), - tr("Stream Name"), - tr("Vulnerability State")}, - parent) - , m_ppmDtc(ppmDtc) - , m_pdmDtc(pdmDtc) - , m_ismDtc(ismDtc) -{} - - -QVariant EventListDialogModel::data(const QModelIndex &index, int role) const -{ - if (role != Qt::DisplayRole || !indexIsValid(index) || m_invalid) - return QVariant(); - - LtsTimelineClassic::Event *event = m_vecData.at(index.row()); - - const QJsonObject &obj = event->detailData(); - - - - - switch (index.column()) - { - case EventListDialogModel::Columns::Id: - return event->uniqueId(); - case EventListDialogModel::Columns::Type: - { - if (event->typeId() == markerTypeId ) - return tr("Marker"); - - return ProjectDataManagement::toString(static_cast(event->typeId())); - } - case EventListDialogModel::Columns::Time: - return QDateTime::fromMSecsSinceEpoch(event->startTime()); - case EventListDialogModel::Columns::Duration: - return (event->duration() / 1000); - case EventListDialogModel::Columns::Party: - { - if (event->typeId() == ProjectDataManagement::PdmEventType::HitBuilding) - break; - return ParticipantManagement::trPartyName(m_ppmDtc->party(event->partyId()).name()); - } - case EventListDialogModel::Columns::EquipNo: - { - if (event->typeId() == ProjectDataManagement::PdmEventType::HitBuilding) - break; - return event->equipmentId(); - } - case EventListDialogModel::Columns::Hierarchy: - return m_ppmDtc->hierarchyFromParticipant(event->playerId()); - case EventListDialogModel::Columns::ParticipantId: - return event->playerId(); - - - case EventListDialogModel::AesType: - { - const auto ele = obj.value(QLatin1String("AesType")); - if (!ele.isDouble()) - return QVariant(); - const int aesTypeId = ele.toInt(); - return AreaEffectSimulation::toString(static_cast(aesTypeId)); - } - case EventListDialogModel::AesId: - { - const auto ele = obj.value(QLatin1String("AesName")); - if (ele.isString()) - return ele.toString(); - const auto ele2 = obj.value(QLatin1String("AesId")); - return ele2.isDouble() ? QVariant(ele.toInt()) : QVariant(); - } - - - case EventListDialogModel::Building: - { - const auto ele = obj.value(QLatin1String("MainStructureElementId")); - if (!ele.isDouble()) - return QVariant(); - int buildingId = ele.toInt(); - if (buildingId > 0) - return m_ismDtc->getBuildingDisplayName(buildingId); - return QVariant(); - } - - case EventListDialogModel::ChargeType: - { - int chargeTypeId = obj.value(QLatin1String("OriginatorChargeTypeId")).toInt(); - if (chargeTypeId <= 0) - chargeTypeId = obj.value(QLatin1String("ChargeTypeId")).toInt(); - if (chargeTypeId <= 0) - return QVariant(); - return m_pdmDtc->trChargeTypeShortName(chargeTypeId); - } - case EventListDialogModel::ChargeRemain: - { - const auto ele = obj.value(QLatin1String("Remain")); - if (!ele.isDouble()) - return QVariant(); - return ele.toInt(); - } - case EventListDialogModel::DamagePercent: - { - const auto ele = obj.value(QLatin1String("damagePercent")); - if (!ele.isDouble()) - return QVariant(); - return ele.toInt(); - } - case EventListDialogModel::DamagePercentOld: - { - const auto ele = obj.value(QLatin1String("damagePercentOld")); - if (!ele.isDouble()) - return QVariant(); - return ele.toInt(); - } - case EventListDialogModel::FriendlyFire: - { - const auto ele = obj.value(QLatin1String("FriendlyFire")); - if (!ele.isBool()) - return QVariant(); - return ele.toBool(); - } - case EventListDialogModel::GearType: - { - int gearTypeId = obj.value(QLatin1String("GearTypeId")).toInt(); - if (gearTypeId <= 0) - return QVariant(); - return m_pdmDtc->trGearTypeName(gearTypeId); - } - case EventListDialogModel::StreamName: - { - const auto ele = obj.value(QLatin1String("streamName")); - if (!ele.isString()) - return QVariant(); - return ele.toString(); - } - case EventListDialogModel::VulnerabilityState: - { - const auto ele = obj.value(QLatin1String("VulnerabilityState")); - if (!ele.isDouble()) - return QVariant(); - const int vId = ele.toInt(); - return ProjectDataManagement::toString(static_cast(vId)); - } - default: - break; - } - - return QVariant(); -} - -void EventListDialogModel::appendEventList(const QVector &eventList) -{ - for (const auto &event : eventList) - { - if (!m_vecData.contains(event)) - insertRow(event); - } -} - - - - -void EventListDialogProxyModel::setSourceModel(QAbstractItemModel *sourceModel) -{ - m_sourceModel = qobject_cast(sourceModel); - LtsWidgets::LtsColumnFilterProxyModel::setSourceModel(sourceModel); -} - -bool EventListDialogProxyModel::lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const -{ - if (!m_sourceModel || - source_left.column() != source_right.column() || - !source_left.isValid() || - !source_right.isValid() || - m_invalid) - return LtsWidgets::LtsColumnFilterProxyModel::lessThan(source_left, source_right); - const auto &dataLeft = m_sourceModel->m_vecData.at(source_left.row()); - const auto dataRight = m_sourceModel->m_vecData.at(source_right.row()); - switch (source_left.column()) - { - case EventListDialogModel::Time: - return dataLeft->startTime() < dataRight->startTime(); - case EventListDialogModel::EquipNo: - return dataLeft->equipmentId() < dataRight->equipmentId(); - default: - break; - } - return LtsWidgets::LtsColumnFilterProxyModel::lessThan(source_left, source_right); -} - - -bool EventListDialogProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const -{ - if (!m_sourceModel || source_parent.isValid() || source_row < 0 || source_row >= m_sourceModel->rowCount() || m_invalid) - return LtsWidgets::LtsColumnFilterProxyModel::filterAcceptsRow(source_row, source_parent); - - LtsTimelineClassic::Event *event = m_sourceModel->m_vecData.at(source_row); - if (event->typeId() == markerTypeId) - return false; - return LtsWidgets::LtsColumnFilterProxyModel::filterAcceptsRow(source_row, source_parent); -} - - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_event_list_model.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_event_list_model.h deleted file mode 100755 index 17f53be02..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_event_list_model.h +++ /dev/null @@ -1,86 +0,0 @@ -#pragma once - - -#include -#include -#include -#include -#include -#include - -namespace Timeline -{ - -class EventListDialogModel final : public LtsWidgets::LtsAbstractTableModel -{ - Q_OBJECT - -public: - enum Columns - { - Id, - Type, - Time, - Duration, - Party, - EquipNo, - Hierarchy, - ParticipantId, - AesId, - AesType, - - - Building, - ChargeType, - ChargeRemain, - - DamagePercent, - DamagePercentOld, - - FriendlyFire, - GearType, - - StreamName, - VulnerabilityState, - Count - }; - - explicit EventListDialogModel(const std::shared_ptr &ppmDtc, - const std::shared_ptr &pdmDtc, - const std::shared_ptr &ismDtc, - QObject *parent = nullptr); - - const QVector &eventList() const { return m_vecData; } - - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; - void setInvalid() { m_invalid = true; } - -public slots: - void appendEventList(const QVector &eventList); - -private: - -NGL::INGLLogger &m_logger; - std::shared_ptr m_ppmDtc; - std::shared_ptr m_pdmDtc; - std::shared_ptr m_ismDtc; - bool m_invalid = false; - friend class EventListDialogProxyModel; -}; - -class EventListDialogProxyModel final : public LtsWidgets::LtsColumnFilterProxyModel -{ - Q_OBJECT -public: - using LtsWidgets::LtsColumnFilterProxyModel::LtsColumnFilterProxyModel; - void setSourceModel(QAbstractItemModel *sourceModel) override; - void setInvalid() { m_invalid = true; } -protected: - bool lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const override; - bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override; -private: - EventListDialogModel *m_sourceModel = nullptr; - bool m_invalid = false; -}; - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_legend.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_legend.cpp deleted file mode 100755 index 1ce3b9c10..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_legend.cpp +++ /dev/null @@ -1,319 +0,0 @@ - - - -#include "tln_legend.h" -#include "ui_tln_legend.h" -#include "detail_data.h" -#include "tln_dialog_model.h" - -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -namespace Timeline -{ - -TimelineLegendDialog::TimelineLegendDialog(QWidget *parent) - : LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::OkApplyCancel) - , m_ui(new Ui::TimelineLegendDialog) -{ - m_ui->setupUi(this); - - m_buttonBox->getButton(LtsWidgets::DialogButton::Ok)->hide(); - - connect(m_ui->cbCheckAll, &QCheckBox::toggled, - this, [this](bool toggled) - { - const auto cbList = findChildren(); - for (QCheckBox *cb : cbList) - { - if (cb == m_ui->cbCheckAll) - continue; - - cb->setChecked(toggled); - } - }); -} - - -TimelineLegendDialog::~TimelineLegendDialog() -{ - delete m_ui; -} - - -void TimelineLegendDialog::retranslate() -{ - translate(m_ui, tr("Timeline Legend")); -} - - -void TimelineLegendDialog::setActiveEventTypeIds(const QSet &activeEventTypeIds) -{ - setUnchangeable(); - - - const QList cbs(findChildren()); - - for (QCheckBox *cb : cbs) - cb->setChecked(false); - - for (int activeEventType : activeEventTypeIds) - { - QCheckBox *cb = checkBox(activeEventType); - - if (cb != nullptr) - cb->setChecked(true); - else - WARNING_LOG(m_logger) << "cb for event type " << activeEventType << " not found!"; - } - - setUnchangeable(false); -} - -QVector TimelineLegendDialog::possibleEvents() -{ - QVector ret - ({ - - ProjectDataManagement::PdmEventType::Hit, - ProjectDataManagement::PdmEventType::WeaponAssignment, - ProjectDataManagement::PdmEventType::BiteMessage, - ProjectDataManagement::PdmEventType::FireEvent, - ProjectDataManagement::PdmEventType::HitBuilding, - ProjectDataManagement::PdmEventType::Manipulation, - ProjectDataManagement::PdmEventType::CameraVideo, - ProjectDataManagement::PdmEventType::RadioCnr, - ProjectDataManagement::PdmEventType::RadioTvc, - ProjectDataManagement::PdmEventType::HitEffectSimulation, - - - - - - - - ProjectDataManagement::PdmEventType::CrossLocalBorderline, - - - - - ProjectDataManagement::PdmEventType::CrossGlobalBorderline, - - - - - - - - - - - - - - - }); - - LtsUtils::ProjectSettings *ps = LtsUtils::ProjectSettings::getInstance(); - - if (ps->value(QStringLiteral("tln"), - QStringLiteral("showEffectSimulationEvents")).toBool()) - { - ret += ProjectDataManagement::PdmEventType::MineArea; - ret += ProjectDataManagement::PdmEventType::DangerArea; - ret += ProjectDataManagement::PdmEventType::FunctionalArea; - ret += ProjectDataManagement::PdmEventType::MineCorridor; - ret += ProjectDataManagement::PdmEventType::Borderline; - if (ps->value(QStringLiteral("aes"), - QStringLiteral("enableNuclearContaminations")).toBool()) - ret += ProjectDataManagement::PdmEventType::NContamination; - if (ps->value(QStringLiteral("aes"), - QStringLiteral("enableNuclearContaminations")).toBool() || - ps->value(QStringLiteral("aes"), - QStringLiteral("enableNuclearContaminations")).toBool()) - ret += ProjectDataManagement::PdmEventType::BCContamination; - } - - - if (ps->value(QStringLiteral("tln"), - QStringLiteral("showEnterLeaveEvents")).toBool()) - { - ret += ProjectDataManagement::PdmEventType::EnterDangerArea; - ret += ProjectDataManagement::PdmEventType::LeaveDangerArea; - ret += ProjectDataManagement::PdmEventType::EnterMineArea; - ret += ProjectDataManagement::PdmEventType::LeaveMineArea; - ret += ProjectDataManagement::PdmEventType::EnterFunctionalArea; - ret += ProjectDataManagement::PdmEventType::LeaveFunctionalArea; - - if (ps->value(QStringLiteral("aes"), - QStringLiteral("enableNuclearContaminations")).toBool()) - { - ret += ProjectDataManagement::PdmEventType::EnterNuclear; - ret += ProjectDataManagement::PdmEventType::LeaveNuclear; - } - } - - - if (ps->value(QStringLiteral("aes"), - QStringLiteral("enableGasPipes")).toBool()) - { - ret += ProjectDataManagement::PdmEventType::GasPipe; - - } - - const bool showPvSan = LtsUtils::ProjectSettings::isFunctionEnabled(QStringLiteral("ParticipantInformation"), - QStringLiteral("HasPvSan")); - if (showPvSan) - ret += ProjectDataManagement::PdmEventType::Sanitation; - - return ret; -} - - -static int categoryFromEventType(ProjectDataManagement::PdmEventType et) -{ - switch (et.underlying()) - { - case ProjectDataManagement::PdmEventType::Unknown: - return 0; - case ProjectDataManagement::PdmEventType::Hit: - case ProjectDataManagement::PdmEventType::WeaponAssignment: - case ProjectDataManagement::PdmEventType::BiteMessage: - case ProjectDataManagement::PdmEventType::FireEvent: - case ProjectDataManagement::PdmEventType::FriendlyFire: - case ProjectDataManagement::PdmEventType::Manipulation: - return 1; - case ProjectDataManagement::PdmEventType::CameraVideo: - case ProjectDataManagement::PdmEventType::RadioCnr: - case ProjectDataManagement::PdmEventType::RadioTvc: - return 5; - case ProjectDataManagement::PdmEventType::HitBuilding: - case ProjectDataManagement::PdmEventType::HitEffectSimulation: - case ProjectDataManagement::PdmEventType::HitMine: - case ProjectDataManagement::PdmEventType::HitN: - case ProjectDataManagement::PdmEventType::HitB: - case ProjectDataManagement::PdmEventType::HitC: - case ProjectDataManagement::PdmEventType::HitGasPipe: - return 2; - case ProjectDataManagement::PdmEventType::EnterDangerArea: - case ProjectDataManagement::PdmEventType::LeaveDangerArea: - case ProjectDataManagement::PdmEventType::EnterMineArea: - case ProjectDataManagement::PdmEventType::LeaveMineArea: - case ProjectDataManagement::PdmEventType::CrossLocalBorderline: - case ProjectDataManagement::PdmEventType::EnterFunctionalArea: - case ProjectDataManagement::PdmEventType::LeaveFunctionalArea: - case ProjectDataManagement::PdmEventType::EnterNuclear: - case ProjectDataManagement::PdmEventType::LeaveNuclear: - case ProjectDataManagement::PdmEventType::CrossGlobalBorderline: - case ProjectDataManagement::PdmEventType::Sanitation: - return 3; - case ProjectDataManagement::PdmEventType::MineArea: - case ProjectDataManagement::PdmEventType::NContamination: - case ProjectDataManagement::PdmEventType::BCContamination: - case ProjectDataManagement::PdmEventType::DangerArea: - case ProjectDataManagement::PdmEventType::FunctionalArea: - case ProjectDataManagement::PdmEventType::MineCorridor: - case ProjectDataManagement::PdmEventType::Borderline: - case ProjectDataManagement::PdmEventType::GasPipe: - return 6; - case ProjectDataManagement::PdmEventType::TechnicalArea: - case ProjectDataManagement::PdmEventType::EquipmentErrorReport: - case ProjectDataManagement::PdmEventType::EmergencyCall: - return 0; - } - Q_ASSERT(false); - return 0; -} - -bool TimelineLegendDialog::init(DDSTimelineModel *model, const QSet &activeEventTypeIds) -{ - struct WidgetSortHelper - { - QLabel *lbl = nullptr; - QCheckBox *cbx = nullptr; - ProjectDataManagement::PdmEventType et = ProjectDataManagement::PdmEventType::Unknown; - }; - QImage p(16, 24, QImage::Format_ARGB32); - QColor c; - LtsTimelineClassic::Event::EventPaintFunc paintFunc; - WidgetSortHelper wsh; - - const auto events = possibleEvents(); - std::vector helperCont; - helperCont.reserve(events.size()); - for (const ProjectDataManagement::PdmEventType eventType : events) - { - model->setColorPaintFun(paintFunc, c, eventType.underlying()); - - if (paintFunc == nullptr) - { - WARNING_LOG(m_logger) << "No draw function for event " << eventType; - Q_ASSERT(false); - continue; - } - - p.fill(Qt::transparent); - QPainter pp(&p); - pp.setRenderHint(QPainter::Antialiasing); - pp.setBrush(QBrush(c)); - paintFunc(&pp, p.rect().adjusted(0, 0, -1, -1)); - - wsh.lbl = new QLabel(this); - wsh.lbl->setPixmap(QPixmap::fromImage(p)); - - wsh.et = eventType; - wsh.cbx = new QCheckBox(ProjectDataManagement::toString(eventType), this); - wsh.cbx->setObjectName(checkBoxName(eventType)); - wsh.cbx->setChecked(activeEventTypeIds.contains(eventType.underlying())); - wsh.cbx->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); - - helperCont.push_back(wsh); - } - - std::sort(helperCont.begin(), helperCont.end(), [](const WidgetSortHelper &a, const WidgetSortHelper &b) - { - const auto et1 = categoryFromEventType(a.et); - const auto et2 = categoryFromEventType(b.et); - if (et1 != et2) - return et1 < et2; - return a.cbx->text() < b.cbx->text(); - }); - - int curGridRow = 1; - for (const auto &ele : helperCont) - { - m_ui->gridLayout->addWidget(ele.lbl, curGridRow, 0); - m_ui->gridLayout->addWidget(ele.cbx, curGridRow, 1); - m_ui->gridLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding), curGridRow, 2); - ++curGridRow; - } - m_ui->gridLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding), curGridRow, 0); - - return true; -} - - -bool TimelineLegendDialog::apply() -{ - QSet activeEventTypeIds; - const auto events = possibleEvents(); - for (const ProjectDataManagement::PdmEventType eventType : events) - { - if (checkBox(eventType)->isChecked()) - activeEventTypeIds.insert(eventType.underlying()); - } - emit signalEventTypesChanged(activeEventTypeIds); - return false; -} - -} - - diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_legend.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_legend.h deleted file mode 100755 index e8c98a6a9..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_legend.h +++ /dev/null @@ -1,51 +0,0 @@ - - - -#pragma once - -#include -#include -#include "logger.h" - -namespace Ui -{ -class TimelineLegendDialog; -} - - -namespace Timeline -{ -class DDSTimelineModel; - - -class TimelineLegendDialog : public LtsWidgets::LtsDialog -{ - Q_OBJECT - -public: - explicit TimelineLegendDialog(QWidget *parent = nullptr); - ~TimelineLegendDialog(); - - bool apply() override; - bool init(DDSTimelineModel *model, const QSet &activeEventTypeIds); - void setActiveEventTypeIds(const QSet &activeEventTypeIds); - - static QVector possibleEvents(); -signals: - void signalEventTypesChanged(const QSet &activeEventTypeIds); - -private: - -NGL::INGLLogger &m_logger; - void retranslate() override; - - static QString checkBoxName(int eventTypeId) { return QStringLiteral("CheckBoxEvent%1").arg(eventTypeId); } - static QString checkBoxName(ProjectDataManagement::PdmEventType eventType) { return checkBoxName(eventType.underlying()); } - QCheckBox *checkBox(int eventTypeId) { return findChild(checkBoxName(eventTypeId)); } - QCheckBox *checkBox(ProjectDataManagement::PdmEventType eventType) { return checkBox(eventType.underlying()); } - -private: - Ui::TimelineLegendDialog *m_ui; -}; - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_legend.ui b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_legend.ui deleted file mode 100755 index 973686935..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_legend.ui +++ /dev/null @@ -1,53 +0,0 @@ - - - TimelineLegendDialog - - - Timeline View - - - - - - - - Check all - - - - - - - Qt::Horizontal - - - QSizePolicy::Minimum - - - - 0 - 20 - - - - - - - - Qt::Horizontal - - - - 0 - 20 - - - - - - - - - - - diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_show_details.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_show_details.cpp deleted file mode 100755 index 7e22dc624..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_show_details.cpp +++ /dev/null @@ -1,504 +0,0 @@ - - - -#include "tln_show_details.h" -#include "ui_tln_show_details.h" -#include "tln_view_gui_plugin.h" -#include "detail_data.h" -#include "logger.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - - - - - -namespace Timeline -{ - -ShowDetailsDialog::ShowDetailsDialog(QWidget *parent) - : LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::CloseOnly) - , m_ui(new Ui::ShowDetailsDialog) -{ - m_ui->setupUi(this); - setUnchangeable(); - - m_ui->debugWidget->hide(); - - connect(m_ui->pbStartReplay, &QPushButton::clicked, - this, &ShowDetailsDialog::slotStartReplay); - - connect(m_ui->pbShowMarker, &QPushButton::clicked, - this, &ShowDetailsDialog::slotShowMarker); - - connect(m_ui->pbPlayback, &QPushButton::clicked, - this, &ShowDetailsDialog::slotStartPlayback); - - connect(m_ui->pbFocus, &QPushButton::clicked, - this, &ShowDetailsDialog::slotFocusOnMap); - - m_ui->tbFocus->hide(); - m_ui->tbMarker->hide(); - m_ui->tbPlayback->hide(); - m_ui->tbReplay->hide(); - -#ifndef LTS_DEBUG - if (LtsSessionData::LtsSessionData::getInstance()->debugFlagValue(QStringLiteral("Timeline.Debug")) == QVariant(true)) -#endif - { - m_ui->debugWidget->show(); - } -} - - -ShowDetailsDialog::~ShowDetailsDialog() -{ - m_session = nullptr; - m_mrkDtc = nullptr; - delete m_ui; -} - - -void ShowDetailsDialog::retranslate() -{ - translate(m_ui, m_eventType, false, tr("Event")); -} - - -void ShowDetailsDialog::slotFocusOnMap() -{ - if (m_replayAppSession == nullptr) - { - WARNING_LOG(m_logger) << "ShowDetailsDialog::init: no replay app, no focus"; - return; - } - - std::shared_ptr sitMapIfc; - - if (!m_replayAppSession->getForeignGuiInterface(sitMapIfc)) - { - WARNING_LOG(m_logger) << "no sitMapIfc, no focusing on replay in Show Details Dialog 1"; - return; - } - - if (!sitMapIfc) - { - WARNING_LOG(m_logger) << "no sitMapIfc, no focusing on replay in Show Details Dialog 2"; - return; - } - - if (m_event->typeId() != markerTypeId) - { - if (!m_event->positionValid()) - { - WARNING_LOG(m_logger) << "event has no valid position, skip focusOnMap"; - return; - } - - - sitMapIfc->setCenterPoint(m_event->pos2d()); - } - - const QJsonObject root(m_event->detailData()); - const QJsonValue mapSettings(root[QStringLiteral("MapSettings")]); - - if (!mapSettings.isUndefined()) - sitMapIfc->setOperatorMapSettings(mapSettings); - - const QJsonValue filterSettings(root[QStringLiteral("Filter")]); - if (!filterSettings.isUndefined()) - { - MarkerManagement::MarkerManagementApplyFilter applyFilter(m_replayAppSession, m_fltParticipantIfc, m_fltAesIfc, m_fltBuildingComponentIfc); - if (!applyFilter.applyFilter(filterSettings.toObject())) - { - WARNING_LOG(m_logger) << "filters from event #"<uniqueId()<<" could not be applied"; - return; - } - } -} - - -void ShowDetailsDialog::slotShowMarker() -{ - m_mrkIfc->showMarker(m_event->uniqueId()); -} - - -bool ShowDetailsDialog::hasNameAndEndTime() const -{ - QString dummy1; - qint64 dummy2; - return getStreamNameAndEndTime(dummy1, dummy2, true); -} - - -bool ShowDetailsDialog::getStreamNameAndEndTime(QString &streamName, qint64 &endTime, bool silent) const -{ - const QJsonObject root(m_event->detailData()); - const QString _streamName = root[QStringLiteral("streamName")].toString(); - - if (_streamName.isEmpty()) - { - if (!silent) - ERROR_LOG(m_logger) << "ShowDetailsDialog::slotStartVideo(): stream name is empty " << QJsonDocument(m_event->detailData()).toJson(); - return false; - } - - qint64 _endTime = root[QStringLiteral("endTime")].toDouble(0); - - if (_endTime == 0 && !silent) - WARNING_LOG(m_logger) << "ShowDetailsDialog::slotStartPlayback: event " << m_event->uniqueId() << " has no end time!"; - - streamName = _streamName; - endTime = _endTime; - return true; -} - - -void ShowDetailsDialog::slotStartPlayback() -{ - QString streamName; - qint64 endTime; - - if (!getStreamNameAndEndTime(streamName, endTime)) - { - LtsWidgets::LtsMessageDialog::showMessage(this, tr("Cannot start playback as this event's informations are missing.")); - return; - } - - const bool isAudio = isAudioEventType(m_event->typeId()); - if (!m_avmIfc->startAudioVideoPlayback(streamName, m_event->startTime(), isAudio)) - new LtsWidgets::LtsMessageDialogNew(this, tr("Playback cannot be started because of an error. Please try again later.")); -} - - -void ShowDetailsDialog::slotStartReplay() -{ - if (m_replayAppSession == nullptr) - { - ERROR_LOG(m_logger) << "ShowDetailsDialog::slotStartReplay: no replay app, no replay"; - return; - } - - std::shared_ptr srpIfc; - - if (!m_replayAppSession->getForeignGuiInterface(srpIfc)) - { - ERROR_LOG(m_logger) << "ShowDetailsDialog::slotStartReplay: no srp, no replay in Show Details Dialog"; - return; - } - - srpIfc->startReplay(m_event->startTime() - (10 * 1000) ); - slotFocusOnMap(); -} - - -void ShowDetailsDialog::setButtonDisabled(QPushButton *button, QToolButton *warningButton, const QString &reasonMessage, bool hide) -{ - if (hide) - button->setVisible(false); - button->setEnabled(false); - button->setToolTip(reasonMessage); - warningButton->setToolTip(reasonMessage); - warningButton->show(); - - connect(warningButton, &QToolButton::clicked, - warningButton, [this, warningButton]() - { - LtsWidgets::LtsMessageDialog::showMessage(this, warningButton->toolTip()); - }); -} - - - -bool ShowDetailsDialog::isMarkerAudioVideo() const -{ - const QJsonObject root(m_event->detailData()); - - return (root[QStringLiteral("IsAudioType")].toBool(false) || root[QStringLiteral("IsVideoType")].toBool(false)); -} - - - -bool ShowDetailsDialog::isAvsCapable(const LtsTimelineClassic::Event *event) -{ - const int eventType = event->typeId(); - return isAvEventType(eventType) || eventType == Timeline::markerTypeId; -} - - -bool ShowDetailsDialog::isHitEventType(int eventTypeId) -{ - return (eventTypeId == ProjectDataManagement::PdmEventType_def::Hit || - eventTypeId == ProjectDataManagement::PdmEventType_def::HitB || - eventTypeId == ProjectDataManagement::PdmEventType_def::HitBuilding || - eventTypeId == ProjectDataManagement::PdmEventType_def::HitC || - eventTypeId == ProjectDataManagement::PdmEventType_def::HitGasPipe || - eventTypeId == ProjectDataManagement::PdmEventType_def::HitEffectSimulation || - eventTypeId == ProjectDataManagement::PdmEventType_def::HitMine || - eventTypeId == ProjectDataManagement::PdmEventType_def::HitN); -} - - -bool ShowDetailsDialog::isAvEventType(int eventTypeId) -{ - return (isAudioEventType(eventTypeId) || - eventTypeId == ProjectDataManagement::PdmEventType_def::CameraVideo); -} - - -bool ShowDetailsDialog::isAudioEventType(int eventTypeId) -{ - return (eventTypeId == ProjectDataManagement::PdmEventType_def::RadioCnr || - eventTypeId == ProjectDataManagement::PdmEventType_def::RadioTvc); -} - - -bool ShowDetailsDialog::init(DetailData *detailData, const LtsTimelineClassic::Event *event, - const QPointer &session, - const QPointer &replayAppSession, - const std::shared_ptr &avmIfc, - const std::shared_ptr &mrkIfc, - const std::shared_ptr &fltParticipantIfc, - const std::shared_ptr &fltAesIfc, - const std::shared_ptr &fltBuildingComponentIfc, - bool isTimelineApp, - QWidget *pseudoParent, - AudioVideoManagement::StreamNameMapping *streamNameMapping) -{ - m_session = session; - - - - - std::shared_ptr srpIfc; - std::shared_ptr sitMapIfc; - if (!m_session->getDtc(m_mrkDtc)) - WARNING_LOG(m_logger) << "!m_session->getDtc(m_mrkDtc)"; - - m_mrkDtc->enableMarker(); - - connect(m_mrkDtc.get(), &MarkerManagement::Interface::Dtc::markerChanged, - this, &ShowDetailsDialog::updateMarker); - - - if (replayAppSession != nullptr) - { - m_replayAppSession = replayAppSession; - - connect(replayAppSession.data(), &LtsSession::LtsSession::destroyed, - this, [this]() - { - setButtonDisabled(m_ui->pbFocus, m_ui->tbFocus, tr("No map available.")); - setButtonDisabled(m_ui->pbStartReplay, m_ui->tbReplay, tr("Situation Replay App not started.")); - }); - - if (!replayAppSession->getForeignGuiInterface(srpIfc)) - WARNING_LOG(m_logger) << "ShowDetailsDialog::init: no srp, no replay in Show Details Dialog"; - - if (!replayAppSession->getForeignGuiInterface(sitMapIfc)) - WARNING_LOG(m_logger) << "ShowDetailsDialog::init: no sitMapIfc, no focusing on replay in Show Details Dialog"; - } - - m_avmIfc = avmIfc; - m_mrkIfc = mrkIfc; - m_fltParticipantIfc = fltParticipantIfc; - m_fltAesIfc = fltAesIfc; - m_fltBuildingComponentIfc = fltBuildingComponentIfc; - m_streamNameMapping = streamNameMapping; - - if (m_avmIfc == nullptr) - WARNING_LOG(m_logger) << "ShowDetailsDialog::init: no avm ifc given"; - - if (m_mrkIfc == nullptr) - WARNING_LOG(m_logger) << "ShowDetailsDialog::init: no mrk ifc given"; - - if (m_fltParticipantIfc == nullptr) - WARNING_LOG(m_logger) << "ShowDetailsDialog::init: no flt Part ifc given"; - - if (m_fltAesIfc == nullptr) - WARNING_LOG(m_logger) << "ShowDetailsDialog::init: no flt Aes ifc given"; - - if (m_fltBuildingComponentIfc == nullptr) - WARNING_LOG(m_logger) << "ShowDetailsDialog::init: no flt buildingComponent ifc given"; - - if (m_streamNameMapping == nullptr) - WARNING_LOG(m_logger) << "ShowDetailsDialog::init: no stream name mapping given"; - - m_event = event; - int eventTypeId = event->typeId(); - - - if (event->equipmentId() <= 0) - { - m_ui->lblEquipNo->hide(); - m_ui->lblValueEquipNo->hide(); - } - else - m_ui->lblValueEquipNo->setText(QString::number(event->equipmentId())); - - connect(pseudoParent, &QWidget::destroyed, this, &ShowDetailsDialog::deleteLater); - - QString eventTime; - - if (m_logger.isDebugEnabled()) - eventTime = QStringLiteral("%1 (%2)").arg(DTG::toStringMSec(event->startTime())).arg(event->startTime()); - else - eventTime = DTG::toStringMSec(event->startTime()); - - m_ui->lblValueEventTime->setText(eventTime); - m_eventType = detailData->eventTypeLookup.getEventText(eventTypeId); - - if (m_eventType.isEmpty()) - m_eventType = tr(" (%1)").arg(eventTypeId); - - if (sitMapIfc == nullptr || isTimelineApp) - setButtonDisabled(m_ui->pbFocus, m_ui->tbFocus, tr("No map available"), true); - else if (eventTypeId != markerTypeId && !m_event->positionValid()) - setButtonDisabled(m_ui->pbFocus, m_ui->tbFocus, tr("Event has an invalid position and cannot be focused")); - - if (srpIfc == nullptr) - setButtonDisabled(m_ui->pbStartReplay, m_ui->tbReplay, tr("Situation Replay App not started.")); - else if (sitMapIfc == nullptr) - setButtonDisabled(m_ui->pbStartReplay, m_ui->tbReplay, tr("This app has no map to focus this event on.")); - else if (eventTypeId != markerTypeId && !m_event->positionValid()) - setButtonDisabled(m_ui->pbStartReplay, m_ui->tbReplay, tr("Event has an invalid position, cannot be focused and therefore has no replay capability.")); - - if (eventTypeId != markerTypeId) - setButtonDisabled(m_ui->pbShowMarker, m_ui->tbMarker, tr("This event is not a marker."), true); - else if (m_mrkIfc == nullptr) - setButtonDisabled(m_ui->pbShowMarker, m_ui->tbMarker, tr("This app has no marker interface available."), true); - - if (!isAvsCapable(event)) - setButtonDisabled(m_ui->pbPlayback, m_ui->tbPlayback, tr("This event is not an audio/video type."), true); - else if (m_avmIfc == nullptr) - setButtonDisabled(m_ui->pbPlayback, m_ui->tbPlayback, tr("This app has no audio/video interface available."), true); - else if (eventTypeId == Timeline::markerTypeId && !isMarkerAudioVideo()) - setButtonDisabled(m_ui->pbPlayback, m_ui->tbPlayback, tr("This marker event is not an audio / video type."), true); - else if (!hasNameAndEndTime()) - setButtonDisabled(m_ui->pbPlayback, m_ui->tbPlayback, tr("This event has missing informations about the playback.")); - - - - if (isAvsCapable(event)) - { - m_ui->pbFocus->hide(); - m_ui->tbFocus->hide(); - m_ui->pbStartReplay->hide(); - m_ui->tbReplay->hide(); - } - - const DetailData::GetDetailDataResultList result = detailData->getDetailData(event); - QLocale locale; - - for (const DetailData::GetDetailDataForAttributeResult &attributeDetail : result) - { - - if (detailData->attributeInterpreterLookup.getInterpreterType(attributeDetail.attributeTypeId) == DetailData::INTERPRETER_TYPE_TIME) - continue; - - QString attributeTypeText; - QString attributeValueText; - - if (attributeDetail.requestResult != DetailData::RequestResult::Okay) - { - if (attributeDetail.requestResult == DetailData::RequestResult::NoValueTranslationForAttribute) - { - attributeTypeText = attributeDetail.attributeType; - attributeValueText = QStringLiteral("%1 (%2)").arg(tr("")).arg(attributeDetail.attributeValueId); - } - else if (attributeDetail.requestResult == DetailData::RequestResult::InvalidAttributeType) - { - - DEBUG_LOG(m_logger) << "Unhandled attribute " << attributeDetail.attributeTypeId << " - skipping"; - continue; - } - else - { - attributeTypeText = QStringLiteral("%1 (%2)").arg(tr(""), attributeDetail.attributeTypeId); - attributeValueText = tr(""); - - WARNING_LOG(m_logger) << "getDetailData failed with message id " << (int)attributeDetail.requestResult << " for attribute " << attributeDetail.attributeTypeId; - continue; - } - } - else - { - attributeTypeText = attributeDetail.attributeType; - - - bool isNumber = false; - qint64 attributeValueAsNumber = attributeValueText.toLongLong(&isNumber); - if (isNumber) - attributeValueText = locale.toString(attributeValueAsNumber); - - if (m_logger.isDebugEnabled()) - attributeValueText = QStringLiteral("%1 (%2)").arg(attributeDetail.attributeValue).arg(attributeDetail.attributeValueId); - else - attributeValueText = attributeDetail.attributeValue; - } - - - - QString attributeType(attributeDetail.attributeTypeId); - - - int eventType = event->typeId(); - if (isAudioEventType(eventType)) - { - if (attributeType == QStringLiteral("MainStructureElementId")) - continue; - } - else if (isHitEventType(eventType)) - { - if (attributeType == QStringLiteral("OriginatorType")) - continue; - } - - if (attributeType == QStringLiteral("GearId")) - continue; - - - - - QLabel *attributeValueTextLabel = new QLabel(attributeValueText); - DEBUG_LOG(m_logger) << "attributeValueText=" << attributeValueText; - attributeValueTextLabel->setTextInteractionFlags(attributeValueTextLabel->textInteractionFlags() | Qt::TextInteractionFlag::TextSelectableByMouse); - DEBUG_LOG(m_logger) << "attributeTypeText=" << attributeTypeText - << " attributeValueTextLabel=" << attributeValueTextLabel; - m_ui->formLayout->addRow(new QLabel(attributeTypeText), attributeValueTextLabel); - } - - if (m_eventType.isEmpty()) - m_eventType = QStringLiteral("%1 (%2)").arg(tr(""), ProjectDataManagement::toString(static_cast(event->typeId()))); - m_ui->lblEventType->setText(QStringLiteral("%1").arg(m_eventType)); - - m_ui->pteDetailDataTest->setPlainText(QString::fromUtf8(QJsonDocument(event->detailData()).toJson())); - - QString pos(QStringLiteral("x: %1 - y: %2 - z: %3").arg(m_event->position().x()).arg(m_event->position().y()).arg(m_event->position().z())); - m_ui->lblPos->setText(pos); - - return true; -} - -void ShowDetailsDialog::updateMarker() -{ - DEBUG_LOG(m_logger) << "ShowDetailsDialog::updateMarker"; -} - - - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_show_details.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_show_details.h deleted file mode 100755 index 760feadfe..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_show_details.h +++ /dev/null @@ -1,91 +0,0 @@ - - - -#pragma once - -#include "tln_view_gui_plugin.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -namespace Ui -{ -class ShowDetailsDialog; -} - -namespace AudioVideoManagement -{ -class StreamNameMapping; -} - -namespace Timeline -{ -class DetailData; - -class ShowDetailsDialog : public LtsWidgets::LtsDialog -{ - Q_OBJECT - -public: - explicit ShowDetailsDialog(QWidget *parent = nullptr); - ~ShowDetailsDialog(); - - bool init(DetailData *detailData, const LtsTimelineClassic::Event *event, - const QPointer &session, - const QPointer &replayAppSession, - const std::shared_ptr &avmIfc, - const std::shared_ptr &mrkIfc, - const std::shared_ptr &fltParticipantIfc, - const std::shared_ptr &fltAesIfc, - const std::shared_ptr &fltBuildingComponentIfc, - bool isTimelineApp, - QWidget *pseudoParent, - AudioVideoManagement::StreamNameMapping *streamNameMapping); - - void retranslate() override; - -private slots: - void slotStartReplay(); - void slotStartPlayback(); - void slotShowMarker(); - void slotFocusOnMap(); - void updateMarker(); - -private: - -NGL::INGLLogger &m_logger; - bool hasNameAndEndTime() const; - bool getStreamNameAndEndTime(QString &streamName, qint64 &endTime, bool silent = false) const; - void setButtonDisabled(QPushButton *button, QToolButton *warningButton, const QString &reasonMessage, bool hide = false); - bool isMarkerAudioVideo() const; - static bool isAvsCapable(const LtsTimelineClassic::Event *event); - static bool isHitEventType(int eventTypeId); - static bool isAvEventType(int eventTypeId); - static bool isAudioEventType(int eventTypeId); - - QString m_eventType; - Ui::ShowDetailsDialog *m_ui{nullptr}; - const LtsTimelineClassic::Event *m_event{nullptr}; - - - QPointer m_replayAppSession; - - - std::shared_ptr m_avmIfc; - std::shared_ptr m_mrkIfc; - std::shared_ptr m_fltParticipantIfc; - std::shared_ptr m_fltAesIfc; - std::shared_ptr m_fltBuildingComponentIfc; - AudioVideoManagement::StreamNameMapping *m_streamNameMapping{nullptr}; - std::shared_ptr m_mrkDtc; - LtsSession::LtsSessionDataDds *m_session{nullptr}; -}; -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_show_details.ui b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_show_details.ui deleted file mode 100755 index 352e78270..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_show_details.ui +++ /dev/null @@ -1,304 +0,0 @@ - - - ShowDetailsDialog - - - Qt::ApplicationModal - - - - 0 - 0 - 366 - 451 - - - - Exercise Management - - - - - - <Event Type> - - - - - - - Qt::Horizontal - - - - - - - - - Folder Name - - - Equip. No.: - - - - - - - Event Time: - - - - - - - ... - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse - - - - - - - ... - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse - - - - - - - - - - 24 - 24 - - - - - 24 - 24 - - - - - - - - :/style/warning.svg:/style/warning.svg - - - - 24 - 24 - - - - - - - - <html><head/><body><p>Plays the audio and/or video clip assoociated to the event in the replay application, in a audio/video dialog.</p></body></html> - - - Start Playback - - - - - - - - - - - - 24 - 24 - - - - - 24 - 24 - - - - - - - - :/style/warning.svg:/style/warning.svg - - - - 24 - 24 - - - - - - - - Focus on map - - - - - - - - - - - - 24 - 24 - - - - - 24 - 24 - - - - - - - - :/style/warning.svg:/style/warning.svg - - - - 24 - 24 - - - - - - - - <html><head/><body><p>Sets the replay application back to the time the event occured and focuses the event on the map. </p></body></html> - - - Start Replay - - - - - - - - - - - - 24 - 24 - - - - - 24 - 24 - - - - - - - - :/style/warning.svg:/style/warning.svg - - - - 24 - 24 - - - - - - - - Show Marker - - - - - - - - - - - - - - <font color='#aebac6'>Debug:</font> - - - - - - - - - Position: - - - - - - - - - - - - - - - - - - 0 - 0 - - - - true - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_view_gui_plugin.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_view_gui_plugin.cpp deleted file mode 100755 index 3da4cae81..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_view_gui_plugin.cpp +++ /dev/null @@ -1,160 +0,0 @@ - - - -#include "EventFilter/FilterWindow.h" -#include "tln_view_gui_plugin.h" -#include "tln_dialog.h" -#include "logger.h" - -#include - -#include -#include -#include - -#include - -namespace Timeline -{ - -std::shared_ptr GuiPlugin::createGuiInterface(LtsSession::LtsSession *session) -{ - return std::make_shared(session); -} - -InterfaceImpl::InterfaceImpl(LtsSession::LtsSession *session) - : GuiPluginBase::Interface(session, getLogger("View")) -{} - - -bool InterfaceImpl::fetchInterfaces() -{ - if (!m_session->getForeignDataInterface(m_eemForeign)) - return false; - if (!m_session->getDtc(m_mrkDtc)) - return false; - if (!m_session->getDtc(m_exmDtc)) - return false; - if (!m_session->getDtc(m_ppmDtc)) - return false; - if (!m_session->getForeignGuiInterface(m_flmIfc)) - return false; - if (!m_session->getForeignGuiInterface(m_ppmInfoIfc)) - return false; - if (!m_session->getDtc(m_pdmDtc)) - return false; - - - - if (!m_session->getForeignDataInterface_NEW(m_avmDataIfc)) - WARNING_LOG(m_logger) << "no avm data ifc, no stream name mapping"; - if (!m_session->getForeignDataInterface(m_srmDataIfc)) - WARNING_LOG(m_logger) << "no srm data ifc, no situation replay app"; - if (!m_session->getDtc(m_coreDtc)) - WARNING_LOG(m_logger) << "no core dtc, no situation replay app"; - if (!m_session->getForeignGuiInterface(m_avmIfc)) - WARNING_LOG(m_logger) << "Timeline Gui Plugin: no avm ifc"; - if (!m_session->getForeignGuiInterface(m_mrkIfc)) - WARNING_LOG(m_logger) << "Timeline Gui Plugin: no mrk ifc"; - if (!m_session->getForeignGuiInterface(m_fltParticipantIfc)) - WARNING_LOG(m_logger) << "Timeline Gui Plugin: no flt Part ifc"; - if (!m_session->getForeignGuiInterface(m_fltAesIfc)) - WARNING_LOG(m_logger) << "Timeline Gui Plugin: no flt Aes ifc"; - if (!m_session->getForeignGuiInterface(m_fltBuildingComponentIfc)) - WARNING_LOG(m_logger) << "Timeline Gui Plugin: no flt BuildingComponent ifc"; - - return true; -} - - -void InterfaceImpl::clearInterfaces() -{ - m_eemForeign = nullptr; - m_mrkDtc = nullptr; - m_exmDtc = nullptr; - m_ppmDtc = nullptr; - m_flmIfc = nullptr; - m_ppmInfoIfc = nullptr; - m_srmDataIfc = nullptr; - m_coreDtc = nullptr; - m_avmIfc = nullptr; - m_mrkIfc = nullptr; - m_avmDataIfc = nullptr; - m_pdmDtc = nullptr; - - m_fltParticipantIfc = nullptr; - m_fltAesIfc = nullptr; - m_fltBuildingComponentIfc = nullptr; -} - - -QVector InterfaceImpl::getActions() -{ - QVector ret; - - { - LtsWidgets::PluginData plData; - plData.menuGroup = menuGroup(); - plData.menuText = tr("Timeline"); - plData.identifier = QLatin1String("tlnView"); - plData.exercisePart = LtsWidgets::ExercisePart::eExecution; - plData.menuIcon = QIcon(QLatin1String("icon:timeline.svg")); - - if (getFlags().testFlag(LtsAppDescriptor::PluginInfo::Flag::MAIN)) - { - plData.layoutArea = LtsWidgets::LayoutArea::eMainTab; - plData.createInstant = LtsWidgets::CreateInstantType::CreateInstantAndDiscardAction; - - plData.createWidgetFunc = [this](QWidget *) - { - return onShowTimelineViewDialog(true); - }; - } - else - { - plData.layoutArea = LtsWidgets::LayoutArea::eDialogTab; - - plData.createWidgetFunc = [this](QWidget *) - { - return onShowTimelineViewDialog(false); - }; - } - - ret.append(plData); - } - - return ret; -} - - -QString InterfaceImpl::menuGroup() const -{ - return tr("Timeline"); -} - - -LtsWidgets::LtsDialog *InterfaceImpl::onShowTimelineViewDialog(bool isMain) -{ - std::shared_ptr ismDtc; - if (!m_session->getDtc(ismDtc)) - { - new LtsWidgets::LtsMessageDialogNew(m_session->baseLayoutWidget(), tr("The Infrastructure Management is not available!"), tr("Cannot open Timeline")); - return nullptr; - } - - - LtsWidgets::ButtonCombination buttonCombo = LtsWidgets::ButtonCombination::CloseOnly; - - AudioVideoManagement::StreamNameMapping *streamNameMapping = nullptr; - - if (m_avmDataIfc) - streamNameMapping = m_avmDataIfc->streamNameMapping(); - - return LtsWidgets::initDialog(new TimelineViewDialog(menuGroup(), buttonCombo, isMain, nullptr), - m_eemForeign, m_mrkDtc, m_exmDtc, m_flmIfc, m_ppmDtc, - m_ppmInfoIfc, m_avmIfc, m_mrkIfc,m_srmDataIfc, m_coreDtc, - m_pdmDtc, ismDtc, m_fltParticipantIfc, m_fltAesIfc, m_fltBuildingComponentIfc, m_session, - streamNameMapping); -} - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_view_gui_plugin.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_view_gui_plugin.h deleted file mode 100755 index 290c8039b..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/Timeline/Gui/EventTimelineClassic/tln_view_gui_plugin.h +++ /dev/null @@ -1,87 +0,0 @@ - - - -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -namespace Timeline -{ - -class GuiPlugin final : public QObject, public GuiPluginBase::Plugin -{ - Q_PLUGIN_METADATA(IID "gui:3:tln.view") - Q_INTERFACES(GuiPluginBase::Plugin) - - Q_OBJECT - -public: - explicit GuiPlugin() = default; - ~GuiPlugin() = default; - - QString pluginName() override { return QLatin1String("TimelineGuiPlugin"); } - std::shared_ptr createGuiInterface(LtsSession::LtsSession *session) override; - bool availableInPartition(IDL::PartitionType partition) const override - { - return partition == IDL::PartitionType::Exercise || partition == IDL::PartitionType::Replay; - } -}; - -class InterfaceImpl final : public QObject, public GuiPluginBase::Interface -{ - Q_OBJECT - -public: - explicit InterfaceImpl(LtsSession::LtsSession *session); - - QVector getActions() override; - QString menuGroup() const override; - bool availableInPartition(IDL::PartitionType partition) const override { return partition == IDL::PartitionType::Exercise || partition == IDL::PartitionType::Replay; } - bool fetchInterfaces() override; - void clearInterfaces() override; - -private: - LtsWidgets::LtsDialog *onShowTimelineViewDialog(bool isMain); - - - std::shared_ptr m_coreDtc; - std::shared_ptr m_exmDtc; - std::shared_ptr m_mrkDtc; - std::shared_ptr m_ppmDtc; - std::shared_ptr m_pdmDtc; - - std::shared_ptr m_avmDataIfc; - - - std::shared_ptr m_eemForeign; - std::shared_ptr m_flmIfc; - std::shared_ptr m_ppmInfoIfc; - std::shared_ptr m_avmIfc; - std::shared_ptr m_mrkIfc; - std::shared_ptr m_srmDataIfc; - std::shared_ptr m_fltParticipantIfc; - std::shared_ptr m_fltAesIfc; - std::shared_ptr m_fltBuildingComponentIfc; -}; - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/Skeleton.Stage1/CMakeLists.txt b/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/Skeleton.Stage1/CMakeLists.txt deleted file mode 100755 index 80cdf4f6f..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/Skeleton.Stage1/CMakeLists.txt +++ /dev/null @@ -1,18 +0,0 @@ -# -# $Id$ -# $HeadURL$ -# $Author$ -# - -#ADD_SUBDIRECTORY(Data) - -# -# Data Plugin Interface -# -NGL_ADD_LIBRARY2(WS sklDataPluginInterface SHARED skl_data_plugin_interface.h) -NGL_TARGET_LINK_LIBRARIES(sklDataPluginInterface - Qt6::Core - clientPluginInterface -) - -NGL_INSTALL_TARGET(sklDataPluginInterface) diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/Skeleton.Stage1/skl_data_plugin_interface.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/Skeleton.Stage1/skl_data_plugin_interface.h deleted file mode 100755 index 35a20edef..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/Skeleton.Stage1/skl_data_plugin_interface.h +++ /dev/null @@ -1,24 +0,0 @@ - - - -#pragma once - -#include - -#include - -namespace Skeleton -{ - - - -class DataInterface : public DataPluginBase::Interface -{ -public: - DataInterface(LtsSession::LtsSession *session, NGL::INGLLogger &logger) - : DataPluginBase::Interface(session, logger) - {} - virtual ~DataInterface() = default; -}; - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/Skeleton.Stage2/CMakeLists.txt b/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/Skeleton.Stage2/CMakeLists.txt deleted file mode 100755 index f6aeced24..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/Skeleton.Stage2/CMakeLists.txt +++ /dev/null @@ -1,18 +0,0 @@ -# -# $Id$ -# $HeadURL$ -# $Author$ -# - -ADD_SUBDIRECTORY(Data) - -# -# Data Plugin Interface -# -NGL_ADD_LIBRARY2(WS sklDataPluginInterface SHARED skl_data_plugin_interface.h) -NGL_TARGET_LINK_LIBRARIES(sklDataPluginInterface - Qt6::Core - clientPluginInterface -) - -NGL_INSTALL_TARGET(sklDataPluginInterface) diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/Skeleton.Stage2/Data/CMakeLists.txt b/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/Skeleton.Stage2/Data/CMakeLists.txt deleted file mode 100755 index 7e0da3d4a..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/Skeleton.Stage2/Data/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -# -# $Id$ -# $HeadURL: svn://slssvn/TDS/branches/product/devel/trunk/Lts/Plugins/AdvancedSymbology/CMakeLists.txt -# $Author$ -# Created by Mike Wille, SLSE, 2016-09-05 -# - -# -# Data Plugin -# -NGL_ADD_LIBRARY(WS sklDataPlugin MODULE skl_data_plugin.cpp skl_data_plugin.h) -NGL_TARGET_LINK_LIBRARIES(sklDataPlugin - Qt6::Core - sklDataPluginInterface - NGLLogger - LtsSession -) - -NGL_INSTALL_TARGET(sklDataPlugin) diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/Skeleton.Stage2/Data/skl_data_plugin.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/Skeleton.Stage2/Data/skl_data_plugin.cpp deleted file mode 100755 index 1dc24f6fd..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/Skeleton.Stage2/Data/skl_data_plugin.cpp +++ /dev/null @@ -1,70 +0,0 @@ - - - -#include "skl_data_plugin.h" - -#include -#include - - -#include -#include - - -namespace Skeleton -{ - -std::shared_ptr DataPlugin::createDataInterface(LtsSession::LtsSession *session) -{ - - std::shared_ptr dtc; - if (!session->createTopicClient(dtc, pluginName())) - return std::shared_ptr(); - - - std::shared_ptr ftc; - if (!session->createTopicClient(ftc, pluginName())) - return std::shared_ptr(); - ftc->enableAll(); - - return std::make_shared(session); -} - - -DataInterfaceImpl::DataInterfaceImpl( - const std::shared_ptr &dtc, - - , const std::shared_ptr &ftc - - , LtsSession::LtsSession *session) - : DataInterface(session, - - getLogger("Plugins.Data.Skl") - - NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("Plugins.Data.Skl") - ) - - , m_dtc(dtc) - - , m_ftc(ftc) - - , m_foreignInterface(std::make_shared &dtc - - , const std::shared_ptr &ftc - ) - - : m_dtc(dtc) - - , m_ftc(ftc) -{ - -} - - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/Skeleton.Stage2/Data/skl_data_plugin.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/Skeleton.Stage2/Data/skl_data_plugin.h deleted file mode 100755 index 6bfffc44f..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/Skeleton.Stage2/Data/skl_data_plugin.h +++ /dev/null @@ -1,78 +0,0 @@ - - - -#pragma once - -#include -#include - -namespace Skeleton -{ - -class DataPlugin final : public QObject, public DataPluginBase::Plugin -{ - Q_PLUGIN_METADATA(IID "data:3:skl") - - Q_OBJECT -public: - DataPlugin() = default; - ~DataPlugin() = default; - - QString pluginName() const override { return QStringLiteral("Skeleton"); } - std::shared_ptr createDataInterface(LtsSession::LtsSession *session) override; -}; - -class DataInterfaceImpl final : public DataInterface -{ -public: - explicit DataInterfaceImpl( - const std::shared_ptr &dtc, - - const std::shared_ptr &ftc, - - LtsSession::LtsSession *session); - - - std::shared_ptr getDtc() override { return m_dtc; } - - std::shared_ptr getFtc() override { return m_ftc; } - - std::shared_ptr getForeignInterface() override { return m_foreignInterface; } - -private: - - std::shared_ptr m_dtc; - - std::shared_ptr m_ftc; - - std::shared_ptr m_foreignInterface; - -}; - - - -class ForeignInterfaceImpl final : public ForeignInterface -{ - Q_OBJECT -public: - explicit ForeignInterfaceImpl( - const std::shared_ptr &dtc - - const std::shared_ptr &ftc - ); - - - examples examples() override final { return m_dtc->examples(); } - - - - -private: - - std::shared_ptr m_dtc; - - std::shared_ptr m_ftc; -}; - - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/Skeleton.Stage2/skl_data_plugin_interface.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/Skeleton.Stage2/skl_data_plugin_interface.h deleted file mode 100755 index 35a20edef..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/Skeleton.Stage2/skl_data_plugin_interface.h +++ /dev/null @@ -1,24 +0,0 @@ - - - -#pragma once - -#include - -#include - -namespace Skeleton -{ - - - -class DataInterface : public DataPluginBase::Interface -{ -public: - DataInterface(LtsSession::LtsSession *session, NGL::INGLLogger &logger) - : DataPluginBase::Interface(session, logger) - {} - virtual ~DataInterface() = default; -}; - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/Skeleton.Stage3/CMakeLists.txt b/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/Skeleton.Stage3/CMakeLists.txt deleted file mode 100755 index f6aeced24..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/Skeleton.Stage3/CMakeLists.txt +++ /dev/null @@ -1,18 +0,0 @@ -# -# $Id$ -# $HeadURL$ -# $Author$ -# - -ADD_SUBDIRECTORY(Data) - -# -# Data Plugin Interface -# -NGL_ADD_LIBRARY2(WS sklDataPluginInterface SHARED skl_data_plugin_interface.h) -NGL_TARGET_LINK_LIBRARIES(sklDataPluginInterface - Qt6::Core - clientPluginInterface -) - -NGL_INSTALL_TARGET(sklDataPluginInterface) diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/Skeleton.Stage3/Data/CMakeLists.txt b/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/Skeleton.Stage3/Data/CMakeLists.txt deleted file mode 100755 index 7e0da3d4a..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/Skeleton.Stage3/Data/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -# -# $Id$ -# $HeadURL: svn://slssvn/TDS/branches/product/devel/trunk/Lts/Plugins/AdvancedSymbology/CMakeLists.txt -# $Author$ -# Created by Mike Wille, SLSE, 2016-09-05 -# - -# -# Data Plugin -# -NGL_ADD_LIBRARY(WS sklDataPlugin MODULE skl_data_plugin.cpp skl_data_plugin.h) -NGL_TARGET_LINK_LIBRARIES(sklDataPlugin - Qt6::Core - sklDataPluginInterface - NGLLogger - LtsSession -) - -NGL_INSTALL_TARGET(sklDataPlugin) diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/Skeleton.Stage3/Data/skl_data_plugin.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/Skeleton.Stage3/Data/skl_data_plugin.cpp deleted file mode 100755 index b9143610d..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/Skeleton.Stage3/Data/skl_data_plugin.cpp +++ /dev/null @@ -1,71 +0,0 @@ - - - -#include "skl_data_plugin.h" - -#include -#include - - -#include -#include - - -namespace Skeleton -{ - -std::shared_ptr DataPlugin::createDataInterface(LtsSession::LtsSession *session) -{ - - std::shared_ptr dtc; - if (!session->createTopicClient(dtc, pluginName())) - return std::shared_ptr(); - - - std::shared_ptr ftc; - if (!session->createTopicClient(ftc, pluginName())) - return std::shared_ptr(); - - ftc->enableAll(); - - return std::make_shared(session); -} - - -DataInterfaceImpl::DataInterfaceImpl( - const std::shared_ptr &dtc, - - , const std::shared_ptr &ftc - - , LtsSession::LtsSession *session) - : DataInterface(session, - - getLogger("Plugins.Data.Skl") - - NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("Plugins.Data.Skl") - ) - - , m_dtc(dtc) - - , m_ftc(ftc) - - , m_foreignInterface(std::make_shared &dtc - - , const std::shared_ptr &ftc - ) - - : m_dtc(dtc) - - , m_ftc(ftc) -{ - -} - - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/Skeleton.Stage3/Data/skl_data_plugin.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/Skeleton.Stage3/Data/skl_data_plugin.h deleted file mode 100755 index 6bfffc44f..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/Skeleton.Stage3/Data/skl_data_plugin.h +++ /dev/null @@ -1,78 +0,0 @@ - - - -#pragma once - -#include -#include - -namespace Skeleton -{ - -class DataPlugin final : public QObject, public DataPluginBase::Plugin -{ - Q_PLUGIN_METADATA(IID "data:3:skl") - - Q_OBJECT -public: - DataPlugin() = default; - ~DataPlugin() = default; - - QString pluginName() const override { return QStringLiteral("Skeleton"); } - std::shared_ptr createDataInterface(LtsSession::LtsSession *session) override; -}; - -class DataInterfaceImpl final : public DataInterface -{ -public: - explicit DataInterfaceImpl( - const std::shared_ptr &dtc, - - const std::shared_ptr &ftc, - - LtsSession::LtsSession *session); - - - std::shared_ptr getDtc() override { return m_dtc; } - - std::shared_ptr getFtc() override { return m_ftc; } - - std::shared_ptr getForeignInterface() override { return m_foreignInterface; } - -private: - - std::shared_ptr m_dtc; - - std::shared_ptr m_ftc; - - std::shared_ptr m_foreignInterface; - -}; - - - -class ForeignInterfaceImpl final : public ForeignInterface -{ - Q_OBJECT -public: - explicit ForeignInterfaceImpl( - const std::shared_ptr &dtc - - const std::shared_ptr &ftc - ); - - - examples examples() override final { return m_dtc->examples(); } - - - - -private: - - std::shared_ptr m_dtc; - - std::shared_ptr m_ftc; -}; - - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/Skeleton.Stage3/Gui/CMakeLists.txt b/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/Skeleton.Stage3/Gui/CMakeLists.txt deleted file mode 100755 index 636fbcd52..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/Skeleton.Stage3/Gui/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -# -# $Id$ -# $HeadURL$ -# $Author$ -# -# Created by NAME, SLSE, YYYY-MM-DD -# - -#ADD_SUBDIRECTORY(YOUR_GUI_PLUGIN) diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/Skeleton.Stage3/Gui/YOUR_GUI_PLUGIN/CMakeLists.txt b/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/Skeleton.Stage3/Gui/YOUR_GUI_PLUGIN/CMakeLists.txt deleted file mode 100755 index c60920e78..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/Skeleton.Stage3/Gui/YOUR_GUI_PLUGIN/CMakeLists.txt +++ /dev/null @@ -1,50 +0,0 @@ -# -# $Id$ -# $HeadURL$ -# $Author$ -# -# Created by NAME, SLSE, YYYY-MM-DD -# - -# Make ${Qt6_Widgets} optional -if(QT6_GUI_AVAILABLE AND TARGET Qt6::Widgets) - set(Qt6_Widgets ${Qt6_Widgets}) -else() - set(Qt6_Widgets "") -endif() - - -SET(skl_YOUR_GUI_PLUGIN_gui_SRCS - skl_YOUR_GUI_PLUGIN_gui_plugin.cpp - skl_YOUR_GUI_PLUGIN_gui_plugin.h -) - -QT5_WRAP_UI(skl_YOUR_GUI_PLUGIN_gui_SRCS - -) - -NGL_ADD_LIBRARY(WS exmEditGuiPlugin MODULE ${exm_edit_gui_SRCS}) -if(QT6_GUI_AVAILABLE) - NGL_TARGET_LINK_LIBRARIES(exmEditGuiPlugin - NGLLogger - svcAsmClient - svcExmClient - svcPdmClient - LtsSession - DataPluginInterface - #pdmDataPluginInterface - #asmDataPluginInterface - #exmDataPluginInterface - #exmGuiPluginInterface - GuiPluginInterface - ${Qt6_Widgets} - LtsWidgets - LtsDataView - zwmsuiel - LtsUtilsGuiDds - ) -endif() - -NGL_INSTALL_TARGET(exmEditGuiPlugin) - - diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/Skeleton.Stage3/Gui/YOUR_GUI_PLUGIN/skl_YOUR_GUI_PLUGIN_gui_plugin.cpp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/Skeleton.Stage3/Gui/YOUR_GUI_PLUGIN/skl_YOUR_GUI_PLUGIN_gui_plugin.cpp deleted file mode 100755 index cc9dd798a..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/Skeleton.Stage3/Gui/YOUR_GUI_PLUGIN/skl_YOUR_GUI_PLUGIN_gui_plugin.cpp +++ /dev/null @@ -1,51 +0,0 @@ - - - -#include "skl_YOUR_GUI_PLUGIN_gui_plugin.h" - -#include - - -#include - - -#include - - -namespace Skeleton -{ - -std::shared_ptr GuiPlugin::createGuiInterface(LtsSession::LtsSession *session) -{ - return std::make_shared(session); -} - - -InterfaceImpl::InterfaceImpl(LtsSession::LtsSession *session) - : GuiPluginBase::Interface(session, getLogger("Plugins.Gui.Skl.YOUR_GUI_PLUGIN")) - - , m_dtc(nullptr) - - - , m_ftc(nullptr) - - -{} - - -bool InterfaceImpl::fetchInterfaces() -{ - - if (!m_session->getDtc(m_dtc)) - return false; - - - if (!m_session->getFtc(m_ftc)) - return false; - - - - return true; -} - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/Skeleton.Stage3/Gui/YOUR_GUI_PLUGIN/skl_YOUR_GUI_PLUGIN_gui_plugin.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/Skeleton.Stage3/Gui/YOUR_GUI_PLUGIN/skl_YOUR_GUI_PLUGIN_gui_plugin.h deleted file mode 100755 index 5f9a06b63..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/Skeleton.Stage3/Gui/YOUR_GUI_PLUGIN/skl_YOUR_GUI_PLUGIN_gui_plugin.h +++ /dev/null @@ -1,61 +0,0 @@ - - - -#pragma once - - -#include - -#include -#include - - -#include - -#include - - - - -namespace Skeleton -{ - -class GuiPlugin final : public QObject, public GuiPluginBase::Plugin -{ - Q_PLUGIN_METADATA(IID "gui:3:skl") - Q_INTERFACES(GuiPluginBase::Plugin) - - Q_OBJECT -public: - explicit GuiPlugin() = default; - ~GuiPlugin() = default; - - QString pluginName() override { return ForeignGuiInterface::pluginName(); } - std::shared_ptr createGuiInterface(LtsSession::LtsSession *session) override; -}; - -class InterfaceImpl final : public QObject, public GuiPluginBase::Interface -{ - Q_OBJECT -public: - explicit InterfaceImpl(LtsSession::LtsSession *session); - - QString pluginName() override { return ForeignGuiInterface::pluginName(); } - - - bool fetchInterfaces() override; - -private: - - - - std::shared_ptr m_dtc; - - - std::shared_ptr m_ftc; - - - -}; - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/Skeleton.Stage3/skl_data_plugin_interface.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/Skeleton.Stage3/skl_data_plugin_interface.h deleted file mode 100755 index 35a20edef..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/Skeleton.Stage3/skl_data_plugin_interface.h +++ /dev/null @@ -1,24 +0,0 @@ - - - -#pragma once - -#include - -#include - -namespace Skeleton -{ - - - -class DataInterface : public DataPluginBase::Interface -{ -public: - DataInterface(LtsSession::LtsSession *session, NGL::INGLLogger &logger) - : DataPluginBase::Interface(session, logger) - {} - virtual ~DataInterface() = default; -}; - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/Skeleton.Stage3/skl_gui_plugin_interface.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/Skeleton.Stage3/skl_gui_plugin_interface.h deleted file mode 100755 index 69fe1600b..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/Skeleton.Stage3/skl_gui_plugin_interface.h +++ /dev/null @@ -1,37 +0,0 @@ - - - -#pragma once - -#include - -#ifndef SKLGUIPLUGININTERFACE_EXPORT -# ifdef BUILD_STATIC_LIBRARIES -# define SKLGUIPLUGININTERFACE_EXPORT -# else -# if defined(MAKE_SKLGUIPLUGININTERFACE_LIB) -# define SKLGUIPLUGININTERFACE_EXPORT Q_DECL_EXPORT -# else -# define SKLGUIPLUGININTERFACE_EXPORT Q_DECL_IMPORT -# endif -# endif -#endif - - -namespace Skeleton -{ - -class SKLGUIPLUGININTERFACE_EXPORT ForeignGuiInterface : public QObject -{ - Q_OBJECT - -public: - ForeignGuiInterface() = default; - virtual ~ForeignGuiInterface() = default; - - static QString pluginName() { return QStringLiteral("SkeletonGui"); } - - -}; - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/base/.skl_data_plugin_interface.h.kate-swp b/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/base/.skl_data_plugin_interface.h.kate-swp deleted file mode 100755 index 5e8f2d7a9..000000000 Binary files a/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/base/.skl_data_plugin_interface.h.kate-swp and /dev/null differ diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/base/CMakeLists.txt b/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/base/CMakeLists.txt deleted file mode 100755 index 80cdf4f6f..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/base/CMakeLists.txt +++ /dev/null @@ -1,18 +0,0 @@ -# -# $Id$ -# $HeadURL$ -# $Author$ -# - -#ADD_SUBDIRECTORY(Data) - -# -# Data Plugin Interface -# -NGL_ADD_LIBRARY2(WS sklDataPluginInterface SHARED skl_data_plugin_interface.h) -NGL_TARGET_LINK_LIBRARIES(sklDataPluginInterface - Qt6::Core - clientPluginInterface -) - -NGL_INSTALL_TARGET(sklDataPluginInterface) diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/base/skl_data_plugin_interface.h b/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/base/skl_data_plugin_interface.h deleted file mode 100755 index 35a20edef..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/base/skl_data_plugin_interface.h +++ /dev/null @@ -1,24 +0,0 @@ - - - -#pragma once - -#include - -#include - -namespace Skeleton -{ - - - -class DataInterface : public DataPluginBase::Interface -{ -public: - DataInterface(LtsSession::LtsSession *session, NGL::INGLLogger &logger) - : DataPluginBase::Interface(session, logger) - {} - virtual ~DataInterface() = default; -}; - -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/generate_plugin_base.py b/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/generate_plugin_base.py deleted file mode 100755 index 3ffd48eb3..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Plugins/skeleton/generate_plugin_base.py +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/python - -import os -import sys -import shutil -import fileinput - - - - - -def copyAndReplaceInFile(sourceFile, destinationFile, replacements): - with open(sourceFile) as inFile, open(destinationFile, "w") as outFile: - for line in inFile: - for before, after in replacements.iteritems(): - line = line.replace(before, after) - outFile.write(line) - - - - - -longName = raw_input("Enter Plugin name (in CamelCase): ") -shortNameAllLow = raw_input("Enter Plugin abbreviation (3 lower case letters): ") -shortNameCapital = shortNameAllLow.capitalize() -shortNameAllUpper = shortNameAllLow.upper() - - -dirName = "../" + longName -print "Trying to create Plugin directory \"" + dirName + "\"" -if os.path.isdir(dirName): - print "Directory \"" + dirName + "\" already exists. Exit" - sys.exit(-1) -else: - os.mkdir(dirName) - print ".. done" - - -print "Creating new files" -replacements = { "skl":shortNameAllLow, "Skl":shortNameCapital, "SKL":shortNameAllUpper, "Skeleton":longName } -copyAndReplaceInFile("base/CMakeLists.txt", "../" + longName + "/CMakeLists.txt", replacements) -copyAndReplaceInFile("base/skl_data_plugin_interface.h", "../" + longName + "/" + shortNameAllLow + "_data_plugin_interface.h", replacements) -print ".. done" - - -cmakeFileName = "../CMakeLists.txt" -print "Trying to add directory in", cmakeFileName -cmakeFileObject = open(cmakeFileName) -lines = cmakeFileObject.readlines() -cmakeFileObject.close -index = 0 -hasAddedSubDir = False -beforeLine = "placeholder" -for line in lines: - if beforeLine.startswith("ADD_SUBDIRECTORY") and not line.startswith("ADD_SUBDIRECTORY"): - hasAddedSubDir = True - break - beforeLine = line - index += 1 -if hasAddedSubDir == True: - lines.insert(index, "ADD_SUBDIRECTORY(" + longName + ")\n") - cmakeFileObject = open(cmakeFileName, "w") - for line in lines: - cmakeFileObject.write(line) - cmakeFileObject.close() - print ".. done" -else: - print "Could not add sub directory, please add \"ADD_SUBDIRECTORY(" + longName + ")\"" - print "manually to", cmakeFileName diff --git a/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/CMakeLists.txt b/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/CMakeLists.txt deleted file mode 100755 index 3dac6ae1d..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/CMakeLists.txt +++ /dev/null @@ -1,57 +0,0 @@ -# -# $Id$ -# $HeadURL$ -# $Author$ -# Created by hjl, SLSE, 2016-06-22 -# - -SET(xml_FILE vom_service.xml) - -# --- Executable svcVideoOverlayManagement (sVOM) ------------------------------------------------- -# -SET(SRCS_exe - avs_interface.cpp - avs_interface.h - dds_handler.cpp - dds_handler.h - handler_participant_data.cpp - handler_participant_data.h - handler_infrastructure_data.cpp - handler_infrastructure_data.h - handler_overlays.cpp - handler_overlays.h - logger.cpp - logger.h - main.cpp - main_handler.cpp - main_handler.h - settings.cpp - settings.h -) -# make sure xml file is properly installed -CODEGEN_HANDLE_SVC_XML(SRCS_exe ${xml_FILE}) - -NGL_ADD_SVC_ICON(SRCS_exe) -NGL_ADD_EXECUTABLE(AAR SV svcVideoOverlayManagement ${SRCS_exe}) -NGL_TARGET_LINK_LIBRARIES(svcVideoOverlayManagement - Qt6::Core - Qt6::Network - $,ddsconnector,> - ddsQoS - svcCoreClient - $,svcIsmClient,> - svcPpmClient - nglsettings - LtsCommandLineParser - NGLLogger - nglcoreapplication - $,ddscore,> - ngltools -) -target_include_directories(svcVideoOverlayManagement PRIVATE - ${CMAKE_SOURCE_DIR}/Lts/DDS -) -NGL_INSTALL_TARGET(svcVideoOverlayManagement) -NGL_INSTALL(AAR SV FILES log4cxx_vom.props DESTINATION bin) -NGL_ADD_TARGET_LINK(svcVideoOverlayManagement sVOM) - diff --git a/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/avs_interface.cpp b/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/avs_interface.cpp deleted file mode 100755 index 52ad73045..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/avs_interface.cpp +++ /dev/null @@ -1,263 +0,0 @@ -/** - * AVS-Interface for VideoOverlayManagement - * $Id$ - * $HeadURL$ - * $Author$ - * Created by hjl, SLSE, 2016-06-24 - */ - -#include "avs_interface.h" -#include "settings.h" - -#include -#include -#include -#include - -namespace VideoOverlayManagement -{ - -AvsInterface::AvsInterface(bool enableTryReconnect, QObject *parent) - : QObject(parent) - , m_waitTime(1) - , m_enableTryReconnect(enableTryReconnect) - , m_tryReconnect(false) - , m_avsKeepAliveTimer(new QTimer(this)) - , m_keepAliveTime(Settings::getAvsKeepAliveTime()) - , m_avsIfConnectionState(AvsIfConnectionState::Undefined) - , m_socket(nullptr) - , m_logger(getLogger("AVS_Interface")) -{ - doConnect(); - - connect(m_avsKeepAliveTimer, &QTimer::timeout, - this, &AvsInterface::onAvsKeepAliveTimeout); - -} // end of ctor() -//----------------------------------------------------------------------------- - -AvsInterface::~AvsInterface() -{ - if (m_socket) - m_socket->close(); - delete m_socket; -} // end of dtor() -//----------------------------------------------------------------------------- - -void AvsInterface::doConnect() -{ - DEBUG_LOG(m_logger) << "doConnect TCP-Socket "; - - if (m_socket) - m_socket->deleteLater(); - - m_socket = new QTcpSocket(this); - connect(m_socket, &QTcpSocket::connected, - this, &AvsInterface::onConnected); - connect(m_socket, &QTcpSocket::disconnected, - this, &AvsInterface::onDisonnected); - connect(m_socket, QOverload::of(&QTcpSocket::error), - this, &AvsInterface::onError); - connect(m_socket, &QTcpSocket::readyRead, - this, &AvsInterface::onReadyRead); - - if (m_tryReconnect) - { - INFO_LOG(m_logger) << "Try reconnect to host: " << m_hostName - << " port: " << m_hostPort - << " ip-address: " << m_ipAddressDNS; - - m_socket->connectToHost(m_hostName, m_hostPort); - } -} // end of doConnect() -//----------------------------------------------------------------------------- - -void AvsInterface::start(const QString &hostName, quint16 port) -{ - QHostInfo hostInfo = QHostInfo::fromName(hostName); - - const QList ipList = hostInfo.addresses(); - if (ipList.isEmpty()) - { - ERROR_LOG(m_logger) << "Non ip-address found for hostname: " << hostName; - m_ipAddressDNS.clear(); - } - else - { - INFO_LOG(m_logger) << "Try connect to AVS: " << hostName - << " port: " << port - << " ip-address: " << ipList.at(0).toString(); - - m_ipAddressDNS = ipList.at(0).toString(); - } - m_hostName = hostName; - m_hostPort = port; - m_socket->connectToHost(m_hostName, m_hostPort); -} // end of start() -//----------------------------------------------------------------------------- - -void AvsInterface::onConnected() -{ - INFO_LOG(m_logger) << "Connected to " - << m_socket->peerAddress().toString() - << ":" << m_socket->peerPort(); - m_waitTime = 1; - m_buffer.clear(); - - m_avsIfConnectionState = AvsIfConnectionState::Connected; - emit avsIfConnectionState(AvsIfConnectionState::Connected); - - m_avsKeepAliveTimer->start(m_keepAliveTime); -} // end of onConnected() -//----------------------------------------------------------------------------- - -void AvsInterface::onDisonnected() -{ - INFO_LOG(m_logger) << "Disconnected from " << m_socket->peerAddress().toString() - << ":" << m_socket->peerPort(); - - m_avsKeepAliveTimer->stop(); - m_avsIfConnectionState = AvsIfConnectionState::Disconnected; - emit avsIfConnectionState(AvsIfConnectionState::Disconnected); -} // end of onDisonnected() -//----------------------------------------------------------------------------- - -void AvsInterface::onError(QAbstractSocket::SocketError err) -{ - if (m_enableTryReconnect) - { - ERROR_LOG(m_logger) << "Socket error: " << err - << " \"" << m_socket->errorString() << "\"" - << " Hostname: " << m_hostName - << " Port:" << m_hostPort - << " ip-Address:" << m_ipAddressDNS - << " - trying to reconnect in " << m_waitTime << " seconds"; - } - else - { - ERROR_LOG(m_logger) << "Socket error: " << err - << " \"" << m_socket->errorString() << "\"" - << " Hostname: " << m_hostName - << " Port:" << m_hostPort - << " ip-Address:" << m_ipAddressDNS; - } - - m_socket->disconnectFromHost(); - m_avsKeepAliveTimer->stop(); - - m_avsIfConnectionState = AvsIfConnectionState::ConnectionError; - emit avsIfConnectionState(AvsIfConnectionState::ConnectionError); - - // try reconnects .... - if (m_enableTryReconnect) - tryReconnect(); -} // end of onError() -//----------------------------------------------------------------------------- - -void AvsInterface::tryReconnect() -{ - m_tryReconnect = true; - m_avsIfConnectionState = AvsIfConnectionState::TryReconnect; - emit avsIfConnectionState(AvsIfConnectionState::TryReconnect); - - if (m_socket->state() != QAbstractSocket::UnconnectedState) - m_socket->waitForDisconnected(); - - m_waitTime += 2; - - if (m_waitTime > 120) - m_waitTime = 120; - - QTimer::singleShot(m_waitTime * 1000, this, &AvsInterface::doConnect); -} // end of tryReconnect() -//----------------------------------------------------------------------------- - -void AvsInterface::onReadyRead() -{ - while (m_socket->canReadLine()) - { - const QByteArray data = m_socket->readLine().trimmed(); - if (data.isEmpty()) - continue; - - INFO_LOG(m_logger) << "Incoming RCP_AVA: '" << data << "'"; - int cmdNr = -1; - bool bOk = false; - - const QVector cmdList = NGL::parseFromTelnet(data); - - if (cmdList.size() > 1) - cmdNr = cmdList.at(0).toInt(&bOk); - - if (bOk) - { - // Fuer VOM sind nur diese 4 Command relavant - switch (cmdNr) - { - case int(AvsCmdState::Ok): - emit avsCmdState(AvsCmdState::Ok); - break; - case int(AvsCmdState::KeepAlive): - emit avsCmdState(AvsCmdState::KeepAlive); - m_avsKeepAliveTimer->start(m_keepAliveTime); - break; - case int(AvsCmdState::BadArguments): - emit avsCmdState(AvsCmdState::BadArguments); - break; - case int(AvsCmdState::CommandNotStateValid): - emit avsCmdState(AvsCmdState::CommandNotStateValid); - break; - default: - break; - } - } - } // while -} // end of onReadyRead() -//----------------------------------------------------------------------------- - -void AvsInterface::onAvsKeepAliveTimeout() -{ - emit avsKeepAliveTimeout(); - -// try reconnects .... - if (m_enableTryReconnect) - { - m_socket->disconnectFromHost(); - m_avsKeepAliveTimer->stop(); - - if (m_socket->state() != QAbstractSocket::UnconnectedState) - m_socket->waitForDisconnected(); - - tryReconnect(); - } -} // end of onAvsKeepAliveTimeout() -//----------------------------------------------------------------------------- - -bool AvsInterface::sendCommand(const QByteArray &qba) -{ - bool bOk = true; - - INFO_LOG(m_logger) << "Send command: " << qba.trimmed(); - - if (m_socket->state() != QTcpSocket::ConnectedState) - { - ERROR_LOG(m_logger) << "sendCommand()" - << " '" << qba.trimmed() - << "' No socket connection established."; - return false; - } - - int trxBytes = m_socket->write(qba); - - if (trxBytes != qba.size()) - { - bOk = false; - ERROR_LOG(m_logger) << "Insufficient number of tansfered bytes." - << " Soll: " << trxBytes << " Ist: " << qba.size(); - } - m_socket->flush(); - return bOk; -} // end of sendCommand() -//----------------------------------------------------------------------------- - -} // namespace VideoOverlayManagement diff --git a/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/avs_interface.h b/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/avs_interface.h deleted file mode 100755 index f48c8e6ff..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/avs_interface.h +++ /dev/null @@ -1,124 +0,0 @@ -/** - * AVS-Interface for VideoOverlayManagement - * $Id$ - * $HeadURL$ - * $Author$ - * Created by hjl, SLSE, 2016-06-24 - */ - -#pragma once - -#include -#include -#include "logger.h" - -// Forwarddeclarations -class QTcpSocket; -class QTimer; - -namespace VideoOverlayManagement -{ - -enum class AvsIfConnectionState -{ - Undefined = 0, - Connected, - Disconnected, - TryReconnect, - ConnectionError, -}; - -enum class AvsCmdState -{ - Ok = 200, - KeepAlive = 298, - BadArguments = 402, - CommandNotStateValid = 455 -}; - - -class AvsInterface - : public QObject -{ - Q_OBJECT -public: - /** - * Constructor connect to plugboard - * @param[in] enableTryReconnect if true, try reconnection - * @param[in] parent Pointer to parent qObject - */ - AvsInterface(bool enableTryReconnect, QObject *parent = nullptr); - - ~AvsInterface(); - - /** - * Connect to AVS RCP_AVA - * @param[in] hostName Hostname or Ip address to get access to AVS - * @param[in] port Ip port to get access to AVS - */ - void start(const QString &hostName, quint16 port); - - AvsIfConnectionState getAvsIfState() - { - return m_avsIfConnectionState; - } - - /** - * Send data to connected TcpSocket - * @param[in] qba Data to be transfered completed with "\r\n" - */ - bool sendCommand(const QByteArray &qba); - - -Q_SIGNALS: - /** - * Signals current AVS connection state - */ - void avsIfConnectionState(AvsIfConnectionState); - /** - * Signals current AVS command state - */ - void avsCmdState(AvsCmdState); - - /** - * Signals an missing AVS keep-alive - * If the parameter 'enableTryReconnect' is set - * the connection attempting to restore automatically - */ - void avsKeepAliveTimeout(); - - /** - * Define the signal/slots connects uesd for TcpSocket - */ -protected Q_SLOTS: - void doConnect(); - void onConnected(); - void onDisonnected(); - void onError(QAbstractSocket::SocketError); - void onReadyRead(); - void onAvsKeepAliveTimeout(); - -private: // methode - void tryReconnect(); - -private: // attributes - QString m_hostName; ///< Hostname or Ip address to get access to AVS - QString m_ipAddressDNS; ///< DNS IP address of AVS - quint16 m_hostPort; ///< Ip port to get access to AVS - qint32 m_waitTime; ///< delay before try reconnection - bool m_enableTryReconnect; ///< if true, enables try reconnection - bool m_tryReconnect; ///< if true, try reconnection - - QTimer *m_avsKeepAliveTimer; ///< AVS keep-alive timer - qint32 m_keepAliveTime; ///< AVS keep-alive time intervall in msec - - AvsIfConnectionState m_avsIfConnectionState; ///< AVS Interface connection state - - QTcpSocket *m_socket; ///< pointer to tcpsocket object - - QByteArray m_buffer; ///< data buffer to hold incoming data form tcpsocket - NGL::INGLLogger &m_logger; ///< Interface to the Logging-Facility - -}; - -} // namespace VideoOverlayManagement diff --git a/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/dds_handler.cpp b/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/dds_handler.cpp deleted file mode 100755 index 38645fac7..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/dds_handler.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/** - * DdsHandler for VideoOverlayManagement - * $Id$ - * $HeadURL$ - * $Author$ - * Created by hjl, SLSE, 2016-07-06 - */ - -#include "dds_handler.h" - -#include - -namespace VideoOverlayManagement -{ - -DdsHandler::DdsHandler(int domainId, int exerciseId) - : m_ddsConnector(std::make_shared(domainId, IDL::PartitionType::Exercise, exerciseId)) - , m_logger(getLogger("DdsHandler")) -{ - DEBUG_LOG(m_logger) << "DdsHandler(" << domainId << ") for partition: " << m_ddsConnector->getDefaultPartition(); -} // end of ctor() -//----------------------------------------------------------------------------- - -bool DdsHandler::init(const QStringList &qosFileList) -{ - INFO_LOG(m_logger) << "--- Start VideoOverlayManagement DDSHandler."; - - if (!m_ddsConnector->init(qosFileList)) - { - ERROR_LOG(m_logger) << "Error initializing dds connections - aborting"; - return false; - } - - // default initialize Publisher and Subscriber - m_ddsConnector->initPublisherSubscriber(); - - // Pacemaker - m_pacemaker = std::make_shared(m_ddsConnector); - - return true; -} // end of init() -//----------------------------------------------------------------------------- - - -} // Namespace VideoOverlayManagement diff --git a/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/dds_handler.h b/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/dds_handler.h deleted file mode 100755 index 0d41c78da..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/dds_handler.h +++ /dev/null @@ -1,45 +0,0 @@ -/** - * DdsHandler for VideoOverlayManagement - * $Id$ - * $HeadURL$ - * $Author$ - * Created by hjl, SLSE, 2016-07-06 - */ -#pragma once - -#include - -#include "logger.h" - -namespace Core -{ -class Pacemaker; -} - -namespace VideoOverlayManagement -{ -class DdsHandler final -{ -public: - DdsHandler(int domainId, int exerciseId); - ~DdsHandler() = default; - - bool init(const QStringList &qosFileList = QStringList()); - - std::shared_ptr pacemaker() const - { - return m_pacemaker; - } - std::shared_ptr dds() const - { - return m_ddsConnector; - } - -private: - std::shared_ptr m_ddsConnector; - std::shared_ptr m_pacemaker; - - NGL::INGLLogger &m_logger; -}; - -} // namespace VideoOverlayManagement diff --git a/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/handler_infrastructure_data.cpp b/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/handler_infrastructure_data.cpp deleted file mode 100755 index 402c70fe2..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/handler_infrastructure_data.cpp +++ /dev/null @@ -1,162 +0,0 @@ -/** - * Handler for infrastructure data - * $Id$ - * $HeadURL$ - * $Author: - * Created by hjl, SLSE, 2016-07-22 - */ - -#include "handler_infrastructure_data.h" -#include "settings.h" - -#include - -using namespace VideoOverlayManagement; - -HandlerInfrastructureData::HandlerInfrastructureData(const std::shared_ptr &ddsHandler, QObject *parent) - : QObject(parent) - , m_ddsHandler(ddsHandler) - , m_exerciseId(0) - , m_logger(getLogger("HandlerInfrastructureData")) -{ -} // end of ctor() -//----------------------------------------------------------------------------- - -HandlerInfrastructureData::~HandlerInfrastructureData() -{ -} // end of dtor() -//----------------------------------------------------------------------------- - -bool HandlerInfrastructureData::init(int exerciseId) -{ - m_exerciseId = exerciseId; - // DTC InfrastructureManagement - m_dtc = InfrastructureManagement::Interface::Dtc::create(m_ddsHandler->dds()); - if (m_dtc == nullptr) - { - ERROR_LOG(m_logger) << "Could not create DTC InfrastructureManagement"; - return false; - } - - if (!m_dtc->enableMainStructureElement() || - !m_dtc->enableMountingPointAsset() || - !m_dtc->enableInstrumentationAsset() || - !m_dtc->waitForHistoricalDataMainStructureElement() || - !m_dtc->waitForHistoricalDataMountingPointAsset() || - !m_dtc->waitForHistoricalDataInstrumentationAsset()) - { - ERROR_LOG(m_logger) << "init() DTC InfrastructureManagement failed"; - return false; - } - - // Get 'static' data for all rooms where a camera is available - QMap> assetsMap; // (roomId, QVector) - - auto predicate = - [](const InfrastructureManagement::InstrumentationAsset & a) - { - return a.mountingPointTypeId() == InfrastructureManagement::MountingPointType::IndoorCamera; - }; - if (!m_dtc->getAllAssetsPerRoom(predicate, assetsMap)) - { - WARNING_LOG(m_logger) << "HandlerInfrastructureData::getAllAssetsPerRoom() failed" - << " assetsMap.size(): " << assetsMap.size(); - } - - for (auto i = assetsMap.cbegin(); i != assetsMap.cend(); ++i) - { - const int roomId = i.key(); - for (const InfrastructureManagement::InstrumentationAsset &asset : i.value()) - { - auto it = std::find(asset.availableInExercise().begin(), - asset.availableInExercise().end(), m_exerciseId); - if (it == asset.availableInExercise().end()) - { - DEBUG_LOG(m_logger) << "Asset " << asset.id() - << " is not available in current exercise - skipping"; - continue; - } - // in interne m_roomId2CameraNameMap eintragen, zur Zeit nur eine Kamera pro Raum möglich - m_roomId2CameraNameMap.insert(roomId, QString::fromStdString(asset.name())); - // und fuer subscribe in m_assetId2RoomIdMap eintragen - m_assetId2RoomIdMap.insert(asset.id(), roomId); - DEBUG_LOG(m_logger) << " assetId: " << asset.id() - << " mountingPointTypeId: " << asset.mountingPointTypeId() - << " name: " << asset.name(); - } - } // for(auto i = assetMap... - - INFO_LOG(m_logger) << "m_roomId2CameraNameMap.size(): " << m_roomId2CameraNameMap.size(); - for (auto i = m_roomId2CameraNameMap.begin(); i != m_roomId2CameraNameMap.end(); ++i) - { - INFO_LOG(m_logger) << "roomId: " << i.key() - << " cameraName: " << i.value(); - } - - // Subsribe for AssetChanged (Daten der cameras aus den Assets ermitteln) - connect(m_dtc.get(), &InfrastructureManagement::Interface::Dtc::instrumentationAssetChanged, - this, &HandlerInfrastructureData::onAssetChanged); - - // we don't need them now anymore -> unsubscribe (really?) - m_dtc->enableMainStructureElement(false); - m_dtc->enableMountingPointAsset(false); - - INFO_LOG(m_logger) << "HandlerInfrastructureData::init() finished. " - << " m_roomId2CameraNameMap.size(): " << m_roomId2CameraNameMap.size(); - return true; -} // end of init() -//----------------------------------------------------------------------------- - -bool HandlerInfrastructureData::isCameraAvailable(int roomId) const -{ - return m_roomId2CameraNameMap.contains(roomId); -} // end of isCameraAvailable() -//----------------------------------------------------------------------------- - -QString HandlerInfrastructureData::getStreamNameFromRoomId(int roomId) const -{ - auto it = m_roomId2CameraNameMap.find(roomId); - const QString qs(it == m_roomId2CameraNameMap.end() ? QString() : it.value()); - DEBUG_LOG(m_logger) << "streamName for roomId: " << roomId << " '" << qs << "' "; - - return qs; -} // end of getStreamNameFromRoomId() -//----------------------------------------------------------------------------- - -void HandlerInfrastructureData::onAssetChanged(const InfrastructureManagement::InstrumentationAsset &data, DataModification modType) -{ - Q_UNUSED(modType); - if (data.mountingPointTypeId() != InfrastructureManagement::MountingPointType::IndoorCamera) - return; - - INFO_LOG(m_logger) << "onAssetChanged()" - << " assetId: " << data.id() - << " name: " << data.name(); - - auto it = std::find(data.availableInExercise().begin(), - data.availableInExercise().end(), m_exerciseId); - if (it == data.availableInExercise().end()) - { - DEBUG_LOG(m_logger) << "Asset " << data.id() - << " is not available in current exercise - skipping"; - return; - } - - // Hier muss aus der AssetId die zugehoerige roomid verwendet werden !! - m_roomId2CameraNameMap.insert(getRoomIdFromAssetId(data.id()), QString::fromStdString(data.name())); - - for (auto i = m_roomId2CameraNameMap.begin(); i != m_roomId2CameraNameMap.end(); ++i) - { - DEBUG_LOG(m_logger) << "m_roomId2CameraNameMap changed... " - << " m_roomId2CameraNameMap.size(): " << m_roomId2CameraNameMap.size() - << " roomId: " << i.key() - << " cameraName: " << *i; - } -} // end of onAssetChanged() -//----------------------------------------------------------------------------- - -int HandlerInfrastructureData::getRoomIdFromAssetId(int assetId) const -{ - return m_assetId2RoomIdMap.value(assetId, -1); -} // end of getRoomIdFromAssetId() -//----------------------------------------------------------------------------- diff --git a/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/handler_infrastructure_data.h b/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/handler_infrastructure_data.h deleted file mode 100755 index 7d41e133a..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/handler_infrastructure_data.h +++ /dev/null @@ -1,79 +0,0 @@ -/** - * Handler for infrastructure data - * $Id$ - * $HeadURL$ - * $Author$ - * Created by hjl, SLSE, 2016-07-22 - */ - -#pragma once - -#include "dds_handler.h" -#include "logger.h" - -#include - -#include -#include - -namespace VideoOverlayManagement -{ - -class HandlerInfrastructureData : public QObject -{ - Q_OBJECT -public: - explicit HandlerInfrastructureData(const std::shared_ptr &ddsHandler, QObject *parent = nullptr); - - ~HandlerInfrastructureData(); - - /** - * Initialize the handler to manage information from infrastructure management - */ - bool init(int exerciseId); - - /** - * Check if there is a camera in the room - * @param[in] roomId Id of the room to get information about camera availability - * @returns true if camera is available, otherwise false - */ - bool isCameraAvailable(int roomId) const; - - /** - * Returns the streamname of the camera for the given roomId - * @param[in] roomId Id of the room to get the streamname for this camera - * @returns returns the streamname if camera is available, otherwise string is empty - */ - QString getStreamNameFromRoomId(int roomId) const; - - -Q_SIGNALS: - -private Q_SLOTS: - /** - * Handle the signals from 'InfrastructureManagement' - */ - void onAssetChanged(const InfrastructureManagement::InstrumentationAsset &data, DataModification modType); - -private: // methoden - /** - * Returns the room id for the given assetId - * @param[in] assetId Id of the asset to get the room id for - * @returns returns the room id if available, otherwise -1 - */ - int getRoomIdFromAssetId(int assetId) const; - -private: // attributes - std::shared_ptr m_ddsHandler; ///< Pointer to VOM DDS handler - std::shared_ptr m_dtc; ///< Pointer to DTC InfrastructureManagement interface object - - QMap m_assetId2RoomIdMap; ///< optional nur noetig bei subscribe for AssetChanged - - QMap m_roomId2CameraNameMap; ///< Reference map roomId to camera name(roomId, cameraName) Condition: per room one camera! - int m_exerciseId; - - NGL::INGLLogger &m_logger; ///< Interface to the Logging-Facility - -}; -} // namespace VideoOverlayManagement - diff --git a/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/handler_overlays.cpp b/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/handler_overlays.cpp deleted file mode 100755 index 1f23f6c59..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/handler_overlays.cpp +++ /dev/null @@ -1,240 +0,0 @@ -/** - * Handler for Video Overlays - * $Id$ - * $HeadURL$ - * $Author$ - * Created by hjl, SLSE, 2016-07-07 - */ - -#include "handler_overlays.h" -#include "handler_participant_data.h" -#include "settings.h" - -#include - -using namespace VideoOverlayManagement; - -HandlerOverlays::HandlerOverlays(AvsInterface *avsIf, - const std::shared_ptr &handlerParticipantData, - const std::shared_ptr &handlerInfrastructureData, - int exerciseId, - QObject *parent) - : QObject(parent) - , m_avsIf(avsIf) - , m_handlerParticipantData(handlerParticipantData) - , m_handlerInfrastructureData(handlerInfrastructureData) - , m_exerciseId(exerciseId) - , m_logger(getLogger("HandlerOverlays")) -{ -} // end of ctor() -//----------------------------------------------------------------------------- - -HandlerOverlays::~HandlerOverlays() -{ -} // end of dtor() -//----------------------------------------------------------------------------- - -bool HandlerOverlays::init() -{ - INFO_LOG(m_logger) << "Start VideoOverlay Handler."; - - // internal Signal/Slot connection (must be done before calling initParticipantsInRoomMap() !) - connect(this, &HandlerOverlays::participantsInRoomMapChanged, - this, &HandlerOverlays::onParticipantsInRoomMapChanged); - - // Get assigned participants to roomId data from Player Management ... - initParticipantsInRoomMap(); - // Subscribe for external changes - connect(m_handlerParticipantData.get(), &HandlerParticipantData::participantPositionChanged, - this, &HandlerOverlays::onParticipantPositionChanged); - - INFO_LOG(m_logger) << "VOM Handler initialized. "; - - return true; -} // end of init() -//----------------------------------------------------------------------------- - -void HandlerOverlays::onParticipantPositionChanged(int oldRoomId, int newRoomId, int participantId) -{ - DEBUG_LOG(m_logger) << "onParticipantPositionChanged() " - << " oldRoomId: " << oldRoomId - << " newRoomId: " << newRoomId - << " participantId: " << participantId - ; - - if (oldRoomId > 0) // is valid - removePartIdFromParticipantsInRoomMap(oldRoomId, participantId); - - if (newRoomId > 0) - addPartIdToParticipantsInRoomMap(newRoomId, participantId); -} // end of onParticipantPositionChanged() -//----------------------------------------------------------------------------- - -void HandlerOverlays::onParticipantsInRoomMapChanged(int roomId, const QSet &participants) -{ - DEBUG_LOG(m_logger) << "onParticipantsInRoomMapChanged() " - << " roomId: " << roomId - << " partId: " << getAllEquipmentNumbers(participants, false) - << " eqNo: " << getAllEquipmentNumbers(participants, true) - << " participants.size(): " << participants.size() - ; - - if (!m_handlerInfrastructureData->isCameraAvailable(roomId)) - { - WARNING_LOG(m_logger) << "onParticipantsInRoomMapChanged() Non camera available in roomId: " << roomId << " No data will be send to AVS."; - return; - } - - // SetStreamOverlayText Command String zusammenstellen - QString cmd; - QString contextName = getContextName(); - QString streamName = m_handlerInfrastructureData->getStreamNameFromRoomId(roomId); - QString overlayTemplateName = getOverlayTemplateName(); - - if (streamName.isEmpty()) - { - ERROR_LOG(m_logger) << "onParticipantsInRoomMapChanged() No streamName found for roomId: " << roomId << " No data will be send to AVS."; - return; - } - - cmd.append(QLatin1String("SetStreamOverlayText ")); - cmd.append(contextName); - cmd.append(QLatin1String(" ")); - cmd.append(streamName); - cmd.append(QLatin1String(" ")); - cmd.append(overlayTemplateName); - cmd.append(QLatin1String(" ")); - cmd.append(QLatin1String("0 ")); - cmd.append(QLatin1String("\"")); - - cmd.append(QLatin1String("Participants(EqNo) in roomId ")); - cmd.append((QString::number(roomId))); - cmd.append(QLatin1String(": ")); - cmd.append(getAllEquipmentNumbers(participants, true)); - cmd.append(QLatin1String("\"")); - - QByteArray qba = cmd.toLatin1(); - qba += "\r\n"; - - INFO_LOG(m_logger) << "onParticipantsInRoomMapChanged() sendCommand: " << qba ; - m_avsIf->sendCommand(qba); - - // room entry der keine participants enthaelt loeschen - if (participants.isEmpty()) - m_participantsInRoomMap.remove(roomId); -} // end of onParticipantsInRoomMapChanged() -//----------------------------------------------------------------------------- - -void HandlerOverlays::initParticipantsInRoomMap() -{ - // QMap - const QMap qm = m_handlerParticipantData->getAllAssignedParticipants(); - - for (auto i = qm.begin(); i != qm.end(); ++i) - onParticipantPositionChanged(0, i.value(), i.key()); -} // end of initParticipantsInRoomMap() -//----------------------------------------------------------------------------- - -void HandlerOverlays::addPartIdToParticipantsInRoomMap(int roomId, int participantId) -{ - DEBUG_LOG(m_logger) << "addPartIdToParticipantsInRoomMap() " - << " roomId: " << roomId - << " participantId: " << participantId - ; - - QSet participants; - - if (m_participantsInRoomMap.contains(roomId)) - { - QMap>::const_iterator i = m_participantsInRoomMap.constFind(roomId); - participants = i.value(); - } - - participants.insert(participantId); - m_participantsInRoomMap.insert(roomId, participants); - - /// - DEBUG_LOG(m_logger) << "emit participantsInRoomMapChanged()" - << " roomId: " << roomId - << " partId: " << getAllEquipmentNumbers(participants, false) - << " eqNo: " << getAllEquipmentNumbers(participants, true) - << " participants.size(): " << participants.size() - ; - - emit participantsInRoomMapChanged(roomId, participants); -} // end of addPartIdToParticipantsInRoomMap() -//----------------------------------------------------------------------------- - -void HandlerOverlays::removePartIdFromParticipantsInRoomMap(int roomId, int participantId) -{ - DEBUG_LOG(m_logger) << "removePartIdFromParticipantsInRoomMap() " - << " roomId: " << roomId - << " participantId: " << participantId - ; - - if (m_participantsInRoomMap.contains(roomId)) - { - QMap>::const_iterator i = m_participantsInRoomMap.constFind(roomId); - QSet participants = i.value(); - - // remove participant from the set - participants.remove(participantId); - m_participantsInRoomMap.insert(roomId, participants); - - DEBUG_LOG(m_logger) << "emit participantsInRoomMapChanged()" - << " roomId: " << roomId - << " partId: " << getAllEquipmentNumbers(participants, false) - << " eqNo: " << getAllEquipmentNumbers(participants, true) - << " participants.size(): " << participants.size() - ; - - emit participantsInRoomMapChanged(roomId, participants); - } -} // end of removePartIdFromParticipantsInRoomMap() -//----------------------------------------------------------------------------- - -QString HandlerOverlays::getContextName() const -{ - QString qs(Settings::getContextName()); - qs.append(QString::number(m_exerciseId)); - return qs; -} // end of getContextName() -//----------------------------------------------------------------------------- - -QString HandlerOverlays::getOverlayTemplateName() const -{ - return Settings::getOverlayTemplateName(); -} // end of getOverlayTemplateName() -//----------------------------------------------------------------------------- - -QSet HandlerOverlays::convertParticipantIdsToEquipmentNo(const QSet &participants) const -{ - QSet equipmentNumbers; - - for (int currentParticipantId : participants) - { - int equipmentNumber = m_handlerParticipantData->getEquipmentNumber(currentParticipantId); - equipmentNumbers.insert(equipmentNumber); - } - return equipmentNumbers; -} // end of convertParticipantIdsToEquipmentNo() -//----------------------------------------------------------------------------- - -QString HandlerOverlays::getAllEquipmentNumbers(QSet data, bool isParticipantIds) const -{ - QString qs; - - if (isParticipantIds) - data = convertParticipantIdsToEquipmentNo(data); - - for (int currentDataId : qAsConst(data)) - { - qs.append(QString::number(currentDataId)); - qs.append(QLatin1String(", ")); - } - // remove last ", " - if (!qs.isEmpty()) - qs.chop(2); - return qs; -} // end of getAllEquipmentNumbers() -//----------------------------------------------------------------------------- diff --git a/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/handler_overlays.h b/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/handler_overlays.h deleted file mode 100755 index cb928243b..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/handler_overlays.h +++ /dev/null @@ -1,123 +0,0 @@ -/** - * Handler for Video Overlays - * $Id$ - * $HeadURL$ - * $Author$ - * Created by hjl, SLSE, 2016-07-07 - */ - -#pragma once - -#include -#include - -#include "avs_interface.h" -#include "handler_participant_data.h" -#include "handler_infrastructure_data.h" -#include "logger.h" - - -namespace VideoOverlayManagement -{ -// Forwarddeclarations -class AvsInterface; - -class HandlerOverlays - : public QObject -{ - Q_OBJECT -public: - explicit HandlerOverlays(AvsInterface *avsIf, - const std::shared_ptr &handlerParticipantData, - const std::shared_ptr &handlerInfrastructureData, - int exerciseId, - QObject *parent = nullptr); - ~HandlerOverlays(); - - bool init(); - - -Q_SIGNALS: - /** - * Emits when a participant position was changed to another room (internal signal/slot) - * @param[in] roomId Id of the room where the participant association to be change - * @param[in] participants List of all participants assigned to roomId - */ - void participantsInRoomMapChanged(int roomId, const QSet &participants); - - -private Q_SLOTS: - /** - * Handle incoming position changed signals - * @param[in] oldRoomId ID of the room where the participant was at the last message. - * @param[in] newRoomId ID of the room where the participant was at this message. - * @param[in] participantId Id of the participant who is assigned to the message - */ - void onParticipantPositionChanged(int oldRoomId, int newRoomId, int participantId); - /** - * Build the video overlay string based on the given data - * @param[in] roomId Id of the room to get information about camera availability - * @param[in] participants List of all participants assigned to roomId - */ - void onParticipantsInRoomMapChanged(int roomId, const QSet &participants); - -private: // methodes - /** - * Initialize 'participantsInRoomMap' - */ - void initParticipantsInRoomMap(); - - /** - * Add participant in 'participantsInRoomMap' for the given roomId entry - * and emits onParticipantsInRoomMapChanged(...) to build the video overlay string - * @param[in] roomId Id of the room which entry will to be modified - * @param[in] participantId Id of the participant who has to be modified - */ - void addPartIdToParticipantsInRoomMap(int roomId, int participantId); - - /** - * Remove participant in 'participantsInRoomMap' for the given roomId entry - * and emits onParticipantsInRoomMapChanged(...) to build the video overlay string - * @param[in] roomId Id of the room which entry will to be modified - * @param[in] participantId Id of the participant who has to be remove - */ - void removePartIdFromParticipantsInRoomMap(int roomId, int participantId); - - /** - * Returns the 'context' name used for AVS output - * @returns returns the context name - */ - QString getContextName() const; - - /** - * Returns the name for the overlay template used for AVS output - * @returns overlay template name - */ - QString getOverlayTemplateName() const; - - /** - * Convert the given list of participants to their assigned equipment number - * @param[in] participants Set of participant ids to get the equipment number for - * @returns Converted QSet (if an participantId could not be converted the entry will be empty) - */ - QSet convertParticipantIdsToEquipmentNo(const QSet &participants) const; - - /** - * Returns a comma separated string with equipment numbers for the given list of participantIds/equipment numbers - * @param[in] data Set of participant ids or equipment numbers to get the string for - * @param[in] isParticipantIds true means data are participantIds otherwise equipment numbers - * @returns String with equipment numbers (if an participantId could not be converted the entry will be empty) - */ - QString getAllEquipmentNumbers(QSet data, bool isParticipantIds) const; - -private: // attributes - AvsInterface *m_avsIf; ///< Pointer to AVS-Interface - - std::shared_ptr m_handlerParticipantData; ///< Pointer to participant data handler - std::shared_ptr m_handlerInfrastructureData; ///< Pointer to infrastructure data handler - int m_exerciseId; ///< Exercise id - NGL::INGLLogger &m_logger; ///< Interface to the Logging-Facility - - QMap> m_participantsInRoomMap; ///< Includes all participants (player) in one room (roomId, Set) -}; -} // namespace VideoOverlayManagement diff --git a/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/handler_participant_data.cpp b/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/handler_participant_data.cpp deleted file mode 100755 index 85c5022e2..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/handler_participant_data.cpp +++ /dev/null @@ -1,130 +0,0 @@ -/** - * Handler for player data - * $Id$ - * $HeadURL$ - * $Author$ - * Created by hjl, SLSE, 2016-07-05 - */ - -#include "handler_participant_data.h" -#include "settings.h" - -#include - -using namespace VideoOverlayManagement; - -HandlerParticipantData::HandlerParticipantData(const std::shared_ptr &ddsHandler, QObject *parent) - : QObject(parent) - , m_ddsHandler(ddsHandler) - , m_logger(getLogger("HandlerParticipantData")) -{ -} // end of ctor() -//----------------------------------------------------------------------------- - -HandlerParticipantData::~HandlerParticipantData() -{ -} // end of dtor() -//----------------------------------------------------------------------------- - -bool HandlerParticipantData::init() -{ - // DTC ParticipantManagement - m_dtc = ParticipantManagement::Interface::Dtc::create(m_ddsHandler->dds()); - if (m_dtc == nullptr) - { - ERROR_LOG(m_logger) << "Could not create DTC ParticipantManagement"; - return false; - } - - // only subscribe to the topics we're interested in - if (!m_dtc->enableParticipant() || !m_dtc->enableParticipantPosition()) - { - ERROR_LOG(m_logger) << "init() DTC ParticipantManagement failed"; - return false; - } - - // Get 'static' data for all participants (playerdata) - // Subsribe for ParticipantChanged - connect(m_dtc.get(), &ParticipantManagement::Interface::Dtc::participantChanged, - this, &HandlerParticipantData::onParticipantChanged); - // Player in Referenzmap eintragen - m_dtc->participants([this](const ParticipantManagement::Participant &p) { onParticipantChanged(p, DataModification::eAdded);}); - - // Get last position ('dynamic' data) of all participants - // Subsribe for participantPositionChanged - connect(m_dtc.get(), &ParticipantManagement::Interface::Dtc::participantPositionChanged, - this, &HandlerParticipantData::onParticipantPositionChanged); - // Position in ParticipantsPositionMap eintragen - auto cbParticipantPos = [this](const ParticipantManagement::ParticipantPosition &participantPos) - { - m_participantsPositionMap.insert(participantPos.participantId(), participantPos.roomId()); - }; - m_dtc->participantPositions(cbParticipantPos); - - INFO_LOG(m_logger) << "HandlerParticipantData::init() finished. " - << " m_partId2EquipNoMap.size(): " << m_partId2EquipNoMap.size() - << " m_participantsPositionMap.size(): " << m_participantsPositionMap.size(); - return true; -} // end of init() -//----------------------------------------------------------------------------- - -int HandlerParticipantData::getEquipmentNumber(int participantId) const -{ - return m_partId2EquipNoMap.value(participantId); -} // end of getEquipmentNumber() -//----------------------------------------------------------------------------- - -QMap HandlerParticipantData::getAllAssignedParticipants() const -{ - QMap qMap; - for (auto i = m_participantsPositionMap.begin(); i != m_participantsPositionMap.end(); ++i) - { - if (i.value() > 0) - qMap.insert(i.key(), i.value()); - } - return qMap; -} // end of getAllAssignedParticipants() -//----------------------------------------------------------------------------- - -void HandlerParticipantData::onParticipantChanged(const ParticipantManagement::Participant &data, DataModification modType) -{ - INFO_LOG(m_logger) << "onParticipantChanged() participantId:" << data.id(); - - if (modType != DataModification::eRemoved && data.equipmentNumber().is_set()) - m_partId2EquipNoMap.insert(data.id(), data.equipmentNumber().get()); - else - m_partId2EquipNoMap.remove(data.id()); - - if (m_logger.isDebugEnabled()) - { - for (auto i = m_partId2EquipNoMap.begin(); i != m_partId2EquipNoMap.end(); ++i) - DEBUG_LOG(m_logger) << " partId2EquipNoMap.size(): " << m_partId2EquipNoMap.size() - << " partId: " << i.key() - << " eqNo: " << i.value(); - } -} // end of onParticipantChanged() -//----------------------------------------------------------------------------- - -void HandlerParticipantData::onParticipantPositionChanged(const ParticipantManagement::ParticipantPosition &data, DataModification modType) -{ - const int newRoomId = data.roomId(); - // get reference to room (will be created if not exist) - int &roomId = m_participantsPositionMap[data.participantId()]; - // remember old room - const int oldRoomId = roomId; - // assing new room - roomId = modType == DataModification::eRemoved ? 0 : newRoomId; - if (newRoomId != oldRoomId) - emit participantPositionChanged(oldRoomId, newRoomId, data.participantId()); - - INFO_LOG(m_logger) << "onParticipantPositionChanged()" - << " oldRoomId: " << oldRoomId - << " newRoomId: " << newRoomId - << " participantId: " << data.participantId(); - - if (modType == DataModification::eRemoved) - m_participantsPositionMap.remove(data.participantId()); - -} // end of onParticipantPositionChanged() -//----------------------------------------------------------------------------- - diff --git a/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/handler_participant_data.h b/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/handler_participant_data.h deleted file mode 100755 index e3045d237..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/handler_participant_data.h +++ /dev/null @@ -1,75 +0,0 @@ -/** - * Handler for player data - * $Id$ - * $HeadURL$ - * $Author$ - * Created by hjl, SLSE, 2016-07-05 - */ - -#pragma once - -#include "dds_handler.h" -#include "logger.h" - -#include - -#include -#include - -namespace VideoOverlayManagement -{ - -class HandlerParticipantData : public QObject -{ - Q_OBJECT -public: - explicit HandlerParticipantData(const std::shared_ptr &ddsHandler, QObject *parent = nullptr); - - ~HandlerParticipantData(); - - /** - * Initialize the handler to manage information from player management - */ - bool init(); - - /** - * Get equipment number for the given participant - * @param participantId participant id to get the equipment number for - * @return equipment number or 0 in case of failure - */ - int getEquipmentNumber(int participantId) const; - - /** - * Get all participants which are assigned to a room - * @return QMap - */ - QMap getAllAssignedParticipants() const; - -Q_SIGNALS: - /** - * Signal is emitted when participant position changed (Signal to HandlerOverlay) - */ - void participantPositionChanged(int oldRoomId, int newRoomId, int participantId); - -private Q_SLOTS: - /** - * Handle the signals from 'ParticipantManagement' - */ - void onParticipantChanged(const ParticipantManagement::Participant &data, DataModification modType); - void onParticipantPositionChanged(const ParticipantManagement::ParticipantPosition &data, DataModification modType); - -private: // methoden - -private: // attributes - std::shared_ptr m_ddsHandler; ///< Pointer to VOM DDS handler - - std::shared_ptr m_dtc; ///< Pointer to DTC ParticipantManagement interface object - - QMap m_partId2EquipNoMap; ///< Reference map participant (player) to equipment number (participantId, equipmentNo) - QMap m_participantsPositionMap; ///< Reference map participant (player) to room id (participantId, roomId) - - NGL::INGLLogger &m_logger; ///< Interface to the Logging-Facility - -}; -} // namespace VideoOverlayManagement - diff --git a/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/log4cxx_vom.props b/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/log4cxx_vom.props deleted file mode 100755 index bcda5b186..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/log4cxx_vom.props +++ /dev/null @@ -1,84 +0,0 @@ -log4j.reset=true -log4j.rootLogger=WARN, file - -# Service: VideoOverlayManagement -########################################################### - -#log4j.logger.VOM=DEBUG -#log4j.logger.VOM.main=DEBUG -#log4j.logger.VOM.AVS_Interface=DEBUG -#log4j.logger.VOM.DdsHandler=DEBUG -#log4j.logger.VOM.HandlerInfrastructureData=DEBUG -#log4j.logger.VOM.HandlerOverlays=DEBUG -#log4j.logger.VOM.HandlerParticipantData=DEBUG -#log4j.logger.VOM.MainHandler=DEBUG - -# File -########################################################### -log4j.appender.file=Lts::RollingFileAppender -log4j.appender.file.MaxFileSize=1MB -log4j.appender.file.MaxBackupIndex=9 -log4j.appender.file.layout=org.apache.log4j.PatternLayout -log4j.appender.file.layout.ConversionPattern=%d %-5p %c |#| %m (%.50F:%L) %n - - -# Appnd_Console -########################################################### -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern= %d %p %c %c{1} - %m (%-.30F:%L) %n - - -# Appnd_Syslog -########################################################### -log4j.appender.syslog=org.apache.log4j.SyslogAppender -log4j.appender.syslog.Threshold=ERROR -log4j.appender.syslog.SysLogHost=localhost -log4j.appender.syslog.Facility=LOCAL7 -log4j.appender.syslog.layout=org.apache.log4j.PatternLayout -log4j.appender.syslog.layout.ConversionPattern= %-4r %-5p %c %x - %m -log4j.appender.syslog.LevelRangeFilter.AcceptOnMatch=true -log4j.appender.syslog.LevelRangeFilter.LevelMin=INFO -log4j.appender.syslog.LevelRangeFilter.LevelMax=FATAL - - -########################################################### -########################################################### -########################################################### -# 1) Available Levels in LOG4CXX Version 0.10.0: -# TRACE, -# DEBUG, -# INFO, -# WARN, -# ERROR -# FATAL -# -# d = date/time -# p = priority (Level) -# c = category/channel -# m = message -# F = file -# L = line -# n = platform dependent line separator character or characters. -# .... -# -# Examples for console: -# a) -# %d %p %c #%m# (%.50F:%L)%n -# date/time -# priority -# category/channel -# #message# -# (Maximal 50Character des Filename von rechts:Line) -# line separator -# -# b) -# %d (%.15F:%L) %-5p %c |#| %m%n -# date/time -# (Maximal 15Character des Filename von rechts:Line) -# priority, Right pad with spaces if the priority name is less than 5 characters long. -# category/channel -# message -# line separator -# -# Examples for files: diff --git a/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/logger.cpp b/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/logger.cpp deleted file mode 100755 index 2cfd05e99..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/logger.cpp +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Building Config - logging facility - * $Id$ - * $HeadURL$ - * $Author$ - * Created by hjl, SLSE, 2016-06-23 - */ - -#include "logger.h" -#include - -namespace VideoOverlayManagement -{ - -LOGGER_T getLogger(const char *name) -{ - static const char ns[] = "VOM."; - std::string loggerName; - const size_t len = strlen(name); - loggerName.reserve(sizeof(ns) + len); - loggerName.append(ns, sizeof(ns) - 1); - loggerName.append(name, len); - - try - { - return NGL::NGLLoggerBootstrap::getNGLRootLogger(). - getNGLLogger(loggerName); - } - catch (const std::exception &ex) - { - fprintf(stderr, "Error retrieving logger: %s", ex.what()); - abort(); - } -} - -} // namespace VideoOverlayManagement diff --git a/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/logger.h b/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/logger.h deleted file mode 100755 index 884c306cc..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/logger.h +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Logging for VideoOverlayManagement - * $Id$ - * $HeadURL$ - * $Author$ - * Created by hjl, SLSE, 2016-06-23 - */ - -#pragma once - -#include -#include "vom_export.h" - -namespace VideoOverlayManagement -{ -using LOGGER_T = NGL::INGLLogger &; - -LOGGER_T getLogger(const char *name); -inline LOGGER_T getLogger(const QString &loggerName) -{ - return getLogger(loggerName.toUtf8().constData()); -} -} // namespace VideoOverlayManagement diff --git a/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/main.cpp b/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/main.cpp deleted file mode 100755 index 392377738..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/main.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/** - * Main for VideoOverlayManagement - * $Id$ - * $HeadURL$ - * $Author$ - * Created by hjl, SLSE, 2016-06-22 - */ - -#include -#include -#include - -#include "main_handler.h" -#include "logger.h" -#include "settings.h" - - -int main(int argc, char **argv) -{ - NGLCoreApplication app(argc, argv); - QNetworkProxy::setApplicationProxy(QNetworkProxy()); - - LtsCommandLineParser::LtsCommandLineParser options; - if (!options.init()) - return -1; - app.createLogger("VOM", options.exerciseId()); - - if (options.exerciseId() < 0) - { - fprintf(stdout, "=> exerciseId is required (>=0)"); - return -2; - } - - INFO_LOG(app.baseLogger()) << "*** Start Video Overlay Management Service (VOM)"; - INFO_LOG(app.baseLogger()) << "### domainId: " << options.domainId() << ", exerciseId: #" << options.exerciseId(); - - VideoOverlayManagement::Settings::setIniFile(options.iniFile()); - int iRet = -1; - { - std::unique_ptr mainHandler(new VideoOverlayManagement::MainHandler); - if (!mainHandler->init(options.domainId(), options.exerciseId())) - return iRet; - - STARTUP_LOG(app.baseLogger()); - - iRet = app.exec(); - - SHUTDOWN_LOG(app.baseLogger()); - } - - return iRet; -} // end of main() -//----------------------------------------------------------------------------- diff --git a/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/main_handler.cpp b/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/main_handler.cpp deleted file mode 100755 index 9867c8b74..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/main_handler.cpp +++ /dev/null @@ -1,214 +0,0 @@ -/** - * MainHandler for VideoOverlayManagement - * $Id$ - * $HeadURL$ - * $Author$ - * Created by hjl, SLSE, 2016-06-23 - */ - -#include "main_handler.h" -#include "settings.h" - -#include - -#include - -using namespace VideoOverlayManagement; - -MainHandler::MainHandler(QObject *parent) - : QObject(parent) - , m_exerciseId(0) - , m_avsIf(new AvsInterface(true, this)) - , m_avsConnectionState(AvsIfConnectionState::Undefined) - , m_ddsHandler(nullptr) - , m_handlerParticipantData(nullptr) - , m_handlerInfrastructureData(nullptr) - , m_handlerOverlays(nullptr) - , m_checkConnectTimer(new QTimer(this)) - , m_keepAliveTriggerTimer(new QTimer(this)) - , m_bAvsSocketWarnedOnce(false) - , m_logger(getLogger("MainHandler")) -{ -} // end of ctor() -//----------------------------------------------------------------------------- - -MainHandler::~MainHandler() -{ - m_ddsHandler.reset(); -} // end of dtor() -//----------------------------------------------------------------------------- - -bool MainHandler::init(int domainId, int exerciseId) -{ - INFO_LOG(m_logger) << "Start VideoOverlayManagement MainHandler."; - - m_exerciseId = exerciseId; - - // init AVS-Interface - QString hostName = Settings::getAvsHostname(); - quint16 port = Settings::getAvsAvaPort(); - INFO_LOG(m_logger) << "Init AVS-Interface Hostname/Ip:" << hostName - << " Port: " << port; - - m_avsIf->start(hostName, port); - - connect(m_avsIf, &AvsInterface::avsIfConnectionState, - this, &MainHandler::onAvsIfConnectionState); - - connect(m_avsIf, &AvsInterface::avsCmdState, - this, &MainHandler::onAvsCmdState); - - connect(m_avsIf, &AvsInterface::avsKeepAliveTimeout, - this, &MainHandler::onAvsKeepAliveTimeout); - - connect(m_keepAliveTriggerTimer, &QTimer::timeout, - this, &MainHandler::onSendKeepAlive); - - // initialize DDS - // for VideoOverlayManagement => exerciseId = partitionId - m_ddsHandler.reset(new DdsHandler(domainId, exerciseId)); - if (!m_ddsHandler->init()) - { - ERROR_LOG(m_logger) << "Initialisation DdsHandler failed."; - if (m_ddsHandler->pacemaker()) - m_ddsHandler->pacemaker()->setNewState(Core::RunningState::StartingError); - return false; - } - - // initialize handlerParticipantData - m_handlerParticipantData.reset(new HandlerParticipantData(m_ddsHandler, this)); - - if (!m_handlerParticipantData->init()) - { - ERROR_LOG(m_logger) << "Initialisation HandlerPlayerData failed."; - m_ddsHandler->pacemaker()->setNewState(Core::RunningState::StartingError); - return false; - } - - // initialize handlerInfraStructureData - m_handlerInfrastructureData.reset(new HandlerInfrastructureData(m_ddsHandler, this)); - - if (!m_handlerInfrastructureData->init(m_exerciseId)) - { - ERROR_LOG(m_logger) << "Initialisation HandlerInfrastructreData failed."; - m_ddsHandler->pacemaker()->setNewState(Core::RunningState::StartingError); - return false; - } - - // Initialisation of OverlayHandler wait until AVS is connected - connect(m_checkConnectTimer, &QTimer::timeout, - this, &MainHandler::onTryToInitOverlayHandler); - m_checkConnectTimer->start(1000); - - INFO_LOG(m_logger) << "VOM Handler initialized. (Connection to AVS may be still pending) "; - m_ddsHandler->pacemaker()->setNewState(Core::RunningState::Starting); - - return true; -} // end of init() -//----------------------------------------------------------------------------- - -bool MainHandler::onTryToInitOverlayHandler() -{ - m_avsConnectionState = m_avsIf->getAvsIfState(); - if (m_avsConnectionState != AvsIfConnectionState::Connected) - { - if (!m_bAvsSocketWarnedOnce) - { - m_bAvsSocketWarnedOnce = true; - WARNING_LOG(m_logger) << "MainHandler::onTryToInitOverlayHandler()" - << " Wait for AvsIfConnectionState::Connected... "; - } - return false; - } - m_bAvsSocketWarnedOnce = true; // reset - - m_checkConnectTimer->stop(); - - // initialize handlerOverlays - m_handlerOverlays.reset(new HandlerOverlays(m_avsIf, m_handlerParticipantData, m_handlerInfrastructureData, m_exerciseId, this)); - - if (!m_handlerOverlays->init()) - { - ERROR_LOG(m_logger) << "Initialisation HandlerOverlays failed."; - m_ddsHandler->pacemaker()->setNewState(Core::RunningState::StoppedError); - return false; - } - - INFO_LOG(m_logger) << "VOM Handler initialized. (Connection to AVS established) "; - m_ddsHandler->pacemaker()->setNewState(Core::RunningState::Running); - - return true; -} // end of onTryToInitOverlayHandler() -//----------------------------------------------------------------------------- - -void MainHandler::onAvsIfConnectionState(AvsIfConnectionState state) -{ - switch (state) - { - case AvsIfConnectionState::Connected: - INFO_LOG(m_logger) << "AvsIfConnectionState::Connected ... start keepAliveTriggerTimer"; - m_keepAliveTriggerTimer->start(Settings::getAvsKeepAliveTriggerRequestTime()); - break; - case AvsIfConnectionState::Disconnected: - m_keepAliveTriggerTimer->stop(); - break; - case AvsIfConnectionState::TryReconnect: - m_keepAliveTriggerTimer->stop(); - break; - case AvsIfConnectionState::ConnectionError: - ERROR_LOG(m_logger) << "AvsIfConnectionState::ConnectionError !"; - m_keepAliveTriggerTimer->stop(); - m_ddsHandler->pacemaker()->setNewState(Core::RunningState::StoppedError); - break; - case AvsIfConnectionState::Undefined: - default: - WARNING_LOG(m_logger) << "Undefined AvsIfConnectionState !"; - break; - } -} // end of onAvsIfConnectionState() -//----------------------------------------------------------------------------- - -void MainHandler::onAvsCmdState(AvsCmdState state) -{ - bool bOk = false; - switch (state) - { - case AvsCmdState::Ok: - INFO_LOG(m_logger) << "AvsCmdState::Ok"; - bOk = true; - break; - case AvsCmdState::BadArguments: - WARNING_LOG(m_logger) << "AvsCmdState::BadArguments"; - break; - case AvsCmdState::CommandNotStateValid: - WARNING_LOG(m_logger) << "AvsCmdState::CommandNotStateValid"; - break; - case AvsCmdState::KeepAlive: - DEBUG_LOG(m_logger) << "AvsCmdState::KeepAlive"; - break; - default: - break; - } - - if (!bOk) - { - // ToDo: Fehlermeldung an ServiceManagement senden - } -} // end of onAvsCmdState() -//----------------------------------------------------------------------------- - -void MainHandler::onAvsKeepAliveTimeout() -{ - // ToDo: Fehlermeldung an ServiceManagement senden - WARNING_LOG(m_logger) << "AVS KeepAlive timeout !"; -} // end of onAvsKeepAliveTimeout() -//----------------------------------------------------------------------------- - -void MainHandler::onSendKeepAlive() -{ - QString cmd(QLatin1String("KEEPALIVE")); - QByteArray qba = cmd.toLatin1(); - qba += "\r\n"; - m_avsIf->sendCommand(qba); -} // end of onSendKeepAlive() -//----------------------------------------------------------------------------- diff --git a/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/main_handler.h b/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/main_handler.h deleted file mode 100755 index d885ff335..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/main_handler.h +++ /dev/null @@ -1,69 +0,0 @@ -/** - * MainHandler for VideoOverlayManagement - * $Id$ - * $HeadURL$ - * $Author$ - * Created by hjl, SLSE, 2016-06-23 - */ - -#pragma once - -#include - -#include "avs_interface.h" -#include "handler_participant_data.h" -#include "handler_infrastructure_data.h" -#include "handler_overlays.h" -#include "dds_handler.h" -#include "logger.h" - -class QTimer; - -namespace VideoOverlayManagement -{ -// Forwarddeclarations -class AvsInterface; - -class MainHandler - : public QObject -{ - Q_OBJECT -public: - explicit MainHandler(QObject *parent = nullptr); - ~MainHandler(); - - bool init(int domainId, int exerciseId); - -private Q_SLOTS: - /** - * Handle signals for AVS Handling - */ - void onAvsIfConnectionState(AvsIfConnectionState state); - void onAvsCmdState(AvsCmdState state); - void onAvsKeepAliveTimeout(); - bool onTryToInitOverlayHandler(); ///< Initialize OverlayHandler after sucessfully AVS connection - - /** - * Sends a keep alive request to the server. Normally this method is - * called periodically by the KeepAliveTimer. - */ - void onSendKeepAlive(); - - -private: // attributes - int m_exerciseId; ///< Exercise id - AvsInterface *m_avsIf; ///< Pointer to AVS-Interface - AvsIfConnectionState m_avsConnectionState; ///< AVS connection state - std::shared_ptr m_ddsHandler; ///< Pointer to DDS handler - std::shared_ptr m_handlerParticipantData; ///< Pointer to participant data handler - std::shared_ptr m_handlerInfrastructureData; ///< Pointer to infrastructure data handler - std::unique_ptr m_handlerOverlays; ///< Pointer to overlay handler - - QTimer *m_checkConnectTimer; ///< Wait for AVS connected. - QTimer *m_keepAliveTriggerTimer; ///< Timer for triggering the keep alive request - bool m_bAvsSocketWarnedOnce; - - NGL::INGLLogger &m_logger; ///< Interface to the Logging-Facility - -}; -} // namespace VideoOverlayManagement diff --git a/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/settings.cpp b/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/settings.cpp deleted file mode 100755 index 743645c7f..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/settings.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/** - * Settings for VideoOverlayManagement - * $Id$ - * $HeadURL$ - * $Author$ - * Created by hjl, SLSE, 2016-06-30 - */ - -#include "settings.h" - -#include -#include -#include -#include - -namespace VideoOverlayManagement -{ -class NGLSettingsClass : public NGL::Settings -{ -public: - NGLSettingsClass() - : NGL::Settings(s_iniFile.isEmpty() ? NGL::findProjectConfigFile() : s_iniFile) - {} - static void setIniFile(const QString &fn) - { - s_iniFile = fn; - } - static QString s_iniFile; -}; -QString NGLSettingsClass::s_iniFile; -Q_GLOBAL_STATIC(NGLSettingsClass, s) - -//--------------------------------------------------------------------- - -QString Settings::getAvsHostname() -{ - return NGL::Connections::hostName(NGL::Connections::eConnection::AVS_AVA); -} -//--------------------------------------------------------------------- - -quint16 Settings::getAvsAvaPort() -{ - return NGL::Connections::port(NGL::Connections::eConnection::AVS_AVA); -} -//--------------------------------------------------------------------- - -quint16 Settings::getAvsKeepAliveTriggerRequestTime() -{ - // Info: AVS schickt alle 20 sec '298 KEEPALIVE' aufgrund eines KEEPALIVE Requesttrigger aus MainHandler! - quint16 keepAliveTriggerRequestTime = settings()->settings()->value(QLatin1String("zwav_connection/keepAliveTriggerRequestTime"), 1000 * 20).toUInt(); - return keepAliveTriggerRequestTime; -} -//--------------------------------------------------------------------- - -quint16 Settings::getAvsKeepAliveTime() -{ - // Mit dieser Timeoutzeit wird beim Ausbleiben von '298 KEEPALIVE' der Fehlerfall dedektiert. - quint16 keepAliveTime = settings()->settings()->value(QLatin1String("zwav_connection/keepAliveTime"), 1000 * 25).toUInt(); - return keepAliveTime; -} -//--------------------------------------------------------------------- - -QString Settings::getOverlayTemplateName() -{ - return QLatin1String("bottomcenter"); -} -//--------------------------------------------------------------------- - -QString Settings::getContextName() -{ - // ToDo: Nach Umstellung von AVS den 'EXCON' Namen 'ex_' verwenden! - return QLatin1String("uebung_"); -} -//--------------------------------------------------------------------- -NGL::Settings *Settings::settings() -{ - return s(); -} -//--------------------------------------------------------------------- -void Settings::setIniFile(const QString &ini) -{ - NGLSettingsClass::setIniFile(ini); -} - -} // namespace VideoOverlayManagement diff --git a/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/settings.h b/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/settings.h deleted file mode 100755 index 359894ed5..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/settings.h +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Settings for VideoOverlayManagement - * $Id$ - * $HeadURL$ - * $Author$ - * Created by hjl, SLSE, 2016-06-30 - */ - -#pragma once -#include - -namespace NGL -{ -class Settings; -} - -namespace VideoOverlayManagement -{ -namespace Settings -{ -//!< Get the hostname for AVS -QString getAvsHostname(); - -//!< Get the port for AVS RCP_AVA -quint16 getAvsAvaPort(); - -//!< Get AVS keep-alive trigger request time intervall in msec -quint16 getAvsKeepAliveTriggerRequestTime(); - -//!< Get AVS keep-alive time intervall in msec -quint16 getAvsKeepAliveTime(); - -//!< Get overlay template name used for AVS textoutput -QString getOverlayTemplateName(); - -//!< Get context name used for AVS textoutput -QString getContextName(); - -//!< The real NGL::Settings - object -NGL::Settings *settings(); -void setIniFile(const QString &ini); -} - -} // namespace VideoOverlayManagement diff --git a/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/vom_dtc.h b/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/vom_dtc.h deleted file mode 100644 index a2bef79fa..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/vom_dtc.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef VOM_DTC_H -#define VOM_DTC_H - -// Stub file for vom_dtc.h - generated code placeholder -// This file is auto-generated from vom_service.xml when BUILD_GRANTLEE=ON -// For BUILD_GRANTLEE=OFF, this stub allows compilation to proceed - -namespace VideoOverlayManagement { -namespace Dds { - -// Forward declarations - actual definitions in generated code -class Dtc; - -} // namespace Dds -} // namespace VideoOverlayManagement - -#endif // VOM_DTC_H diff --git a/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/vom_export.h b/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/vom_export.h deleted file mode 100755 index b52a528fb..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/vom_export.h +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Export definitions - * $Id$ - * $HeadURL$ - * $Author$ - * Created by hjl, SLSE, 2016-06-23 - */ -#pragma once - -#include - -#ifndef VOM_COMMON_EXPORT -# ifdef BUILD_STATIC_LIBRARIES -# define VOM_COMMON_EXPORT -# else -# if defined(MAKE_SVCVOMCOMMON_LIB) -# define VOM_COMMON_EXPORT Q_DECL_EXPORT -# ifndef WIN32 -# ifdef NDDSUSERDllExport -# undef NDDSUSERDllExport -# endif -# define NDDSUSERDllExport Q_DECL_EXPORT -# endif -# else -# define VOM_COMMON_EXPORT Q_DECL_IMPORT -# endif -# endif -#endif - -#ifndef VOM_CLIENT_EXPORT -# ifdef BUILD_STATIC_LIBRARIES -# define VOM_CLIENT_EXPORT -# else -# if defined(MAKE_SVCVOMCLIENT_LIB) -# define VOM_CLIENT_EXPORT Q_DECL_EXPORT -# else -# define VOM_CLIENT_EXPORT Q_DECL_IMPORT -# endif -# endif -#endif - -#ifndef VOM_SERVER_EXPORT -# ifdef BUILD_STATIC_LIBRARIES -# define VOM_SERVER_EXPORT -# else -# if defined(MAKE_SVCVOMSERVER_LIB) -# define VOM_SERVER_EXPORT Q_DECL_EXPORT -# else -# define VOM_SERVER_EXPORT Q_DECL_IMPORT -# endif -# endif -#endif diff --git a/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/vom_ftc.h b/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/vom_ftc.h deleted file mode 100644 index ac86047c5..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/vom_ftc.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef VOM_FTC_H -#define VOM_FTC_H - -// Stub file for vom_ftc.h - generated code placeholder -// This file is auto-generated from vom_service.xml when BUILD_GRANTLEE=ON -// For BUILD_GRANTLEE=OFF, this stub allows compilation to proceed - -namespace VideoOverlayManagement { -namespace Dds { - -// Forward declarations - actual definitions in generated code -class Ftc; - -} // namespace Dds -} // namespace VideoOverlayManagement - -#endif // VOM_FTC_H diff --git a/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/vom_service.xml b/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/vom_service.xml deleted file mode 100755 index 735b19b73..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Services/VideoOverlayManagement/vom_service.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/qt6-after/qt6-migrated-legatus/Lts/Services/skeleton/base/CMakeLists.txt b/qt6-after/qt6-migrated-legatus/Lts/Services/skeleton/base/CMakeLists.txt deleted file mode 100755 index 264f0bad5..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Services/skeleton/base/CMakeLists.txt +++ /dev/null @@ -1,148 +0,0 @@ -# -# $Id$ -# $HeadURL$ -# $Author$ -# - -INCLUDE(MacroRTIDDSGen) -INCLUDE(MacroCodeGenIdl) - -SET(xml_FILE xxx_service.xml) - -# -# --- Library svcXxxCommon -------------------------------------------------------------------------------- -# -SET(SRCS_common - xxx_export.h - logger.cpp - logger.h -) - -# Generate xxx_enums.idl / xxx.idl -CODEGEN_IDL_SVC(SRCS_common ${xml_FILE}) - -# Generate *.cpp/*.hpp from idl -RTIDDSGEN(SRCS_common xxx_enums.idl) -RTIDDSGEN(SRCS_common xxx.idl) - -# Generate xxx_dt[s,c]_types.h, xxx_ft[s,c]_types.h -CODEGEN_TOPIC_TYPEDEFS(SRCS_common ${xml_FILE}) -# Generate xxx_[d|f]tc.h -CODEGEN_CLIENT_TOPICS_IFC(SRCS_common ${xml_FILE}) - -NGL_ADD_LIBRARY(AAR SV WS svcXxxCommon SHARED ${SRCS_common}) -NGL_TARGET_INCLUDE_DIRECTORIES(svcXxxCommon - PUBLIC - ${CMAKE_CURRENT_SOURCE_DIR}/../ - ${CMAKE_CURRENT_BINARY_DIR}/../ -) -NGL_TARGET_LINK_LIBRARIES(svcXxxCommon - PRIVATE - RTI::nddscpp2 - PUBLIC - Qt6::Core - $,ddscore,> - NGLLogger -) -NGL_INSTALL_TARGET(svcXxxCommon) - -# -# --- Library svcXxxClient -------------------------------------------------------------------------------- -# -SET(SRCS_client - xxx_export.h -) -# generate xxx_[d|f]tc.h, xxx_[d|f]tc_impl.[cpp|h] -CODEGEN_CLIENT_TOPICS_IMPL(SRCS_client ${xml_FILE}) - -NGL_ADD_LIBRARY(AAR SV WS svcXxxClient SHARED ${SRCS_client}) -NGL_TARGET_INCLUDE_DIRECTORIES(svcXxxClient - PUBLIC - ${CMAKE_CURRENT_SOURCE_DIR}/../ - ${CMAKE_CURRENT_BINARY_DIR}/../ -) - -NGL_TARGET_LINK_LIBRARIES(svcXxxClient - PRIVATE - RTI::nddscpp2 - $,ddsconnector,> - PUBLIC - svcXxxCommon - ddsftc -) -NGL_INSTALL_TARGET(svcXxxClient) - -# -# --- Library svcXxxServer -------------------------------------------------------------------------------- -# -SET(SRCS_server - xxx_export.h -) -# generate xxx_[d|f]ts.h, xxx_[d|f]ts_impl.[cpp|h] -CODEGEN_SERVER_TOPICS(SRCS_server ${xml_FILE}) -# Generate xxx_db_impl.cpp/.h, xxx_db.h -CODEGEN_DATABASE(SRCS_server ${xml_FILE}) - -NGL_ADD_LIBRARY(AAR SV svcXxxServer SHARED ${SRCS_server}) -NGL_TARGET_INCLUDE_DIRECTORIES(svcXxxServer - PUBLIC - ${CMAKE_CURRENT_SOURCE_DIR}/../ - ${CMAKE_CURRENT_BINARY_DIR}/../ -) - -NGL_TARGET_LINK_LIBRARIES(svcXxxServer - PRIVATE - RTI::nddscpp2 - $,ddsconnector,> - ddsfts - ngldb - PUBLIC - svcXxxCommon -) -NGL_INSTALL_TARGET(svcXxxServer) - -# -# --- Topic Type Plugin -------------------------------------------------------------- -# -CREATE_TOPIC_TYPE_PLUGIN(${xml_FILE}) - -# -# --- Executable svcXxxXxxXxx (sXXX) ------------------------------------------------- -# -SET(SRCS_exe - main.cpp - main_handler.cpp - main_handler.h - dds_handler.cpp - dds_handler.h - settings.cpp - settings.h - ${xml_FILE} -) - -# Generate xxx.sql, xxx.xml -CODEGEN_SQL(SRCS_exe ${xml_FILE}) - -NGL_ADD_SVC_ICON(SRCS_exe) -NGL_ADD_EXECUTABLE(AAR SV svcXxxXxxXxx ${SRCS_exe}) -NGL_TARGET_LINK_LIBRARIES(svcXxxXxxXxx - Qt6::Core - svcXxxCommon - svcXxxServer - svcCorePacemaker - $,ddsconnector,> - nglsettings - ProjectConfig - LtsCommandLineParser - NGLLogger - nglcoreapplication - ngltools -) -NGL_INSTALL_TARGET(svcXxxXxxXxx) -NGL_INSTALL(AAR SV FILES log4cxx_xxx.props DESTINATION bin) -NGL_ADD_TARGET_LINK(svcXxxXxxXxx sXXX) - -# Uncomment if necessary -#ADD_SUBDIRECTORY(UnitTests) -#ADD_SUBDIRECTORY(ModuleTests) - diff --git a/qt6-after/qt6-migrated-legatus/Lts/Services/skeleton/base/dds_handler.cpp b/qt6-after/qt6-migrated-legatus/Lts/Services/skeleton/base/dds_handler.cpp deleted file mode 100755 index f9d9b6691..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Services/skeleton/base/dds_handler.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/** - * DdsHandler for DDS - * $Id$ - * $HeadURL$ - * $Author$ - * Created by Hanna E. Rathje, SLSE, 2015-09-02 - */ - -#include "dds_handler.h" - -#include "xxx_dts.h" -#include "xxx_fts.h" - -#include -#include - -namespace XxxXxxXxx -{ - -DdsHandler::DdsHandler(int domainId, int exerciseId) - : m_ddsConnector(std::make_shared(domainId, IDL::PartitionType::FIXME, exerciseId)) - , m_logger(getLogger("DdsHandler")) -{ - DEBUG_LOG(m_logger) << "DdsHandler(" << domainId << ") for partition: " << m_ddsConnector->getDefaultPartition(); -} - -DdsHandler::~DdsHandler() -{} - -bool DdsHandler::init(const QStringList &qosFileList) -{ - if(!m_ddsConnector->init(qosFileList)) - { - ERROR_LOG(m_logger) << "Error initializing dds connections - aborting"; - return false; - } - - // default initialize Publisher and Subscriber - m_ddsConnector->initPublisherSubscriber(); - - // Pacemaker - m_dtsCurrentRunningState.reset(m_ddsConnector->createDTS()); - assert(m_dtsCurrentRunningState.get()); - m_pacemaker = std::make_shared(m_dtsCurrentRunningState); - - m_ddsDts = XxxXxxXxx::Interface::Dts::create(m_ddsConnector); - m_ddsFts = XxxXxxXxx::Interface::Fts::create(m_ddsConnector); - - bool bRet = m_ddsDts->enableAll(); - INFO_LOG(m_logger) << "Dts initialised"; - - bRet &= m_ddsFts->enableAll(); - INFO_LOG(m_logger) << "Fts initialised"; - - // TODO: call at the end of main_handler init: - //m_ddsHandler->pacemaker()->setNewState(Core::RunningState::Running); - - return bRet; -} - -} // Namespace PDM diff --git a/qt6-after/qt6-migrated-legatus/Lts/Services/skeleton/base/dds_handler.h b/qt6-after/qt6-migrated-legatus/Lts/Services/skeleton/base/dds_handler.h deleted file mode 100755 index 3f7fbc3d8..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Services/skeleton/base/dds_handler.h +++ /dev/null @@ -1,57 +0,0 @@ -/** - * DdsHandler for DDS - * $Id$ - * $HeadURL$ - * $Author$ - * Created by Hanna E. Rathje, SLSE, 2015-09-02 - */ - -#pragma once - -#include -#include - -#include -#include -#include "logger.h" - -namespace Core -{ -class Pacemaker; -} - -namespace XxxXxxXxx -{ -class DdsHandler final -{ -public: - DdsHandler(int domainId, int exerciseId); - ~DdsHandler(); - - bool init(const QStringList &qosFileList = QStringList()); - - std::shared_ptr pacemaker() const - { - return m_pacemaker; - } - - std::shared_ptr dts() const - { - return m_ddsDts; - } - std::shared_ptr fts() const - { - return m_ddsFts; - } - -private: - std::shared_ptr m_ddsConnector; - std::shared_ptr m_dtsCurrentRunningState; - std::shared_ptr m_pacemaker; - std::shared_ptr m_ddsDts; - std::shared_ptr m_ddsFts; - - NGL::INGLLogger &m_logger; -}; - -} // namespace XxxXxxXxx diff --git a/qt6-after/qt6-migrated-legatus/Lts/Services/skeleton/base/log4cxx_xxx.props b/qt6-after/qt6-migrated-legatus/Lts/Services/skeleton/base/log4cxx_xxx.props deleted file mode 100755 index a95d2e574..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Services/skeleton/base/log4cxx_xxx.props +++ /dev/null @@ -1,80 +0,0 @@ -log4j.reset=true -log4j.rootLogger=WARN, file - -# Service: XxxXxxXxx -########################################################### - -#log4j.logger.XXX=DEBUG -#log4j.logger.XXX.main=DEBUG -#log4j.logger.XXX.DdsHandler=DEBUG -#log4j.logger.XXX.MainHandler=DEBUG - -# -# Lts::RollingFileAppender -log4j.appender.file=Lts::RollingFileAppender -log4j.appender.file.MaxFileSize=1MB -log4j.appender.file.MaxBackupIndex=9 -log4j.appender.file.layout=org.apache.log4j.PatternLayout -log4j.appender.file.layout.ConversionPattern=%d %-5p %c |#| %m (%.50F:%L) %n - - -# Appnd_Console -########################################################### -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern= %d %p %c %c{1} - %m (%-.30F:%L) %n - - -# Appnd_Syslog -########################################################### -log4j.appender.syslog=org.apache.log4j.SyslogAppender -log4j.appender.syslog.Threshold=ERROR -log4j.appender.syslog.SysLogHost=localhost -log4j.appender.syslog.Facility=LOCAL7 -log4j.appender.syslog.layout=org.apache.log4j.PatternLayout -log4j.appender.syslog.layout.ConversionPattern= %-4r %-5p %c %x - %m -log4j.appender.syslog.LevelRangeFilter.AcceptOnMatch=true -log4j.appender.syslog.LevelRangeFilter.LevelMin=INFO -log4j.appender.syslog.LevelRangeFilter.LevelMax=FATAL - - -########################################################### -########################################################### -########################################################### -# 1) Available Levels in LOG4CXX Version 0.10.0: -# TRACE, -# DEBUG, -# INFO, -# WARN, -# ERROR -# FATAL -# -# d = date/time -# p = priority (Level) -# c = category/channel -# m = message -# F = file -# L = line -# n = platform dependent line separator character or characters. -# .... -# -# Examples for console: -# a) -# %d %p %c #%m# (%.50F:%L)%n -# date/time -# priority -# category/channel -# #message# -# (Maximal 50Character des Filename von rechts:Line) -# line separator -# -# b) -# %d (%.15F:%L) %-5p %c |#| %m%n -# date/time -# (Maximal 15Character des Filename von rechts:Line) -# priority, Right pad with spaces if the priority name is less than 5 characters long. -# category/channel -# message -# line separator -# -# Examples for files: diff --git a/qt6-after/qt6-migrated-legatus/Lts/Services/skeleton/base/logger.cpp b/qt6-after/qt6-migrated-legatus/Lts/Services/skeleton/base/logger.cpp deleted file mode 100755 index 135e46f6e..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Services/skeleton/base/logger.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/** - * @RDE_HEADER@ - * Building Config - logging facility - * $Id$ - * $HeadURL$ - * $Author$ - */ - -#include "logger.h" - -#include - -namespace XxxXxxXxx -{ - -LOGGER_T getLogger(const char *name) -{ - static const char ns[] = "XXX."; - std::string loggerName; - const size_t len = strlen(name); - loggerName.reserve(sizeof(ns) + len); - loggerName.append(ns, sizeof(ns) - 1); - loggerName.append(name, len); - - try - { - return NGL::NGLLoggerBootstrap::getNGLRootLogger(). - getNGLLogger(loggerName); - } - catch (const std::exception &ex) - { - fprintf(stderr, "Error retrieving logger: %s", ex.what()); - abort(); - } -} - -} // namespace XxxXxxXxx diff --git a/qt6-after/qt6-migrated-legatus/Lts/Services/skeleton/base/logger.h b/qt6-after/qt6-migrated-legatus/Lts/Services/skeleton/base/logger.h deleted file mode 100755 index 2b699861d..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Services/skeleton/base/logger.h +++ /dev/null @@ -1,23 +0,0 @@ -/** - * @RDE_HEADER@ - * Logging for XxxXxxXxx - * $Id$ - * $HeadURL$ - * $Author$ - */ - -#pragma once - -#include -#include "xxx_export.h" - -namespace XxxXxxXxx -{ -using LOGGER_T = NGL::INGLLogger &; - -XXX_COMMON_EXPORT LOGGER_T getLogger(const char *name); -inline LOGGER_T getLogger(const QString &loggerName) -{ - return getLogger(loggerName.toUtf8().constData()); -} -} // namespace XxxXxxXxx diff --git a/qt6-after/qt6-migrated-legatus/Lts/Services/skeleton/base/main.cpp b/qt6-after/qt6-migrated-legatus/Lts/Services/skeleton/base/main.cpp deleted file mode 100755 index 8f6afd4b2..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Services/skeleton/base/main.cpp +++ /dev/null @@ -1,42 +0,0 @@ -/** - * @RDE_HEADER@ - * main for XxxXxxXxx - * $Id$ - * $HeadURL$ - * $Author$ - */ - -#include -#include - -#include "main_handler.h" -#include "logger.h" -#include "settings.h" - -int main(int argc, char **argv) -{ - NGLCoreApplication app(argc, argv); - - LtsCommandLineParser::LtsCommandLineParser options; - if (!options.init()) - return -1; - app.createLogger("XXX", options.exerciseId()); - - XxxXxxXxx::Settings::setIniFile(options.iniFile()); - - int iRet = -3; - { - std::unique_ptr mainHandler(new XxxXxxXxx::MainHandler); - - if (!mainHandler->init(options.domainId(), options.exerciseId())) - return iRet; - - STARTUP_LOG(app.baseLogger()); - - iRet = app.exec(); - - SHUTDOWN_LOG(app.baseLogger()); - } - - return iRet; -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Services/skeleton/base/main_handler.cpp b/qt6-after/qt6-migrated-legatus/Lts/Services/skeleton/base/main_handler.cpp deleted file mode 100755 index 97ac971ac..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Services/skeleton/base/main_handler.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/** - * MainHandler for AssetManagement - * $Id$ - * $HeadURL$ - * $Author$ - */ - -#include "main_handler.h" - -#include -#include - -namespace XxxXxxXxx -{ - -MainHandler::MainHandler(QObject *parent) - : QObject(parent) - , m_ddsHandler(nullptr) - , m_dbHandler(nullptr) - , m_logger(getLogger("MainHandler")) -{} - -MainHandler::~MainHandler() -{ - m_ddsHandler = nullptr; - m_dbHandler = nullptr; -} - -bool MainHandler::init(int domainId) -{ - - // initialize database - m_dbHandler = std::make_shared(); - - if (!m_dbHandler->init(0, Settings::settings(), m_logger)) - { - ERROR_LOG(m_logger) << "Initialisation dbHandler failed."; - return false; - } - DEBUG_LOG(m_logger) << "Initialisation dbHandler succesful."; - - // initialize DDS - m_ddsHandler = std::make_shared(domainId); - if (!m_ddsHandler->init()) - { - ERROR_LOG(m_logger) << "Initialisation ddsHandler failed."; - return false; - } - DEBUG_LOG(m_logger) << "Initialisation ddsHandler succesful."; - - // TODO - - return true; -} - -std::shared_ptr MainHandler::db() const -{ - return m_dbHandler->db(); -} - -} // namespace XxxXxxXxx diff --git a/qt6-after/qt6-migrated-legatus/Lts/Services/skeleton/base/main_handler.h b/qt6-after/qt6-migrated-legatus/Lts/Services/skeleton/base/main_handler.h deleted file mode 100755 index d5dc6f167..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Services/skeleton/base/main_handler.h +++ /dev/null @@ -1,42 +0,0 @@ -/** - * MainHandler for AereaEffectSimulation - * $Id$ - * $HeadURL$ - * $Author$ - */ -#pragma once - -#include -#include -#include "dds_handler.h" -#include "xxx_db.h" -#include "logger.h" - -namespace NGLDB -{ -template class DbServiceHandler; -} -namespace XxxXxxXxx -{ -using DbHandler = NGLDB::DbServiceHandler; - -class MainHandler : public QObject -{ - Q_OBJECT -public: - explicit MainHandler(QObject *parent = nullptr); - ~MainHandler(); - - bool init(int domainId); - - std::shared_ptr dds() const { return m_ddsHandler; } - std::shared_ptr db() const; - -private: - std::shared_ptr m_ddsHandler; - std::shared_ptr m_dbHandler; - - NGL::INGLLogger &m_logger; - -}; -} // namespace XxxXxxXxx diff --git a/qt6-after/qt6-migrated-legatus/Lts/Services/skeleton/base/settings.cpp b/qt6-after/qt6-migrated-legatus/Lts/Services/skeleton/base/settings.cpp deleted file mode 100755 index 055ec2de1..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Services/skeleton/base/settings.cpp +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Settings for XxxXxxXxx - * $Id$ - * $HeadURL$ - * $Author$ - */ - -#include "settings.h" - -#include -#include -#include - -namespace XxxXxxXxx -{ -class NGLSettingsClass : public NGL::Settings -{ -public: - NGLSettingsClass() - : NGL::Settings(s_iniFile.isEmpty() ? NGL::findProjectConfigFile() : s_iniFile) - {} - static void setIniFile(const QString &fn) - { - s_iniFile = fn; - } - static QString s_iniFile; -}; -QString NGLSettingsClass::s_iniFile; -Q_GLOBAL_STATIC(NGLSettingsClass, s) - -//----------------------------------------------------------------------------- -NGL::Settings *Settings::settings() -{ - return s(); -} -//----------------------------------------------------------------------------- -void Settings::setIniFile(const QString &ini) -{ - NGLSettingsClass::setIniFile(ini); -} - -} // namespace XxxXxxXxx diff --git a/qt6-after/qt6-migrated-legatus/Lts/Services/skeleton/base/settings.h b/qt6-after/qt6-migrated-legatus/Lts/Services/skeleton/base/settings.h deleted file mode 100755 index de814b0b8..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Services/skeleton/base/settings.h +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Settings for XxxXxxXxx - * $Id$ - * $HeadURL$ - * $Author$ - */ - -#pragma once -#include - -namespace NGL -{ -class Settings; -} - -namespace XxxXxxXxx -{ -namespace Settings -{ -NGL::Settings *settings(); -void setIniFile(const QString &ini); -} - -} // namespace XxxXxxXxx diff --git a/qt6-after/qt6-migrated-legatus/Lts/Services/skeleton/base/xxx_export.h b/qt6-after/qt6-migrated-legatus/Lts/Services/skeleton/base/xxx_export.h deleted file mode 100755 index c3245a4b2..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Services/skeleton/base/xxx_export.h +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Export definitions - * $Id$ - * $HeadURL$ - * $Author$ - * Created by Hanna E. Rathje, SLSE, 2015-08-04 - */ -#pragma once - -#include - -#ifndef XXX_COMMON_EXPORT -# ifdef BUILD_STATIC_LIBRARIES -# define XXX_COMMON_EXPORT -# else -# if defined(MAKE_SVCXXXCOMMON_LIB) -# define XXX_COMMON_EXPORT Q_DECL_EXPORT -# ifndef WIN32 -# ifdef NDDSUSERDllExport -# undef NDDSUSERDllExport -# endif -# define NDDSUSERDllExport Q_DECL_EXPORT -# endif -# else -# define XXX_COMMON_EXPORT Q_DECL_IMPORT -# endif -# endif -#endif - -#ifndef XXX_CLIENT_EXPORT -# ifdef BUILD_STATIC_LIBRARIES -# define XXX_CLIENT_EXPORT -# else -# if defined(MAKE_SVCXXXCLIENT_LIB) -# define XXX_CLIENT_EXPORT Q_DECL_EXPORT -# else -# define XXX_CLIENT_EXPORT Q_DECL_IMPORT -# endif -# endif -#endif - -#ifndef XXX_SERVER_EXPORT -# ifdef BUILD_STATIC_LIBRARIES -# define XXX_SERVER_EXPORT -# else -# if defined(MAKE_SVCXXXSERVER_LIB) -# define XXX_SERVER_EXPORT Q_DECL_EXPORT -# else -# define XXX_SERVER_EXPORT Q_DECL_IMPORT -# endif -# endif -#endif diff --git a/qt6-after/qt6-migrated-legatus/Lts/Services/skeleton/base/xxx_service.xml b/qt6-after/qt6-migrated-legatus/Lts/Services/skeleton/base/xxx_service.xml deleted file mode 100755 index 868eaa155..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Services/skeleton/base/xxx_service.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - diff --git a/qt6-after/qt6-migrated-legatus/Lts/Services/skeleton/generate_handlers.sh b/qt6-after/qt6-migrated-legatus/Lts/Services/skeleton/generate_handlers.sh deleted file mode 100755 index a24bbcb11..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Services/skeleton/generate_handlers.sh +++ /dev/null @@ -1,144 +0,0 @@ -#!/bin/bash -# -# @RDE_HEADER@ -# $Id$ -# $HeadURL$ -# $Author$ -# - -svc_name_abbr="" -svc_name_long="" - - -usage() -{ - echo "usage: $0 -l " -# echo " -o : ObjectName in CamelCase " - echo " -s : Abbreviation of ServiceName with 3 letters" - echo " -l : ServiceName in CamelCase" -} - -while getopts "s:l:" opt "$@"; do - case $opt in -# o) -# obj_cc=$OPTARG -# ;; - l) - svc_cc=$OPTARG - ;; - s) - svc_abbr=$OPTARG - ;; - \?) - echo "Invalid option: -$OPTARG" - usage - exit 1 - ;; - :) - echo "Option -$OPTARG requires an argument." - usage - exit 1 - ;; - esac -done -shift $((OPTIND-1)) - -if [ -z $svc_cc ]; then - echo "Parameter -l is required" - usage - exit 1 -fi - -if [ -z $svc_abbr ]; then - echo "Parameter -s is required" - usage - exit 1 -fi - -svc_abbr_lc=${svc_abbr,,} -svc_abbr_cc=${svc_abbr_lc~} -echo "svc CamelCase : ${svc_cc} " -echo "svc abbr Cc : ${svc_abbr_cc} " -echo "svc abbr lower : ${svc_abbr_lc} " - -echo "ObjectNames (cc): " -for obje in "$@"; do - echo " ${obje}" -done - -echo "==========================" -echo "Iterating through objects:" -echo - -declare -a headers -declare -a sources - -for obje in "$@"; do - cd ../skeleton - obj_lower=${obje,,} - obj_upper=${obje^^} - obj_underscore=`echo ${obje} | sed 's/\([a-z0-9]\)\([A-Z]\)/\1_\L\2/g'` - obj_underscore=${obj_underscore,,} - echo "Object '${obje}': " - echo " obj CamelCase : ${obje} " - echo " obj lower : ${obj_lower} " - echo " obj UPPER : ${obj_upper} " - echo " obj under_score : ${obj_underscore} " - echo - echo " Copying [handler|object]_${obj_underscore}.[cpp|h] to ./${svc_cc} directory" - cp ./stub/handler_xxx.cpp ../${svc_cc}/handler_${obj_underscore}.cpp - cp ./stub/handler_xxx.h ../${svc_cc}/handler_${obj_underscore}.h - cp ./stub/object_xxx.cpp ../${svc_cc}/object_${obj_underscore}.cpp - cp ./stub/object_xxx.h ../${svc_cc}/object_${obj_underscore}.h - - cd ../${svc_cc} - - # search & replace XXX/Xxx/xxx/XxxXxxXxx - for file in `find . -type f -name "*_${obj_underscore}.*" `; do - echo " -> Replace all Xxx/xxx/XXX and namespace in file ${file}" - # sed -i "s/XxxXxxXxx/${svc_name_long}/g" ${file} - sed -i "s/XXX/${obj_upper}/g" ${file} - sed -i "s/Xxx/${obje}/g" ${file} - sed -i "s/xxx_xxx/${obj_underscore}/g" ${file} - sed -i "s/xxx/${obj_lower}/g" ${file} - - sed -i "s/YyyYyyYyy/${svc_cc}/g" ${file} - sed -i "s/Yyy/${svc_abbr_cc}/g" ${file} - sed -i "s/yyy/${svc_abbr_lc}/g" ${file} - fil2=${file##.*/} - if [[ "$file" == *.h ]] - then - headers+=(${fil2}) - else - sources+=(${fil2}) - fi - done - echo -done -echo "==========================" -echo "Copied handler and object files and replaced strings within files." - -# echo what to do next: -echo "==========================" -echo "Next steps:" -echo -echo "=> Include Files in CMakeLists.txt by adding the following lines:" - -echo "SET(SRCS_exe" -echo " [...]" -echo "vvvvvvvvvvvvvvvvvvvvvvvvvv" -for source in "${sources[@]}"; do - echo " ${source}" -done -echo "^^^^^^^^^^^^^^^^^^^^^^^^^^" -echo ")" - -echo "SET(HDRS_exe" -echo " [...]" -echo "vvvvvvvvvvvvvvvvvvvvvvvvvv" -for head in "${headers[@]}"; do - echo " ${head}" -done -echo "^^^^^^^^^^^^^^^^^^^^^^^^^^" -echo ")" - diff --git a/qt6-after/qt6-migrated-legatus/Lts/Services/skeleton/generate_service_stub.sh b/qt6-after/qt6-migrated-legatus/Lts/Services/skeleton/generate_service_stub.sh deleted file mode 100755 index ba0b14b86..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Services/skeleton/generate_service_stub.sh +++ /dev/null @@ -1,110 +0,0 @@ -#!/bin/bash -# -# @RDE_HEADER@ -# $Id$ -# $HeadURL$ -# $Author$ -# - -svc_name_abbr="" -svc_name_long="" - - -usage() -{ - echo "usage: $0 -l -s " - echo " -l : ServiceName in CamelCase " - echo " -s : Abbreviation of ServiceName with 3 letters" -} - -while getopts "s:l:" opt "$@"; do - case $opt in - l) - svc_name_long=$OPTARG - ;; - s) - svc_name_abbr=$OPTARG - ;; - \?) - echo "Invalid option: -$OPTARG" - usage - exit 1 - ;; - :) - echo "Option -$OPTARG requires an argument." - usage - exit 1 - ;; - esac -done - - -if [ -z $svc_name_long ]; then - echo "Parameter -l is required" - usage - exit 1 -fi - -if [ -z $svc_name_abbr ]; then - echo "Parameter -s is required" - usage - exit 1 -fi - -echo "ServiceName (long): ${svc_name_long} " -echo "ServiceName (Abbr): ${svc_name_abbr} " - -svc_lower=${svc_name_abbr,,} -svc_upper=${svc_name_abbr^^} -svc_cc=${svc_lower~} - -echo "svc lower (Abbr): ${svc_lower} " -echo "svc upper (Abbr): ${svc_upper} " -echo "svc CamelCase (Abbr): ${svc_cc} " - -# copy skeleton to SvcDirectory -svc_dir=${svc_name_long} -if [ -d ../${svc_dir} ]; then - echo "Directory ${svc_dir} already exists. Remove it and restart the script" - exit 2 - rm -r ${svc_dir} -fi - -cp -r ./base ../${svc_dir} -echo "Copied files to ${svc_dir}." - -cd ../${svc_dir} - -# mv files with xxx_* to svc_lower_* -#for i in find . -name 'xxx_*' -exec ls {} \; -# Todo: sed for renaming? xxx -> ${svc_lower}, wherever it occurs -for old_file in `find . -name 'xxx_*' `; do - new_file="${svc_lower}${old_file:5}" - echo "-> Rename file ${old_file} to ${new_file}" - mv ${old_file} ./${new_file} -done - -mv ./log4cxx_xxx.props ./log4cxx_${svc_lower}.props - -# search & replace XXX/Xxx/xxx/XxxXxxXxx -for file in `find . -type f -name '*' `; do - echo "-> Replace all Xxx/xxx/XXX and namespace in file ${file}" - sed -i "s/XxxXxxXxx/${svc_name_long}/g" ${file} - sed -i "s/XXX/${svc_upper}/g" ${file} - sed -i "s/Xxx/${svc_cc}/g" ${file} - sed -i "s/xxx/${svc_lower}/g" ${file} -done - -pwd=`pwd` - -# echo what to do next: -echo "------------------------" -echo "Next steps:" -echo "------------------------" -echo "=> Copy xml service file (${svc_lower}_service.xml) from EA into '${svc_dir}'" -echo " cp ${svc_lower}_service.xml ${pwd}/" -echo "" -echo "=> Include '${svc_dir}' in CMakeLists.txt (in folder 'Services') by adding the following line:" -echo " ADD_SUBDIRECTORY(${svc_name_long})" -echo "------------------------" - diff --git a/qt6-after/qt6-migrated-legatus/Lts/Services/skeleton/stub/handler_xxx.cpp b/qt6-after/qt6-migrated-legatus/Lts/Services/skeleton/stub/handler_xxx.cpp deleted file mode 100755 index 350ae9d67..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Services/skeleton/stub/handler_xxx.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/** - * Handler for all exercise objects - * $Id$ - * $HeadURL$ - * $Author$ - * Created by Hanna E. Rathje, SLSE, 2015-09-03 - */ - -#include "handler_xxx_xxx.h" -#include "object_xxx_xxx.h" -#include "yyy_db.h" -#include "db_handler.h" - -#include -#include - -namespace YyyYyyYyy -{ - -HandlerXxx::HandlerXxx(const std::shared_ptr &ddsHandler, - const std::shared_ptr &dbHandler, - QObject *parent) - : QObject(parent) - , m_ddsHandler(ddsHandler) - , m_dbHandler(dbHandler) - , m_logger(getLogger("HandlerXxx")) -{} - -HandlerXxx::~HandlerXxx() -{} - -bool HandlerXxx::init() -{ - QVector dataVec; - // read all Xxxs from database - if(!m_dbHandler->db()->select(dataVec)) - { - ERROR_LOG(m_logger) << "Error reading data from database!"; - return false; - } - - // create languageHmi objects - for (const Database::YyyXxx &data : qAsConst(dataVec)) - { - ObjectXxx *ifs(new ObjectXxx(m_ddsHandler, m_dbHandler, this)); - Core::FunctionReplyObject ret = ifs->createObject(data); - if(ret.error()) - { - delete ifs; - ERROR_LOG(m_logger) << ret(); - return false; - } - m_xxxObjMap.insert(ifs->getId(), ifs); - } - - DEBUG_LOG(m_logger) << "m_exeObjMap.size() = " << m_xxxObjMap.size(); - - return true; -} - -} // Namespace YyyYyyYyy diff --git a/qt6-after/qt6-migrated-legatus/Lts/Services/skeleton/stub/handler_xxx.h b/qt6-after/qt6-migrated-legatus/Lts/Services/skeleton/stub/handler_xxx.h deleted file mode 100755 index 72c92773e..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Services/skeleton/stub/handler_xxx.h +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Handler for all Language HMI objects - * $Id$ - * $HeadURL$ - * $Author$ - * Created by Hanna E. Rathje, SLSE, 2015-09-03 - */ -#pragma once - -#include - -#include "dds_handler.h" -#include "logger.h" - -namespace YyyYyyYyy -{ -class DbHandler; -class ObjectXxx; -class HandlerXxx : public QObject -{ -public: - HandlerXxx(const std::shared_ptr &ddsHandler, - const std::shared_ptr &dbHandler, - QObject *parent = nullptr); - - ~HandlerXxx(); - - bool init(); - -private: - -private: - QMap m_xxxObjMap; - std::shared_ptr m_ddsHandler; - std::shared_ptr m_dbHandler; - NGL::INGLLogger &m_logger; - -}; -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Services/skeleton/stub/object_xxx.cpp b/qt6-after/qt6-migrated-legatus/Lts/Services/skeleton/stub/object_xxx.cpp deleted file mode 100755 index dfc26a1c3..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Services/skeleton/stub/object_xxx.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/** - * Handler for the HMI language - * $Id$ - * $HeadURL$ - * $Author$ - */ - -#include "object_xxx_xxx.h" - -#include "dds_handler.h" -#include "db_handler.h" -#include "logger.h" - -namespace YyyYyyYyy -{ - - ObjectXxx::ObjectXxx(const std::shared_ptr &ddsHandler, - const std::shared_ptr &dbHandler, - QObject *parent) - : QObject(parent) - , m_ddsHandler(ddsHandler) - , m_dbHandler(dbHandler) - , m_logger(getLogger("ObjectXxx")) -{ -} - -ObjectXxx::~ObjectXxx() -{ -} - -Core::FunctionReplyObject ObjectXxx::createObject(const Database::YyyXxx &data) -{ - m_data = data; - if(m_data.id <= 0) - return Core::FunctionReplyObject(m_data.id, "It is not intended to insert data this way..."); - - // Publish Data via DTS - onPublishData(); - - return Core::FunctionReplyObject(m_data.id); -} - -Core::FunctionReplyObject ObjectXxx::updateObject(const Database::YyyXxx &data) -{ - return Core::FunctionReplyObject(m_data.id, "You are not allowed to change this datum."); -} - -Core::FunctionReplyObject ObjectXxx::removeObject() -{ - return Core::FunctionReplyObject(m_data.id, "Data removal denied."); -} - -void ObjectXxx::onPublishData() -{ - - YyyYyyYyy::Xxx ddsData; - - ddsData.id(m_data.id); - // Todo: Copy as above - INFO_LOG(m_logger) << "Publish YyyXxx-data to dds (" << m_data.id << ") ..."; - - if (!m_ddsHandler->dts()->publish(ddsData)) - { - ERROR_LOG(m_logger) << "Error publishing YyyXxx-data to dds"; - } -} - -} // Namespace YyyYyyYyy diff --git a/qt6-after/qt6-migrated-legatus/Lts/Services/skeleton/stub/object_xxx.h b/qt6-after/qt6-migrated-legatus/Lts/Services/skeleton/stub/object_xxx.h deleted file mode 100755 index ded9118f1..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Services/skeleton/stub/object_xxx.h +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Exercise object - * $Id$ - * $HeadURL$ - * $Author$ - */ -#pragma once - -#include -#include "dds_handler.h" -#include "logger.h" - -#include - -// Generated -#include - - -namespace YyyYyyYyy -{ - class DbHandler; - - class ObjectXxx : public QObject - { - Q_OBJECT - public: - explicit ObjectXxx(const std::shared_ptr &ddsHandler, - const std::shared_ptr &dbHandler, - QObject *parent = nullptr); - ~ObjectXxx(); - - Core::FunctionReplyObject createObject(const Database::YyyXxx &data); - Core::FunctionReplyObject updateObject(const Database::YyyXxx &data); - Core::FunctionReplyObject removeObject(); - - int getId() const { return m_data.id; } - - protected Q_SLOTS: - void onPublishData(); - - private: - std::shared_ptr m_ddsHandler; - std::shared_ptr m_dbHandler; - Database::YyyXxx m_data; - - NGL::INGLLogger &m_logger; - - }; -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssets/README.md b/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssets/README.md deleted file mode 100755 index 21d28da50..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssets/README.md +++ /dev/null @@ -1,273 +0,0 @@ -# Leaflet map for displaying mounting points - -## Table of contents - -1. [Usage](#usage) -2. [Programming](#programming) - 1. [Basics](#basics) - 1. [TypeScript](#typescript) - 2. [AngularJs](#angularjs) - 3. [Leaflet](#leaflet) - 2. [The code](#the-code) - -_Note: view this in a program that supports markdown_ -_(e.g. VS Code or a browser with plugin) and it will look much better_ - ---- - -## Usage - -### Connection - -When opening index.html you will first see the connection menu. -Here you can choose if you want to connect to localhost:2080, enter -a custom ip or load data from the browser cache. - -### Main page - -The main page consists of two parts: the map on the left side and the selection -menu on the right side. -The map will display the buildings and mouting points received from the previously -entered websocket. Buildings are currently light blue while mounting points are -highlighted with a typical map marker in black. These markers will open a popup -that displays additional info when clicked. -The selection menu on the right side has three sections, namely "Layers", "Asset -types" and finally "Selected mounting points". - -- The layer selection is handled via checkboxes where checked means displayed -- The asset type selection happens with a dropdown menu -- Selected mounting points are displayed in a table with tag/designation and id - -The table displaying selected mounting points also features a button for each -point that centers the map on it and opens its popup. It can also be searched -using the text input above it (case sensitive, checks if name or id contain given -text). - ---- - -## Programming - -### Basics - -This program is a kind of messy combination of several libraries/frameworks that -weren't really made to work with each other soI have to explain some things first: - -#### TypeScript - -TypeScript (TS) is a superset of JavaScript (JS) which means every JS command is also valid TS. -The big difference is that TS is typed (who would have guessed?) andfeatures object -oriented programming. Concepts such as classes and inheritance are -supported. TS is transpiled into JS. This secures compatibility with most browsers. - -A little syntax example of TS: - -```typescript -var name: type = value; - -function name(parameter: type): returnType { - // ... -} - -class name extends inheritedClass { - PropertyOne: type; - PropertyTwo: type = value; - - constructor(parameter: type) { - this.PropertyOne = parameter; - } -} -``` - -The command `tsc --build ` can be used to transpile "file.ts", -`tsc --watch ` however will stay running and always retranspile when -it detects changes in "file.ts". - -#### AngularJs - -AngularJs is a kind of library for JS/htm which allows you to build dynamic pages -with really little actual code. There has to be some backing code but most of it -will actually happen wihtin the html file. It's kinda hard to explain but here's -an example: - -```html -
  • -
      - {{x}} -
    -
  • -``` - -This example doesn't really show anything too useful but you can see two of the most -important concepts of AngularJs: directives and templates. - -- The directive `ng-repeat` for example will repeat the tag it is in dynamically - depending on its content, in this case 5 times -- The template `{{x}}` will be dynamically replaced by the value of x, in this - case 1 thorugh 5 - -When viewed in a browser the example will render as this: - -> - 1 -> - 2 -> - 3 -> - 4 -> - 5 - -We can make JS variables visible to AngularJs by attaching them to its `$scope` -object. - -This was really short but I can't really teach a whole framework within a -readme. There is a nice (German) [tutorial](https://angular.de/artikel/angularjs-tutorial-deutsch/) -though. - -There actually is a newer version of Angular explicitly for TS but it's way more -complicated so I stuck with the old JS version. It was a headache to get that to -work but now it does. Don't touch it. - -#### Leaflet - -Leaflet is a JS library for creating maps. It's rather simple to understand -and has nice [documentation](https://leafletjs.com/reference-1.4.0.html). -Basically you create a div with a special id and then put stuff like markers -into it via JS. Not much I could explain here. Except maybe I can say a sentence -about function chaining. Leaflet smartly uses return types in its functions that -allow you to chain them like crazy. For example: - -```typescript -var marker: L.Marker = L.marker(coordinates) - .bindPopup(popupContent) - .addTo(map); -``` - -`.bindPopup()` and `.addTo()` both still return the marker. This way you can get -a lot of stuff done with a single statement. -In this example you can also see that Leaflet likes to use factory methods instead -of instance contructors (`new`). Feels weird in the beginning but makes sense when -you keep in mind that this is a TS port of a JS library. - -### The code - -Let me first tell you how to actually run the code: - -1. Transpile: Ctrl+Shift+B in VS Code, choose "build" -2. Browserify: `browserify main.js -o scripts/main.js` -3. Open index.html - -The browserify step is needed since this program is basically a nodejs app. -Browserify combines all node modules into a single .js file -so we can actually use the file in a html website. - -To clear things up: - -- ./main.ts is the source file - _develop here_ -- ./main.js is the transpiled file - _don't touch it_ -- ./scripts/main.js is the final browerified file - _don't even look at it_ - -When developing it is way easier to have those commands in watch mode so -you can simply refresh the browser to see the changes you made: - -- Ctrl+Shift+B in VS Code, choose watch -- `watchify main.js -o scripts/main.js` - -These commands will automatically retranspile and rebrowserify main.ts when you -hit save in an editor of your choice (use VS Code though - it's the best). - -tsc, browserify and watchify can be installed via npm. - -**Also, don't update utm-latlng!** -utm-latlng is a dependency which features conversion of coordinates from -latitude/longtitude to UTM and vice-versa. There's a bug in it that prevents -the correct conversion from UTM back to lat/lon in the current version. There's -a pull request with a one line fix on GitHub but that was half a year ago and -has never been merged so I copied the line and pasted it in the local installation -of the library. Updating it will probably break it. So don't. -_Actually, it's probably best to not update anything, just to be sure._ - ---- - -Now let's get to the actual code. I wont explain every little detail since there -are additional comments in the code but I will highlight _some_ things. For writing -I recommend VS Code. - -- The only files needed to display the final page in the end are: - - index.html - - style.css - - The scripts folder and its content - - the img forler and its content -- index.html is rather simple. Contains additional comments as well but here's - some more things: - - leaflet.css has to be before leaflet.min.js apparently - - Everything withing `{{}}` is an AngularJs template and will be filled - dynamically with the code inside - - `ng-click` is basically `onclick` -- I wont even talk about style.css -- main.ts. This is the evil one - - Don't question the angular module and controllers. They are basically magic. - - `module Calc` is a little collection of some math stuff: - - `RadToDeg()` and `DegToRad()` are really just one-liner functions to - convert between degrees and radians - - `RotatePoint()` rotates a point around an angle using fancy trigonometry - I snatched of the internet - - class UTM` is just there so a have a uniform way of representing UTM - coords - - `LatLonToUtm()` and `UtmToLatLon()` are just wrappers to simplify the - respective utm-latlng functions - - `class MountingPoint` is a leaflet marker which stores additional info - about the mounting point it represents - - `class Layer` stores the markers and is basically a representation of - floors but floors with the same name are stored in the same layer - - `IsStringEmpty()` returns `true` when the given string is either empty, - `null` or `undefined` - - Any property of `$scope` within the angular controller is visible to - angular templates within index.html - - `$scope.loadData()` gets the data from the entered websocket and calls - the event `webSocketResponse` - - `$scope.$on("webSocketResponse", /* ... */)`: - This handles the `webSocketResponse`-event. Almost the whole program is - contained wihtin its callback. This is so that nothing tries to access - any data that has not been received yet. It is divided into sections - that handle the different types of objects we want to display, namely - buildings, levels, mounting points and assets. It also sets up the leaflet - map. - - Nested `for (let x of y)`-"loops" are godsent. I mostly use them to get two - objects with matching properties and then do stuff with them. For example: - - ```typescript - for (let m of mountingPoints) { - for (let b of buildings) { - if (m.objectId == b.id) { - // ... - ``` - - - `(layer.LLayer.getLayers() as unknown[]) as MountingPoint[])` - This thing... Let me break it down. - `layer` is an instance of my `Layer`-class. `LLayer` is the leaflet map - layer it encapsulates. - `.getLayers()` returns the array of markers on that layer. The problem - I faced here was that they lost the properties I added in my - `MountingPoint`-class because it returns `L.Marker`s. - More precisely, the values is still there but not accessible since - `L.Marker` doesn't have the properties. - But I can't directly cast from `L.Marker` to `MountingPoint`. - Therefore I do a cheaty cast via `unknown`. - It's confusing as heck but the only way I can easily get access to the - `MountingPoint`-properties. - - The mean conditional statement at `foundBySearch` within - `$scope.MountingPointFilter()` is a short way of saying - `true` if either - - `$scope.mpSearch` (search text input in index.html) is empty - - currently tested mounting point tag/designation or id contain - `$scope.mpSearch` - - `$scope.SelectionChanged()` is called in the end so that I don't have - to manually fix all the default selections - - `$scope.$apply()` will update the `$scope`-object so that it's values - are actually available in the angular templates within index.html. - It would happen automatically eventually but I want to be on the safe side. - Sometimes it is nessecary to call it, sometimes it thorws an error. Just try - it out. The error doesn't seem to matter. - ---- - -I hope this and the comments in the code are enough to understand it. -If not, you can send me a [mail](mailto:justus.hertel@rheinmetall.com). -If you are lucky I might remember how it works :p diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssets/img/RDE2.jpg b/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssets/img/RDE2.jpg deleted file mode 100755 index d6df478c4..000000000 Binary files a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssets/img/RDE2.jpg and /dev/null differ diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssets/img/arindicator.png b/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssets/img/arindicator.png deleted file mode 100755 index 92f3ce581..000000000 Binary files a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssets/img/arindicator.png and /dev/null differ diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssets/img/armarker.png b/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssets/img/armarker.png deleted file mode 100755 index 5bef1e126..000000000 Binary files a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssets/img/armarker.png and /dev/null differ diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssets/img/marker.png b/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssets/img/marker.png deleted file mode 100755 index 6fbda2878..000000000 Binary files a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssets/img/marker.png and /dev/null differ diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssets/index.html b/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssets/index.html deleted file mode 100755 index eeb133ea0..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssets/index.html +++ /dev/null @@ -1,194 +0,0 @@ - - - - - - - - - - - - - - - - -
    - - -
    - -

    - Connection -

    - -
    - OR -
    - - -
    - OR -
    - -
    - - - -
    - -
    - -
    - -
    -
    - -
    - - -
    -

    - Layers -

    - - - - - -
    - - {{ layer.Name }} -
    - -
    - -

    - Asset type -

    - - -
    - -

    - Selected mounting points: - {{ - ( - mountingPoints - | filter: MountingPointFilter(mountingPoint) - ).length - }} - -

    - - - - -
    -
    -
    - - - - - - - - - - - - - - -
    - Name - - ID - - Position -
    - {{ - mountingPoint.tag != "" - ? mountingPoint.tag - : mountingPoint.designation - }} - - {{ mountingPoint.id }} - - - -
    -
    -
    -
    -
    -
    -
    - {{ arMountingPoint }} -
    - -
    - - diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssets/main.js b/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssets/main.js deleted file mode 100755 index 283c4912f..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssets/main.js +++ /dev/null @@ -1,503 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -// #region Initialization -console.log("\nBegin initialization ##################################################"); -var angular_1 = __importDefault(require("angular")); -angular_1.default != undefined - ? console.log("\tLoaded AngularJs.") - : console.error("\tFailed to load AngularJs."); -var leaflet_1 = __importDefault(require("leaflet")); -leaflet_1.default != undefined - ? console.log("\tLoaded Leaflet.") - : console.error("\tFailed to load Leaflet."); -var utm_latlng_1 = __importDefault(require("utm-latlng")); -utm_latlng_1.default != undefined - ? console.log("\tLoaded utm-latlng.") - : console.error("\tFailed to load utm-latlng."); -var isMobile = /Android/i.test(navigator.userAgent); // Check for mobile browser -console.log("\tDetected " + (isMobile ? "mobile browser." : "desktop browser, disabling AR features.")); -// AngularJS -var ngApp = angular_1.default.module("main", []); -console.log("\tInitialized AngularJs."); -console.log("Initialization finished ###############################################"); -// #endregion -// #region Helpers -var Calc; -(function (Calc) { - // Converts radians to degrees - function RadToDeg(rad) { - return rad * (180 / Math.PI); - } - Calc.RadToDeg = RadToDeg; - // Converts degrees to radians - function DegToRad(deg) { - return (deg * Math.PI) / 180; - } - Calc.DegToRad = DegToRad; - // Rotates a point around 0,0 by an angle in radians - function RotatePoint(point, angle) { - return { - x: point.x * Math.cos(angle) - point.y * Math.sin(angle), - y: point.x * Math.sin(angle) + point.y * Math.cos(angle) - }; - } - Calc.RotatePoint = RotatePoint; - // UTM Coordinates - var UTM = /** @class */ (function () { - function UTM(e, n, zn, zl) { - this.Easting = e; - this.Northing = n; - this.ZoneNumber = zn; - this.ZoneLetter = zl; - } - return UTM; - }()); - var _precision = 7; // Precision for LatLon to UTM conversion - var _utm = new utm_latlng_1.default("WGS 84"); // Create UTM/LatLng converter for WGS84 projection - // Wrapper for LatLon to UTM conversion - function LatLonToUtm(lat, lon) { - return _utm.convertLatLngToUtm(lat, lon, _precision); - } - Calc.LatLonToUtm = LatLonToUtm; - // Wrapper for UTM to LatLon conversion - function UtmToLatLon(utm) { - var temp = _utm.convertUtmToLatLng(utm.Easting, utm.Northing, utm.ZoneNumber, utm.ZoneLetter); - return { lat: temp.lat, lon: temp.lng }; - } - Calc.UtmToLatLon = UtmToLatLon; -})(Calc || (Calc = {})); -// Leaflet marker with additional info to represent a mounting point -var MountingPoint = /** @class */ (function (_super) { - __extends(MountingPoint, _super); - function MountingPoint() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.SupportedAssets = []; - _this.ID = -1; - return _this; - } - return MountingPoint; -}(leaflet_1.default.Marker)); -// Represents all levels with the same designation, -// Stores the mounting points of those levels -var Layer = /** @class */ (function () { - function Layer(name) { - this.Name = name; - this.Ids = []; - this.Selected = true; - this.LLayer = leaflet_1.default.layerGroup(undefined); - } - return Layer; -}()); -// Returns true if str is undefined, empty or null -function IsStringEmpty(str) { - return str == undefined || str == "" || str == null; -} -// jQuery like shortcut to get html elements -function $(query) { - return document.querySelector(query); -} -// Retrieves the angular $scope from outside a controller -function GetScope() { - return angular_1.default.element($("body")).scope(); -} -function Status(str) { - GetScope().status = str; - console.log(str); - $("#progressBar").value++; -} -// #endregion -// Main AngularJs controller -ngApp.controller("ctrl", function ($scope) { - var data = {}; // Will hold the websocket response - var t0 = null; // Measures the time it takes to load and parse - $scope.disableInput = false; // True when loadData kicks in, disables the inputs - $scope.connected = false; // True when websocket response was received - $scope.status = undefined; // String that will be shown while connecting - // Writes the websocket response to data when the load button is clicked - /** @function */ $scope.loadDataFromWS = function (ip) { - $scope.disableInput = true; - console.log("Begin loading data ####################################################"); - t0 = performance.now(); // Get start time - // Default value for ip if nothing was entered - ip = IsStringEmpty(ip) ? "ws://192.168.133.140:2080" : ip; - // Catch invalid ips - try { - var ws = new WebSocket(ip); // Connect to the websocket - } - catch (e) { - alert("Invalid IP"); - return; - } - Status("\tConnecting to " + ip + "..."); - // Connect to the web socket - ws.onopen = function () { - console.log("\tConnected."); - ws.send(JSON.stringify({ - type: "getEssentials", - uuid: "UUID" - })); - }; - // Handles the response of the websocket - ws.onmessage = function (response) { - console.log("\tFetched " + Math.round(new TextEncoder().encode(response.data).length / 1000) + "kb."); - data = JSON.parse(response.data).data; // Parse websocket response to data - window.localStorage.setItem("data", escape(response.data)); - $scope.$broadcast("dataLoaded"); // Call response event to kick in the map and selection GUI - }; - // Handle bad websocket responses - ws.onclose = function (event) { - if (event.code > 1000) { - t0 = null; - $scope.status = ""; - alert("Error when getting websocket response.\n" + event.code); - $scope.disableInput = false; - } - }; - }; - /** @function */ $scope.loadDataFromCache = function () { - $scope.disableInput = true; - console.log("Begin loading data ####################################################"); - t0 = performance.now(); - Status("Loading data from cache..."); - try { - if (window.localStorage.getItem("data") == null) - throw new Error(); - var _data = unescape(window.localStorage.getItem("data")); - data = JSON.parse(_data).data; - console.log("\tLoaded " + Math.round(new TextEncoder().encode(_data).length / 1000) + "kb from cache."); - $scope.$broadcast("dataLoaded"); - } - catch (_a) { - $scope.status = ""; - $scope.disableInput = false; - t0 = null; - console.log("\tCould not load data from cache."); - alert("No data cached."); - } - }; - // Handles websocket response event - $scope.$on("dataLoaded", function () { - var _data = data; - $scope.connected = true; // Switches the connection menu for the mounting point selection - $scope.loading = true; // Disables the GUI while doing stuff - // #region MAP - console.log("\tCreating map."); - // Create the map, set view and image - var map = new leaflet_1.default.Map("map").setView(new leaflet_1.default.LatLng(53.0528064472226, 8.89412999153137), 8); - var imageBounds = new leaflet_1.default.LatLngBounds([ - [53.0528064472226, 8.89412999153137], - [53.056520842139, 8.90030980110168] - ]); - var mapImage = leaflet_1.default.imageOverlay("img/RDE2.jpg", imageBounds); - map.addLayer(mapImage); - map.fitBounds(imageBounds); - // #endregion - // #region BUILDINGS - // Get buildings - var buildings = _data.objects; - Status("\tParsing " + buildings.length + " buildings..."); - // Create GeoJson from buidling footprints - var footprintPolygons = { - type: "FeatureCollection", - features: [] - }; - for (var _i = 0, buildings_1 = buildings; _i < buildings_1.length; _i++) { - var currentBuilding = buildings_1[_i]; - // Check if current builing has footprint data, if not: skip - if (!(currentBuilding.path[0] == undefined)) { - // Holds footprint coordinates of the current building - var footprintCoords = [[]]; - // Parse footprint coordinates from current building - for (var _a = 0, _b = currentBuilding.path; _a < _b.length; _a++) { - var pos = _b[_a]; - footprintCoords[0].push([ - // Convert from radians to degrees and add to the array - Calc.RadToDeg(pos.lon), - Calc.RadToDeg(pos.lat) - ]); - } - // Last point has to be the same as the first point so we add it again - footprintCoords[0].push([ - Calc.RadToDeg(currentBuilding.path[0].lon), - Calc.RadToDeg(currentBuilding.path[0].lat) - ]); - // Create new GeoJson Feature with building footprint - var currentFootprint = { - type: "Feature", - properties: { - name: currentBuilding.designation - }, - geometry: { - type: "Polygon", - coordinates: footprintCoords - } - }; - // Add GeoJson feature to feature collection - footprintPolygons.features.push(currentFootprint); - } - } - // Draw building footprints to map, add name popups - var footprintGeoJson = leaflet_1.default.geoJSON(footprintPolygons, { - onEachFeature: function (feature, layer) { - layer.bindPopup("

    " + feature.properties.name + "

    "); - } - }).addTo(map); - // #endregion - // #region LEVELS - var levels = _data.levels; // Levels are the actual floors in the building - var layers = []; // Layers are their representation on the map - Status("\tParsing " + levels.length + " levels..."); - for (var _c = 0, levels_1 = levels; _c < levels_1.length; _c++) { - var level = levels_1[_c]; - // Create a layer for each level - var add = true; - for (var _d = 0, layers_1 = layers; _d < layers_1.length; _d++) { - var layer = layers_1[_d]; - // Levels with duplicate names will be on the same layer - if (level.designation === layer.Name) { - add = false; - layer.Ids.push(level.id); - break; - } - } - if (add) { - // Create new Layer if level is not a duplicate - var newLayer = new Layer(level.designation); - newLayer.Ids.push(level.id); - layers.push(newLayer); - } - } - var outdoorLayer = new Layer("outdoor"); // Create a layer for mounting points outside of buildings - outdoorLayer.Ids = [-1]; - var footprintLayer = new Layer("buildings"); // Create a layer for the building footprint - footprintLayer.LLayer = footprintGeoJson; - layers.push(outdoorLayer); // Add outdoor and footprint layers - layers.push(footprintLayer); - $scope.layers = layers; // Add layers to the checkbox menu - // #endregion - // #region MOUNTING POINTS - // Get mounting points - var mountingPoints = _data.mountingPoints; - Status("\tParsing " + mountingPoints.length + " mounting points..."); - for (var _e = 0, mountingPoints_1 = mountingPoints; _e < mountingPoints_1.length; _e++) { - var m = mountingPoints_1[_e]; - for (var _f = 0, buildings_2 = buildings; _f < buildings_2.length; _f++) { - var b = buildings_2[_f]; - if (b.id == m.objectId) { - // Current mounting point is in current buidling? - b.utmRefPoint = Calc.LatLonToUtm(Calc.RadToDeg(b.refPoint.lat), Calc.RadToDeg(b.refPoint.lon)); // Converts refPoint of the building to UTM - m.fixedPosition = Calc.RotatePoint({ x: m.position3d.x, y: m.position3d.y }, Calc.DegToRad(b.rotationDegree)); // Rotates coords of the mounting point by rotationDegree of the building - m.absoluteUtm = b.utmRefPoint; - m.absoluteUtm.Easting += m.fixedPosition.x; - m.absoluteUtm.Northing += m.fixedPosition.y; - m.absoluteLatLon = Calc.UtmToLatLon(m.absoluteUtm); - // Add refPoint to the relative position and convert back to lat/lng - var arButtonHtml = isMobile - ? "\n\t\t\t\t\t\t\t\tShow in AR\n\t\t\t\t\t\t\t" - : "AR not supported on desktop."; - for (var _g = 0, layers_2 = layers; _g < layers_2.length; _g++) { - var l = layers_2[_g]; - for (var _h = 0, _j = l.Ids; _h < _j.length; _h++) { - var i = _j[_h]; - if (i == m.levelId) { - // Current mouting point is on current level? - var marker = new MountingPoint( - // Create a marker for the mounting point - new leaflet_1.default.LatLng(m.absoluteLatLon.lat, m.absoluteLatLon.lon), { - icon: leaflet_1.default.icon({ - iconUrl: "img/marker.png", - iconSize: [30, 30] - }) - }) - .bindPopup( - // Create a popup with info about the mounting point - "

    \n\t\t\t\t\t\t\t\t\t\t" + (IsStringEmpty(m.tag) ? m.designation : m.tag) + "\n\t\t\t\t\t\t\t\t\t\t

    \n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t
    ID" + m.id + "
    Object ID" + m.objectId + "
    Supported Asset Type IDs" + m.supportedAssetTypeIds + "
    \n\t\t\t\t\t\t\t\t\t\t
    \n\t\t\t\t\t\t\t\t\t\t" + arButtonHtml + "\n\t\t\t\t\t\t\t\t\t\t") - .addTo(map); // Add it to the map - marker.SupportedAssets = // Add info about supported asset types - m.supportedAssetTypeIds; - marker.ID = m.id; // Add mounting point id - l.LLayer.addLayer(marker); // Add marker to corresponding layer - } - } - } - } - } - } - $scope.mountingPoints = mountingPoints; - // #endregion - // #region ASSETS - // Get asset types - var assets = _data.assetTypes; - Status("\tParsing " + assets.length + " assets..."); - // Add asset types to the dropdown menu - $scope.assets = { - availableAssets: assets, - selectedAsset: assets[0] - }; - // #endregion - // #region ANGULAR FUNCTIONS - // Called by either the layer or asset selection - /** @function */ $scope.SelectionChanged = function () { - var points = 0; - for (var _i = 0, layers_3 = layers; _i < layers_3.length; _i++) { - var layer = layers_3[_i]; - if (layer.Selected) { - map.addLayer(layer.LLayer); // Add selected layers - // Hacky type conversion to get the supported asset types from each mounting point on a layer - // If it's stupid but it works it's not stupid - for (var _a = 0, _b = layer.LLayer.getLayers(); _a < _b.length; _a++) { - var m = _b[_a]; - try { - for (var _c = 0, _d = m.SupportedAssets; _c < _d.length; _c++) { - var a = _d[_c]; - if (a == $scope.assets.selectedAsset.id) { - m.addTo(map); // Add markers for selected asset type - ++points; - } - else { - m.removeFrom(map); // Remove all other markers - } - } - } - catch (_e) { - /** Sometimes theres an error here... - * Doesn't seem to interfere with anything though and - * I don't want to see it in the console - */ - } - } - } - else - map.removeLayer(layer.LLayer); // Remove unselected layers - } - console.log("Selected " + points + " mounting point" + (points == 1 ? "" : "s") + "."); - }; - // Filter for selected mounting point table and count - /** @function */ $scope.MountingPointFilter = function () { - return function (mp) { - var correctAssetType = false; - for (var _i = 0, _a = mp.supportedAssetTypeIds; _i < _a.length; _i++) { - var i = _a[_i]; - if (i == $scope.assets.selectedAsset.id) { - correctAssetType = true; - break; - } - } // Current mounting point supports selected asset type - var correctLayer = false; - for (var _b = 0, layers_4 = layers; _b < layers_4.length; _b++) { - var layer = layers_4[_b]; - for (var _c = 0, _d = layer.Ids; _c < _d.length; _c++) { - var i = _d[_c]; - if (layer.Selected && i == mp.levelId) { - correctLayer = true; - break; - } - } - } // Current mounting point is on a selected layer - var foundBySearch = IsStringEmpty($scope.mpSearch) - ? true // Automatically true if search input empty - : (IsStringEmpty(mp.tag) ? mp.designation : mp.tag).indexOf($scope.mpSearch) >= 0 || mp.id.toString().indexOf($scope.mpSearch) >= 0; - // true if tag, designation or id contain search input - return correctAssetType && correctLayer && foundBySearch; - }; - }; - // Function for the Show button - /** @function */ $scope.ShowMp = function (mp) { - for (var _i = 0, layers_5 = layers; _i < layers_5.length; _i++) { - var l = layers_5[_i]; - // Not this again... - for (var _a = 0, _b = l.LLayer.getLayers(); _a < _b.length; _a++) { - var m = _b[_a]; - if (m.ID == mp.id) { - // Find clicked mounting point - m.openPopup(); // Open corresponding popup - map.panTo(m.getLatLng()); // Center map on the popup - break; - } - } - } - }; - // #endregion - // Get final time and format it - var time = t0 != null - ? "Finished loading data in " + (performance.now() - - t0) + "ms ########################################" - : "Finished loading data #################################################"; - console.log(time); - $scope.SelectionChanged(); // Make initial map state fit the initial menu state - $scope.loading = false; // Done loading - $scope.$apply(); - }); -}); -// #region WIKITUDE FUNCTIONS -var currentPOI = undefined; // Holds current wikitude ar marker -// Shows an augmented reality marker vor the selected mounting point -function _displayInAr(id) { - var $scope = GetScope(); // Retrieve angular scope - var mountingPoint; - for (var _i = 0, _a = $scope.mountingPoints; _i < _a.length; _i++) { - var mp = _a[_i]; - if (mp.id == id) { - mountingPoint = mp; - break; - } - } // Get correct mounting point - var name = IsStringEmpty(mountingPoint.tag) - ? mountingPoint.designation - : mountingPoint.tag; - $scope.arMountingPoint = name; - // Display mounting point tag/designation - currentPOI = new AR.GeoObject([ - new AR.GeoLocation(mountingPoint.absoluteLatLon.lat, mountingPoint.absoluteLatLon.lon) - ], { - drawables: { - cam: [ - new AR.ImageDrawable(new AR.ImageResource("img/armarker.png"), 2.5, { zOrder: 0, opacity: 1 }), - new AR.Label(name, 1, { - zOrder: 1, - style: { textColor: "#ffffff" } - }) - ], - indicator: new AR.ImageDrawable(new AR.ImageResource("img/arindicator.png"), 0.1, { - enabled: true, - verticalAnchor: AR.CONST.VERTICAL_ANCHOR.TOP - }) - } - }); // Create AR marker - $scope.arMode = true; // Hide map and menu - $scope.$apply(); - console.log("Switched to AR mode."); -} -// Goes back to the map view -function _backFromAr() { - var $scope = GetScope(); // Retrieve angular scope - $scope.arMountingPoint = ""; // Clear name display - $scope.arMode = false; // Show map and menu again - currentPOI.destroy(); - currentPOI = undefined; - $scope.$apply(); - console.log("Switched to map mode."); -} -// Attach functions -window.Functions = window.Functions || { - DisplayInAr: _displayInAr, - BackFromAr: _backFromAr -}; -// #endregion -// #endregion diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssets/main.ts b/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssets/main.ts deleted file mode 100755 index 78625214d..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssets/main.ts +++ /dev/null @@ -1,664 +0,0 @@ -// #region Initialization -console.log( - "\nBegin initialization ##################################################" -); - -import angular from "angular"; -angular != undefined - ? console.log("\tLoaded AngularJs.") - : console.error("\tFailed to load AngularJs."); - -import L, { PopupEvent, Popup } from "leaflet"; -L != undefined - ? console.log("\tLoaded Leaflet.") - : console.error("\tFailed to load Leaflet."); - -import UTMLatLng from "utm-latlng"; -UTMLatLng != undefined - ? console.log("\tLoaded utm-latlng.") - : console.error("\tFailed to load utm-latlng."); - -const isMobile: boolean = /Android/i.test(navigator.userAgent); // Check for mobile browser -console.log( - `\tDetected ${ - isMobile ? "mobile browser." : "desktop browser, disabling AR features." - }` -); - -// import AR from "scripts/architect" -declare var AR: any; // Is loaded in html from scripts/architect.js - -// AngularJS -const ngApp = angular.module("main", []); -console.log("\tInitialized AngularJs."); - -console.log( - "Initialization finished ###############################################" -); -// #endregion - -// #region Helpers - -module Calc { - // Converts radians to degrees - export function RadToDeg(rad: number): number { - return rad * (180 / Math.PI); - } - - // Converts degrees to radians - export function DegToRad(deg: number): number { - return (deg * Math.PI) / 180; - } - - // Rotates a point around 0,0 by an angle in radians - export function RotatePoint( - point: { x: number; y: number }, - angle: number - ): { x: number; y: number } { - return { - x: point.x * Math.cos(angle) - point.y * Math.sin(angle), - y: point.x * Math.sin(angle) + point.y * Math.cos(angle) - }; - } - - // UTM Coordinates - class UTM { - Easting: number; - Northing: number; - ZoneNumber: number; - ZoneLetter: string; - constructor(e: number, n: number, zn: number, zl: string) { - this.Easting = e; - this.Northing = n; - this.ZoneNumber = zn; - this.ZoneLetter = zl; - } - } - - const _precision: number = 7; // Precision for LatLon to UTM conversion - const _utm = new UTMLatLng("WGS 84"); // Create UTM/LatLng converter for WGS84 projection - - // Wrapper for LatLon to UTM conversion - export function LatLonToUtm(lat: number, lon: number) { - return _utm.convertLatLngToUtm(lat, lon, _precision); - } - - // Wrapper for UTM to LatLon conversion - export function UtmToLatLon(utm: UTM): { lat: number; lon: number } { - let temp = _utm.convertUtmToLatLng( - utm.Easting, - utm.Northing, - utm.ZoneNumber, - utm.ZoneLetter - ); - return { lat: temp.lat, lon: temp.lng }; - } -} - -// Leaflet marker with additional info to represent a mounting point -class MountingPoint extends L.Marker { - SupportedAssets: number[] = []; - ID: number = -1; -} - -// Represents all levels with the same designation, -// Stores the mounting points of those levels -class Layer { - Name: string; - Ids: number[]; - Selected: boolean; - LLayer: L.LayerGroup; - - constructor(name) { - this.Name = name; - this.Ids = []; - this.Selected = true; - this.LLayer = L.layerGroup(undefined); - } -} - -// Returns true if str is undefined, empty or null -function IsStringEmpty(str: string): boolean { - return str == undefined || str == "" || str == null; -} - -// jQuery like shortcut to get html elements -function $(query: string): HTMLElement | null { - return document.querySelector(query); -} - -// Retrieves the angular $scope from outside a controller -function GetScope(): any { - return angular.element($("body") as Element).scope() as any; -} - -function Status(str: string): void { - GetScope().status = str; - console.log(str); - ($("#progressBar") as HTMLProgressElement).value++; -} - -// #endregion - -// Main AngularJs controller -ngApp.controller("ctrl", $scope => { - let data: any = {}; // Will hold the websocket response - let t0: number | null = null; // Measures the time it takes to load and parse - $scope.disableInput = false; // True when loadData kicks in, disables the inputs - $scope.connected = false; // True when websocket response was received - $scope.status = undefined; // String that will be shown while connecting - - // Writes the websocket response to data when the load button is clicked - /** @function */ $scope.loadDataFromWS = (ip: string): void => { - $scope.disableInput = true; - console.log( - "Begin loading data ####################################################" - ); - - t0 = performance.now(); // Get start time - - // Default value for ip if nothing was entered - ip = IsStringEmpty(ip) ? "ws://192.168.133.140:2080" : ip; - - // Catch invalid ips - try { - var ws = new WebSocket(ip); // Connect to the websocket - } catch (e) { - alert("Invalid IP"); - return; - } - - Status(`\tConnecting to ${ip}...`); - - // Connect to the web socket - ws.onopen = () => { - console.log("\tConnected."); - ws.send( - JSON.stringify({ - type: "getEssentials", - uuid: "UUID" - }) - ); - }; - - // Handles the response of the websocket - ws.onmessage = response => { - console.log( - `\tFetched ${Math.round( - new TextEncoder().encode(response.data).length / 1000 - )}kb.` - ); - data = JSON.parse(response.data).data; // Parse websocket response to data - window.localStorage.setItem("data", escape(response.data)); - $scope.$broadcast("dataLoaded"); // Call response event to kick in the map and selection GUI - }; - - // Handle bad websocket responses - ws.onclose = event => { - if (event.code > 1000) { - t0 = null; - $scope.status = ""; - alert(`Error when getting websocket response.\n${event.code}`); - $scope.disableInput = false; - } - }; - }; - - /** @function */ $scope.loadDataFromCache = () => { - $scope.disableInput = true; - console.log( - "Begin loading data ####################################################" - ); - t0 = performance.now(); - Status("Loading data from cache..."); - - try { - if (window.localStorage.getItem("data") == null) throw new Error(); - let _data = unescape(window.localStorage.getItem("data") as string); - data = JSON.parse(_data).data; - console.log( - `\tLoaded ${Math.round( - new TextEncoder().encode(_data).length / 1000 - )}kb from cache.` - ); - $scope.$broadcast("dataLoaded"); - } catch { - $scope.status = ""; - $scope.disableInput = false; - t0 = null; - console.log("\tCould not load data from cache."); - alert("No data cached."); - } - }; - - // Handles websocket response event - $scope.$on("dataLoaded", () => { - let _data: any = data; - - $scope.connected = true; // Switches the connection menu for the mounting point selection - $scope.loading = true; // Disables the GUI while doing stuff - - // #region MAP - - console.log("\tCreating map."); - - // Create the map, set view and image - let map = new L.Map("map").setView( - new L.LatLng(53.0528064472226, 8.89412999153137), - 8 - ); - let imageBounds = new L.LatLngBounds([ - [53.0528064472226, 8.89412999153137], - [53.056520842139, 8.90030980110168] - ]); - let mapImage = L.imageOverlay("img/RDE2.jpg", imageBounds); - map.addLayer(mapImage); - map.fitBounds(imageBounds); - - // #endregion - // #region BUILDINGS - - // Get buildings - let buildings: any[] = _data.objects; - - Status(`\tParsing ${buildings.length} buildings...`); - - // Create GeoJson from buidling footprints - let footprintPolygons: GeoJSON.FeatureCollection = { - type: "FeatureCollection", - features: [] - }; - - for (let currentBuilding of buildings) { - // Check if current builing has footprint data, if not: skip - if (!(currentBuilding.path[0] == undefined)) { - // Holds footprint coordinates of the current building - let footprintCoords: number[][][] = [[]]; - - // Parse footprint coordinates from current building - for (let pos of currentBuilding.path) { - footprintCoords[0].push([ - // Convert from radians to degrees and add to the array - Calc.RadToDeg(pos.lon), - Calc.RadToDeg(pos.lat) - ]); - } - - // Last point has to be the same as the first point so we add it again - footprintCoords[0].push([ - Calc.RadToDeg(currentBuilding.path[0].lon), - Calc.RadToDeg(currentBuilding.path[0].lat) - ]); - - // Create new GeoJson Feature with building footprint - let currentFootprint: GeoJSON.Feature = { - type: "Feature", - properties: { - name: currentBuilding.designation - }, - geometry: { - type: "Polygon", - coordinates: footprintCoords - } - }; - - // Add GeoJson feature to feature collection - footprintPolygons.features.push(currentFootprint); - } - } - - // Draw building footprints to map, add name popups - let footprintGeoJson = L.geoJSON(footprintPolygons, { - onEachFeature: (feature, layer) => { - layer.bindPopup(`

    ${feature.properties.name}

    `); - } - }).addTo(map); - - // #endregion - // #region LEVELS - - let levels: any[] = _data.levels; // Levels are the actual floors in the building - let layers: Layer[] = []; // Layers are their representation on the map - - Status(`\tParsing ${levels.length} levels...`); - - for (let level of levels) { - // Create a layer for each level - - let add: boolean = true; - for (let layer of layers) { - // Levels with duplicate names will be on the same layer - if (level.designation === layer.Name) { - add = false; - layer.Ids.push(level.id); - break; - } - } - - if (add) { - // Create new Layer if level is not a duplicate - let newLayer: Layer = new Layer(level.designation); - newLayer.Ids.push(level.id); - layers.push(newLayer); - } - } - - let outdoorLayer: Layer = new Layer("outdoor"); // Create a layer for mounting points outside of buildings - outdoorLayer.Ids = [-1]; - - let footprintLayer: Layer = new Layer("buildings"); // Create a layer for the building footprint - footprintLayer.LLayer = footprintGeoJson; - - layers.push(outdoorLayer); // Add outdoor and footprint layers - layers.push(footprintLayer); - - $scope.layers = layers; // Add layers to the checkbox menu - - // #endregion - // #region MOUNTING POINTS - - // Get mounting points - let mountingPoints: any[] = _data.mountingPoints; - - Status(`\tParsing ${mountingPoints.length} mounting points...`); - - for (let m of mountingPoints) { - for (let b of buildings) { - if (b.id == m.objectId) { - // Current mounting point is in current buidling? - - b.utmRefPoint = Calc.LatLonToUtm( - Calc.RadToDeg(b.refPoint.lat), - Calc.RadToDeg(b.refPoint.lon) - ); // Converts refPoint of the building to UTM - - m.fixedPosition = Calc.RotatePoint( - { x: m.position3d.x, y: m.position3d.y }, - Calc.DegToRad(b.rotationDegree) - ); // Rotates coords of the mounting point by rotationDegree of the building - - m.absoluteUtm = b.utmRefPoint; - m.absoluteUtm.Easting += m.fixedPosition.x; - m.absoluteUtm.Northing += m.fixedPosition.y; - m.absoluteLatLon = Calc.UtmToLatLon(m.absoluteUtm); - // Add refPoint to the relative position and convert back to lat/lng - - const arButtonHtml = isMobile - ? `` - : "AR not supported on desktop."; - - for (let l of layers) { - for (let i of l.Ids) { - if (i == m.levelId) { - // Current mouting point is on current level? - - let marker = new MountingPoint( - // Create a marker for the mounting point - new L.LatLng( - m.absoluteLatLon.lat, - m.absoluteLatLon.lon - ), - { - icon: L.icon({ - iconUrl: "img/marker.png", - iconSize: [30, 30] - }) - } - ) - .bindPopup( - // Create a popup with info about the mounting point - `

    - ${IsStringEmpty(m.tag) ? m.designation : m.tag} -

    - - - - - - - - - - - - - -
    ID${m.id}
    Object ID${m.objectId}
    Supported Asset Type IDs${m.supportedAssetTypeIds}
    -
    - ${arButtonHtml} - ` - ) - .addTo(map); // Add it to the map - - marker.SupportedAssets = // Add info about supported asset types - m.supportedAssetTypeIds; - marker.ID = m.id; // Add mounting point id - - l.LLayer.addLayer(marker); // Add marker to corresponding layer - } - } - } - } - } - } - - $scope.mountingPoints = mountingPoints; - - // #endregion - // #region ASSETS - - // Get asset types - let assets: any[] = _data.assetTypes; - - Status(`\tParsing ${assets.length} assets...`); - - // Add asset types to the dropdown menu - $scope.assets = { - availableAssets: assets, - selectedAsset: assets[0] - }; - - // #endregion - // #region ANGULAR FUNCTIONS - - // Called by either the layer or asset selection - /** @function */ $scope.SelectionChanged = () => { - let points: number = 0; - for (let layer of layers) { - if (layer.Selected) { - map.addLayer(layer.LLayer); // Add selected layers - - // Hacky type conversion to get the supported asset types from each mounting point on a layer - // If it's stupid but it works it's not stupid - for (let m of (layer.LLayer.getLayers() as unknown[]) as MountingPoint[]) { - try { - for (let a of m.SupportedAssets) { - if (a == $scope.assets.selectedAsset.id) { - m.addTo(map); // Add markers for selected asset type - ++points; - } else { - m.removeFrom(map); // Remove all other markers - } - } - } catch { - /** Sometimes theres an error here... - * Doesn't seem to interfere with anything though and - * I don't want to see it in the console - */ - } - } - } else map.removeLayer(layer.LLayer); // Remove unselected layers - } - console.log( - `Selected ${points} mounting point${points == 1 ? "" : "s"}.` - ); - }; - - // Filter for selected mounting point table and count - /** @function */ $scope.MountingPointFilter = () => { - return mp => { - let correctAssetType: boolean = false; - - for (let i of mp.supportedAssetTypeIds) { - if (i == $scope.assets.selectedAsset.id) { - correctAssetType = true; - break; - } - } // Current mounting point supports selected asset type - - let correctLayer: boolean = false; - - for (let layer of layers) { - for (let i of layer.Ids) { - if (layer.Selected && i == mp.levelId) { - correctLayer = true; - break; - } - } - } // Current mounting point is on a selected layer - - let foundBySearch: boolean = IsStringEmpty($scope.mpSearch) - ? true // Automatically true if search input empty - : (IsStringEmpty(mp.tag) ? mp.designation : mp.tag).indexOf( - $scope.mpSearch - ) >= 0 || mp.id.toString().indexOf($scope.mpSearch) >= 0; - // true if tag, designation or id contain search input - - return correctAssetType && correctLayer && foundBySearch; - }; - }; - - // Function for the Show button - /** @function */ $scope.ShowMp = mp => { - for (let l of layers) { - // Not this again... - for (let m of (l.LLayer.getLayers() as unknown[]) as MountingPoint[]) { - if (m.ID == mp.id) { - // Find clicked mounting point - m.openPopup(); // Open corresponding popup - map.panTo(m.getLatLng()); // Center map on the popup - break; - } - } - } - }; - - // #endregion - - // Get final time and format it - let time: string = - t0 != null - ? `Finished loading data in ${performance.now() - - t0}ms ########################################` - : `Finished loading data #################################################`; - console.log(time); - - $scope.SelectionChanged(); // Make initial map state fit the initial menu state - $scope.loading = false; // Done loading - $scope.$apply(); - }); -}); - -// #region WIKITUDE FUNCTIONS - -var currentPOI: any = undefined; // Holds current wikitude ar marker - -// Shows an augmented reality marker vor the selected mounting point -function _displayInAr(id: number): void { - let $scope = GetScope(); // Retrieve angular scope - let mountingPoint: any; - - for (let mp of $scope.mountingPoints) { - if (mp.id == id) { - mountingPoint = mp; - break; - } - } // Get correct mounting point - - let name = IsStringEmpty(mountingPoint.tag) - ? mountingPoint.designation - : mountingPoint.tag; - - $scope.arMountingPoint = name; - // Display mounting point tag/designation - - currentPOI = new AR.GeoObject( - [ - new AR.GeoLocation( - mountingPoint.absoluteLatLon.lat, - mountingPoint.absoluteLatLon.lon - ) - ], - { - drawables: { - cam: [ - new AR.ImageDrawable( - new AR.ImageResource("img/armarker.png"), - 2.5, - { zOrder: 0, opacity: 1 } - ), - new AR.Label(name, 1, { - zOrder: 1, - style: { textColor: "#ffffff" } - }) - ], - indicator: new AR.ImageDrawable( - new AR.ImageResource("img/arindicator.png"), - 0.1, - { - enabled: true, - verticalAnchor: AR.CONST.VERTICAL_ANCHOR.TOP - } - ) - } - } - ); // Create AR marker - - $scope.arMode = true; // Hide map and menu - - $scope.$apply(); - - console.log("Switched to AR mode."); -} - -// Goes back to the map view -function _backFromAr(): void { - let $scope = GetScope(); // Retrieve angular scope - - $scope.arMountingPoint = ""; // Clear name display - $scope.arMode = false; // Show map and menu again - - currentPOI.destroy(); - currentPOI = undefined; - - $scope.$apply(); - - console.log("Switched to map mode."); -} - -// #region TS -> JS -/** - * Hacky way to make typescript functions accessible from the html page - * like in regular javascript - */ - -// Add "Functions"-object to window -declare global { - interface Window { - Functions: any; - } -} - -// Attach functions -window.Functions = window.Functions || { - DisplayInAr: _displayInAr, - BackFromAr: _backFromAr -}; -// #endregion - -// #endregion diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssets/package-lock.json b/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssets/package-lock.json deleted file mode 100755 index 71d83fb48..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssets/package-lock.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "requires": true, - "lockfileVersion": 1, - "dependencies": { - "@types/angular": { - "version": "1.6.54", - "resolved": "https://registry.npmjs.org/@types/angular/-/angular-1.6.54.tgz", - "integrity": "sha512-xA1FuozWXeRQ7FClUbvk8ePL+dydBeDoCWRPFTHU5+8uvVtIIfLGiHA8CMkwsbddFCYnTDVbLxG85a/HBx7LtA==" - }, - "@types/geojson": { - "version": "7946.0.5", - "resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.5.tgz", - "integrity": "sha512-rLlMXpd3rdlrp0+xsrda/hFfOpIxgqFcRpk005UKbHtcdFK+QXAjhBAPnvO58qF4O1LdDXrcaiJxMgstCIlcaw==" - }, - "@types/leaflet": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/@types/leaflet/-/leaflet-1.4.2.tgz", - "integrity": "sha512-iRyUFh6m5OSbhekHxlZb5SkdfUVpaXhk+e8fgQviZL6iZ1chV3Q030/+M6jO2A6VM235A1hYuUmBMVsrLAvKEA==", - "requires": { - "@types/geojson": "*" - } - }, - "angular": { - "version": "1.7.7", - "resolved": "https://registry.npmjs.org/angular/-/angular-1.7.7.tgz", - "integrity": "sha512-MH3JEGd8y/EkNCKJ8EV6Ch0j9X0rZTta/QVIDpBWaIdfh85/e5KO8+ZKgvWIb02MQuiS20pDFmMFlv4ZaLcLWg==" - }, - "leaflet": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/leaflet/-/leaflet-1.4.0.tgz", - "integrity": "sha512-x9j9tGY1+PDLN9pcWTx9/y6C5nezoTMB8BLK5jTakx+H7bPlnbCHfi9Hjg+Qt36sgDz/cb9lrSpNQXmk45Tvhw==" - }, - "utm-latlng": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/utm-latlng/-/utm-latlng-1.0.5.tgz", - "integrity": "sha1-rmBbTCLSapYVmoH2vLOSkyEj18I=" - } - } -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssets/package.json b/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssets/package.json deleted file mode 100755 index 9ee0bc12c..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssets/package.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "dependencies": { - "@types/angular": "^1.6.54", - "@types/leaflet": "^1.4.2", - "angular": "^1.7.7", - "leaflet": "^1.4.0", - "utm-latlng": "^1.0.5" - } -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssets/scripts/leaflet.css b/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssets/scripts/leaflet.css deleted file mode 100755 index 72998d005..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssets/scripts/leaflet.css +++ /dev/null @@ -1,624 +0,0 @@ -/* required styles */ - -.leaflet-pane, -.leaflet-tile, -.leaflet-marker-icon, -.leaflet-marker-shadow, -.leaflet-tile-container, -.leaflet-pane > svg, -.leaflet-pane > canvas, -.leaflet-zoom-box, -.leaflet-image-layer, -.leaflet-layer { - position: absolute; - left: 0; - top: 0; - } -.leaflet-container { - overflow: hidden; - } -.leaflet-tile, -.leaflet-marker-icon, -.leaflet-marker-shadow { - -webkit-user-select: none; - -moz-user-select: none; - user-select: none; - -webkit-user-drag: none; - } -/* Safari renders non-retina tile on retina better with this, but Chrome is worse */ -.leaflet-safari .leaflet-tile { - image-rendering: -webkit-optimize-contrast; - } -/* hack that prevents hw layers "stretching" when loading new tiles */ -.leaflet-safari .leaflet-tile-container { - width: 1600px; - height: 1600px; - -webkit-transform-origin: 0 0; - } -.leaflet-marker-icon, -.leaflet-marker-shadow { - display: block; - } -/* .leaflet-container svg: reset svg max-width decleration shipped in Joomla! (joomla.org) 3.x */ -/* .leaflet-container img: map is broken in FF if you have max-width: 100% on tiles */ -.leaflet-container .leaflet-overlay-pane svg, -.leaflet-container .leaflet-marker-pane img, -.leaflet-container .leaflet-shadow-pane img, -.leaflet-container .leaflet-tile-pane img, -.leaflet-container img.leaflet-image-layer { - max-width: none !important; - } - -.leaflet-container.leaflet-touch-zoom { - -ms-touch-action: pan-x pan-y; - touch-action: pan-x pan-y; - } -.leaflet-container.leaflet-touch-drag { - -ms-touch-action: pinch-zoom; - } -.leaflet-container.leaflet-touch-drag.leaflet-touch-zoom { - -ms-touch-action: none; - touch-action: none; -} -.leaflet-tile { - filter: inherit; - visibility: hidden; - } -.leaflet-tile-loaded { - visibility: inherit; - } -.leaflet-zoom-box { - width: 0; - height: 0; - -moz-box-sizing: border-box; - box-sizing: border-box; - z-index: 800; - } -/* workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=888319 */ -.leaflet-overlay-pane svg { - -moz-user-select: none; - } - -.leaflet-pane { z-index: 400; } - -.leaflet-tile-pane { z-index: 200; } -.leaflet-overlay-pane { z-index: 400; } -.leaflet-shadow-pane { z-index: 500; } -.leaflet-marker-pane { z-index: 600; } -.leaflet-tooltip-pane { z-index: 650; } -.leaflet-popup-pane { z-index: 700; } - -.leaflet-map-pane canvas { z-index: 100; } -.leaflet-map-pane svg { z-index: 200; } - -.leaflet-vml-shape { - width: 1px; - height: 1px; - } -.lvml { - behavior: url(#default#VML); - display: inline-block; - position: absolute; - } - - -/* control positioning */ - -.leaflet-control { - position: relative; - z-index: 800; - pointer-events: visiblePainted; /* IE 9-10 doesn't have auto */ - pointer-events: auto; - } -.leaflet-top, -.leaflet-bottom { - position: absolute; - z-index: 1000; - pointer-events: none; - } -.leaflet-top { - top: 0; - } -.leaflet-right { - right: 0; - } -.leaflet-bottom { - bottom: 0; - } -.leaflet-left { - left: 0; - } -.leaflet-control { - float: left; - clear: both; - } -.leaflet-right .leaflet-control { - float: right; - } -.leaflet-top .leaflet-control { - margin-top: 10px; - } -.leaflet-bottom .leaflet-control { - margin-bottom: 10px; - } -.leaflet-left .leaflet-control { - margin-left: 10px; - } -.leaflet-right .leaflet-control { - margin-right: 10px; - } - - -/* zoom and fade animations */ - -.leaflet-fade-anim .leaflet-tile { - will-change: opacity; - } -.leaflet-fade-anim .leaflet-popup { - opacity: 0; - -webkit-transition: opacity 0.2s linear; - -moz-transition: opacity 0.2s linear; - -o-transition: opacity 0.2s linear; - transition: opacity 0.2s linear; - } -.leaflet-fade-anim .leaflet-map-pane .leaflet-popup { - opacity: 1; - } -.leaflet-zoom-animated { - -webkit-transform-origin: 0 0; - -ms-transform-origin: 0 0; - transform-origin: 0 0; - } -.leaflet-zoom-anim .leaflet-zoom-animated { - will-change: transform; - } -.leaflet-zoom-anim .leaflet-zoom-animated { - -webkit-transition: -webkit-transform 0.25s cubic-bezier(0,0,0.25,1); - -moz-transition: -moz-transform 0.25s cubic-bezier(0,0,0.25,1); - -o-transition: -o-transform 0.25s cubic-bezier(0,0,0.25,1); - transition: transform 0.25s cubic-bezier(0,0,0.25,1); - } -.leaflet-zoom-anim .leaflet-tile, -.leaflet-pan-anim .leaflet-tile { - -webkit-transition: none; - -moz-transition: none; - -o-transition: none; - transition: none; - } - -.leaflet-zoom-anim .leaflet-zoom-hide { - visibility: hidden; - } - - -/* cursors */ - -.leaflet-interactive { - cursor: pointer; - } -.leaflet-grab { - cursor: -webkit-grab; - cursor: -moz-grab; - } -.leaflet-crosshair, -.leaflet-crosshair .leaflet-interactive { - cursor: crosshair; - } -.leaflet-popup-pane, -.leaflet-control { - cursor: auto; - } -.leaflet-dragging .leaflet-grab, -.leaflet-dragging .leaflet-grab .leaflet-interactive, -.leaflet-dragging .leaflet-marker-draggable { - cursor: move; - cursor: -webkit-grabbing; - cursor: -moz-grabbing; - } - -/* marker & overlays interactivity */ -.leaflet-marker-icon, -.leaflet-marker-shadow, -.leaflet-image-layer, -.leaflet-pane > svg path, -.leaflet-tile-container { - pointer-events: none; - } - -.leaflet-marker-icon.leaflet-interactive, -.leaflet-image-layer.leaflet-interactive, -.leaflet-pane > svg path.leaflet-interactive { - pointer-events: visiblePainted; /* IE 9-10 doesn't have auto */ - pointer-events: auto; - } - -/* visual tweaks */ - -.leaflet-container { - background: #ddd; - outline: 0; - } -.leaflet-container a { - color: #0078A8; - } -.leaflet-container a.leaflet-active { - outline: 2px solid orange; - } -.leaflet-zoom-box { - border: 2px dotted #38f; - background: rgba(255,255,255,0.5); - } - - -/* general typography */ -.leaflet-container { - font: 12px/1.5 "Helvetica Neue", Arial, Helvetica, sans-serif; - } - - -/* general toolbar styles */ - -.leaflet-bar { - box-shadow: 0 1px 5px rgba(0,0,0,0.65); - border-radius: 4px; - } -.leaflet-bar a, -.leaflet-bar a:hover { - background-color: #fff; - border-bottom: 1px solid #ccc; - width: 26px; - height: 26px; - line-height: 26px; - display: block; - text-align: center; - text-decoration: none; - color: black; - } -.leaflet-bar a, -.leaflet-control-layers-toggle { - background-position: 50% 50%; - background-repeat: no-repeat; - display: block; - } -.leaflet-bar a:hover { - background-color: #f4f4f4; - } -.leaflet-bar a:first-child { - border-top-left-radius: 4px; - border-top-right-radius: 4px; - } -.leaflet-bar a:last-child { - border-bottom-left-radius: 4px; - border-bottom-right-radius: 4px; - border-bottom: none; - } -.leaflet-bar a.leaflet-disabled { - cursor: default; - background-color: #f4f4f4; - color: #bbb; - } - -.leaflet-touch .leaflet-bar a { - width: 30px; - height: 30px; - line-height: 30px; - } - - -/* zoom control */ - -.leaflet-control-zoom-in, -.leaflet-control-zoom-out { - font: bold 18px 'Lucida Console', Monaco, monospace; - text-indent: 1px; - } -.leaflet-control-zoom-out { - font-size: 20px; - } - -.leaflet-touch .leaflet-control-zoom-in { - font-size: 22px; - } -.leaflet-touch .leaflet-control-zoom-out { - font-size: 24px; - } - - -/* layers control */ - -.leaflet-control-layers { - box-shadow: 0 1px 5px rgba(0,0,0,0.4); - background: #fff; - border-radius: 5px; - } -.leaflet-control-layers-toggle { - background-image: url(images/layers.png); - width: 36px; - height: 36px; - } -.leaflet-retina .leaflet-control-layers-toggle { - background-image: url(images/layers-2x.png); - background-size: 26px 26px; - } -.leaflet-touch .leaflet-control-layers-toggle { - width: 44px; - height: 44px; - } -.leaflet-control-layers .leaflet-control-layers-list, -.leaflet-control-layers-expanded .leaflet-control-layers-toggle { - display: none; - } -.leaflet-control-layers-expanded .leaflet-control-layers-list { - display: block; - position: relative; - } -.leaflet-control-layers-expanded { - padding: 6px 10px 6px 6px; - color: #333; - background: #fff; - } -.leaflet-control-layers-scrollbar { - overflow-y: scroll; - padding-right: 5px; - } -.leaflet-control-layers-selector { - margin-top: 2px; - position: relative; - top: 1px; - } -.leaflet-control-layers label { - display: block; - } -.leaflet-control-layers-separator { - height: 0; - border-top: 1px solid #ddd; - margin: 5px -10px 5px -6px; - } - -/* Default icon URLs */ -.leaflet-default-icon-path { - background-image: url(images/marker-icon.png); - } - - -/* attribution and scale controls */ - -.leaflet-container .leaflet-control-attribution { - background: #fff; - background: rgba(255, 255, 255, 0.7); - margin: 0; - } -.leaflet-control-attribution, -.leaflet-control-scale-line { - padding: 0 5px; - color: #333; - } -.leaflet-control-attribution a { - text-decoration: none; - } -.leaflet-control-attribution a:hover { - text-decoration: underline; - } -.leaflet-container .leaflet-control-attribution, -.leaflet-container .leaflet-control-scale { - font-size: 11px; - } -.leaflet-left .leaflet-control-scale { - margin-left: 5px; - } -.leaflet-bottom .leaflet-control-scale { - margin-bottom: 5px; - } -.leaflet-control-scale-line { - border: 2px solid #777; - border-top: none; - line-height: 1.1; - padding: 2px 5px 1px; - font-size: 11px; - white-space: nowrap; - overflow: hidden; - -moz-box-sizing: border-box; - box-sizing: border-box; - - background: #fff; - background: rgba(255, 255, 255, 0.5); - } -.leaflet-control-scale-line:not(:first-child) { - border-top: 2px solid #777; - border-bottom: none; - margin-top: -2px; - } -.leaflet-control-scale-line:not(:first-child):not(:last-child) { - border-bottom: 2px solid #777; - } - -.leaflet-touch .leaflet-control-attribution, -.leaflet-touch .leaflet-control-layers, -.leaflet-touch .leaflet-bar { - box-shadow: none; - } -.leaflet-touch .leaflet-control-layers, -.leaflet-touch .leaflet-bar { - border: 2px solid rgba(0,0,0,0.2); - background-clip: padding-box; - } - - -/* popup */ - -.leaflet-popup { - position: absolute; - text-align: center; - margin-bottom: 20px; - } -.leaflet-popup-content-wrapper { - padding: 1px; - text-align: left; - border-radius: 12px; - } -.leaflet-popup-content { - margin: 13px 19px; - line-height: 1.4; - } -.leaflet-popup-content p { - margin: 18px 0; - } -.leaflet-popup-tip-container { - width: 40px; - height: 20px; - position: absolute; - left: 50%; - margin-left: -20px; - overflow: hidden; - pointer-events: none; - } -.leaflet-popup-tip { - width: 17px; - height: 17px; - padding: 1px; - - margin: -10px auto 0; - - -webkit-transform: rotate(45deg); - -moz-transform: rotate(45deg); - -ms-transform: rotate(45deg); - -o-transform: rotate(45deg); - transform: rotate(45deg); - } -.leaflet-popup-content-wrapper, -.leaflet-popup-tip { - background: white; - color: #333; - box-shadow: 0 3px 14px rgba(0,0,0,0.4); - } -.leaflet-container a.leaflet-popup-close-button { - position: absolute; - top: 0; - right: 0; - padding: 4px 4px 0 0; - border: none; - text-align: center; - width: 18px; - height: 14px; - font: 16px/14px Tahoma, Verdana, sans-serif; - color: #c3c3c3; - text-decoration: none; - font-weight: bold; - background: transparent; - } -.leaflet-container a.leaflet-popup-close-button:hover { - color: #999; - } -.leaflet-popup-scrolled { - overflow: auto; - border-bottom: 1px solid #ddd; - border-top: 1px solid #ddd; - } - -.leaflet-oldie .leaflet-popup-content-wrapper { - zoom: 1; - } -.leaflet-oldie .leaflet-popup-tip { - width: 24px; - margin: 0 auto; - - -ms-filter: "progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)"; - filter: progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678); - } -.leaflet-oldie .leaflet-popup-tip-container { - margin-top: -1px; - } - -.leaflet-oldie .leaflet-control-zoom, -.leaflet-oldie .leaflet-control-layers, -.leaflet-oldie .leaflet-popup-content-wrapper, -.leaflet-oldie .leaflet-popup-tip { - border: 1px solid #999; - } - - -/* div icon */ - -.leaflet-div-icon { - background: #fff; - border: 1px solid #666; - } - - -/* Tooltip */ -/* Base styles for the element that has a tooltip */ -.leaflet-tooltip { - position: absolute; - padding: 6px; - background-color: #fff; - border: 1px solid #fff; - border-radius: 3px; - color: #222; - white-space: nowrap; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - pointer-events: none; - box-shadow: 0 1px 3px rgba(0,0,0,0.4); - } -.leaflet-tooltip.leaflet-clickable { - cursor: pointer; - pointer-events: auto; - } -.leaflet-tooltip-top:before, -.leaflet-tooltip-bottom:before, -.leaflet-tooltip-left:before, -.leaflet-tooltip-right:before { - position: absolute; - pointer-events: none; - border: 6px solid transparent; - background: transparent; - content: ""; - } - -/* Directions */ - -.leaflet-tooltip-bottom { - margin-top: 6px; -} -.leaflet-tooltip-top { - margin-top: -6px; -} -.leaflet-tooltip-bottom:before, -.leaflet-tooltip-top:before { - left: 50%; - margin-left: -6px; - } -.leaflet-tooltip-top:before { - bottom: 0; - margin-bottom: -12px; - border-top-color: #fff; - } -.leaflet-tooltip-bottom:before { - top: 0; - margin-top: -12px; - margin-left: -6px; - border-bottom-color: #fff; - } -.leaflet-tooltip-left { - margin-left: -6px; -} -.leaflet-tooltip-right { - margin-left: 6px; -} -.leaflet-tooltip-left:before, -.leaflet-tooltip-right:before { - top: 50%; - margin-top: -6px; - } -.leaflet-tooltip-left:before { - right: 0; - margin-right: -12px; - border-left-color: #fff; - } -.leaflet-tooltip-right:before { - left: 0; - margin-left: -12px; - border-right-color: #fff; - } diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssets/style.css b/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssets/style.css deleted file mode 100755 index 0c912af3d..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssets/style.css +++ /dev/null @@ -1,105 +0,0 @@ - -table { - background-color: darkgray; -} - -th, -td { - text-align: left; - padding: 5px; - background-color: white; -} - -.bigBr { - line-height: 200%; -} - -#map { - height: 100vh; - width: 100%; -} - -#parentContainer { - width: 100%; - height: 100vh; - overflow: hidden; - background-color: white; -} - -#connectionConatiner { - border: 1px solid black; - padding: 10px; - margin: auto; - width: 300px; - text-align: center; -} - -#mapContainer { - height: 100%; - width: 66%; - float: left; -} - -#guiContainer { - height: 100%; - width: 34%; - float: right; - box-sizing: border-box; - padding: 20px; -} - -#arCtrl { - position: absolute; - background-color: white; - top: 90vh; - height: 10vh; - width: 98%; - text-align: center; - align-content: center; -} - -#mp { - overflow: auto; - height: 350px; -} - -@media only screen and (max-width: 500px) { - - #map { - height: 50%; - width: 99%; - position: fixed; - } - - #parentContainer { - width: 100%; - height: 100vh; - overflow: hidden; - background-color: white; - } - - #mapContainer { - height: 50%; - width: 100%; - float: unset; - } - - #guiContainer { - position: fixed; - overflow: auto; - top: 55%; - height: 45%; - box-sizing: border-box; - padding: 20px; - width: 100%; - float: unset; - } - - h1 { - font-size: 20px; - } - - body { - font-size: 15px; - } -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssets/tsconfig.json b/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssets/tsconfig.json deleted file mode 100755 index b149c42e7..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssets/tsconfig.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "compilerOptions": { - "baseUrl": ".", - "paths": { "*": ["types/*"] }, - /* Basic Options */ - "target": "es5" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */, - "module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */, - // "lib": [], /* Specify library files to be included in the compilation. */ - // "allowJs": true, /* Allow javascript files to be compiled. */ - // "checkJs": true, /* Report errors in .js files. */ - // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ - // "declaration": true, /* Generates corresponding '.d.ts' file. */ - // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ - // "sourceMap": true, /* Generates corresponding '.map' file. */ - // "outFile": "./", /* Concatenate and emit output to single file. */ - // "outDir": "./", /* Redirect output structure to the directory. */ - // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ - // "composite": true, /* Enable project compilation */ - // "removeComments": true, /* Do not emit comments to output. */ - // "noEmit": true, /* Do not emit outputs. */ - // "importHelpers": true, /* Import emit helpers from 'tslib'. */ - // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ - // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ - - /* Strict Type-Checking Options */ - "strict": true /* Enable all strict type-checking options. */, - "noImplicitAny": false /* Raise error on expressions and declarations with an implied 'any' type. */, - // "strictNullChecks": true, /* Enable strict null checks. */ - // "strictFunctionTypes": true, /* Enable strict checking of function types. */ - // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ - // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ - // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ - // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ - - /* Additional Checks */ - // "noUnusedLocals": true, /* Report errors on unused locals. */ - // "noUnusedParameters": true, /* Report errors on unused parameters. */ - // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ - // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ - - /* Module Resolution Options */ - // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ - // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ - // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ - // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ - // "typeRoots": [], /* List of folders to include type definitions from. */ - "types": [ - "angular", - "leaflet" - ] /* Type declaration files to be included in compilation. */, - // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ - - /* Source Map Options */ - // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ - // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ - // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ - // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ - - /* Experimental Options */ - // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ - // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ - } -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/@types/angular/LICENSE b/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/@types/angular/LICENSE deleted file mode 100755 index 21071075c..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/@types/angular/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ - MIT License - - Copyright (c) Microsoft Corporation. All rights reserved. - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/@types/angular/README.md b/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/@types/angular/README.md deleted file mode 100755 index 1387a5206..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/@types/angular/README.md +++ /dev/null @@ -1,16 +0,0 @@ -# Installation -> `npm install --save @types/angular` - -# Summary -This package contains type definitions for Angular JS ( http://angularjs.org ). - -# Details -Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/angular - -Additional Details - * Last updated: Wed, 06 Feb 2019 21:12:43 GMT - * Dependencies: none - * Global values: angular - -# Credits -These definitions were written by Diego Vilar , Georgii Dolzhykov , Caleb St-Denis , Leonard Thieu , Steffen Kowalski . diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/@types/angular/index.d.ts b/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/@types/angular/index.d.ts deleted file mode 100755 index 0c28ddbf2..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/@types/angular/index.d.ts +++ /dev/null @@ -1,2274 +0,0 @@ -// Type definitions for Angular JS 1.6 -// Project: http://angularjs.org -// Definitions by: Diego Vilar -// Georgii Dolzhykov -// Caleb St-Denis -// Leonard Thieu -// Steffen Kowalski -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -/// - -declare var angular: angular.IAngularStatic; - -// Support for painless dependency injection -declare global { - interface Function { - $inject?: ReadonlyArray; - } -} - -export as namespace angular; -export as namespace ng; - -// Support AMD require -export = angular; - -import ng = angular; - -/////////////////////////////////////////////////////////////////////////////// -// ng module (angular.js) -/////////////////////////////////////////////////////////////////////////////// -declare namespace angular { - type Injectable = T | Array; - - // not directly implemented, but ensures that constructed class implements $get - interface IServiceProviderClass { - new (...args: any[]): IServiceProvider; - } - - interface IServiceProviderFactory { - (...args: any[]): IServiceProvider; - } - - // All service providers extend this interface - interface IServiceProvider { - $get: any; - } - - interface IAngularBootstrapConfig { - strictDi?: boolean; - } - - /////////////////////////////////////////////////////////////////////////// - // AngularStatic - // see http://docs.angularjs.org/api - /////////////////////////////////////////////////////////////////////////// - interface IAngularStatic { - bind(context: any, fn: Function, ...args: any[]): Function; - - /** - * Use this function to manually start up angular application. - * - * @param element DOM element which is the root of angular application. - * @param modules An array of modules to load into the application. - * Each item in the array should be the name of a predefined module or a (DI annotated) - * function that will be invoked by the injector as a config block. - * @param config an object for defining configuration options for the application. The following keys are supported: - * - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code. - */ - bootstrap(element: string|Element|JQuery|Document, modules?: Array, config?: IAngularBootstrapConfig): auto.IInjectorService; - - /** - * Creates a deep copy of source, which should be an object or an array. - * - * - If no destination is supplied, a copy of the object or array is created. - * - If a destination is provided, all of its elements (for array) or properties (for objects) are deleted and then all elements/properties from the source are copied to it. - * - If source is not an object or array (inc. null and undefined), source is returned. - * - If source is identical to 'destination' an exception will be thrown. - * - * @param source The source that will be used to make a copy. Can be any type, including primitives, null, and undefined. - * @param destination Destination into which the source is copied. If provided, must be of the same type as source. - */ - copy(source: T, destination?: T): T; - - /** - * Wraps a raw DOM element or HTML string as a jQuery element. - * - * If jQuery is available, angular.element is an alias for the jQuery function. If jQuery is not available, angular.element delegates to Angular's built-in subset of jQuery, called "jQuery lite" or "jqLite." - */ - element: JQueryStatic; - equals(value1: any, value2: any): boolean; - extend(destination: any, ...sources: any[]): any; - - /** - * Invokes the iterator function once for each item in obj collection, which can be either an object or an array. The iterator function is invoked with iterator(value, key), where value is the value of an object property or an array element and key is the object property key or array element index. Specifying a context for the function is optional. - * - * It is worth noting that .forEach does not iterate over inherited properties because it filters using the hasOwnProperty method. - * - * @param obj Object to iterate over. - * @param iterator Iterator function. - * @param context Object to become context (this) for the iterator function. - */ - forEach = T[]>( - obj: U, - iterator: (value: U[number], key: number, obj: U) => void, - context?: any - ): U; - /** - * Invokes the iterator function once for each item in obj collection, which can be either an object or an array. The iterator function is invoked with iterator(value, key), where value is the value of an object property or an array element and key is the object property key or array element index. Specifying a context for the function is optional. - * - * It is worth noting that .forEach does not iterate over inherited properties because it filters using the hasOwnProperty method. - * - * @param obj Object to iterate over. - * @param iterator Iterator function. - * @param context Object to become context (this) for the iterator function. - */ - forEach(obj: { [index: string]: T; }, iterator: (value: T, key: string, obj: { [index: string]: T; }) => void, context?: any): { [index: string]: T; }; - /** - * Invokes the iterator function once for each item in obj collection, which can be either an object or an array. The iterator function is invoked with iterator(value, key), where value is the value of an object property or an array element and key is the object property key or array element index. Specifying a context for the function is optional. - * - * It is worth noting that .forEach does not iterate over inherited properties because it filters using the hasOwnProperty method. - * - * @param obj Object to iterate over. - * @param iterator Iterator function. - * @param context Object to become context (this) for the iterator function. - */ - forEach(obj: any, iterator: (value: any, key: any, obj: any) => void, context?: any): any; - - fromJson(json: string): any; - identity(arg?: T): T; - injector(modules?: any[], strictDi?: boolean): auto.IInjectorService; - isArray(value: any): value is any[]; - isDate(value: any): value is Date; - isDefined(value: any): boolean; - isElement(value: any): boolean; - isFunction(value: any): value is Function; - isNumber(value: any): value is number; - isObject(value: any): value is Object; - isObject(value: any): value is T; - isString(value: any): value is string; - isUndefined(value: any): boolean; - lowercase(str: string): string; - - /** - * Deeply extends the destination object dst by copying own enumerable properties from the src object(s) to dst. You can specify multiple src objects. If you want to preserve original objects, you can do so by passing an empty object as the target: var object = angular.merge({}, object1, object2). - * - * Unlike extend(), merge() recursively descends into object properties of source objects, performing a deep copy. - * - * @param dst Destination object. - * @param src Source object(s). - */ - merge(dst: any, ...src: any[]): any; - - /** - * The angular.module is a global place for creating, registering and retrieving Angular modules. All modules (angular core or 3rd party) that should be available to an application must be registered using this mechanism. - * - * When passed two or more arguments, a new module is created. If passed only one argument, an existing module (the name passed as the first argument to module) is retrieved. - * - * @param name The name of the module to create or retrieve. - * @param requires The names of modules this module depends on. If specified then new module is being created. If unspecified then the module is being retrieved for further configuration. - * @param configFn Optional configuration function for the module. - */ - module( - name: string, - requires?: string[], - configFn?: Injectable): IModule; - - noop(...args: any[]): void; - reloadWithDebugInfo(): void; - toJson(obj: any, pretty?: boolean | number): string; - uppercase(str: string): string; - version: { - full: string; - major: number; - minor: number; - dot: number; - codeName: string; - }; - - /** - * If window.name contains prefix NG_DEFER_BOOTSTRAP! when angular.bootstrap is called, the bootstrap process will be paused until angular.resumeBootstrap() is called. - * @param extraModules An optional array of modules that should be added to the original list of modules that the app was about to be bootstrapped with. - */ - resumeBootstrap?(extraModules?: string[]): ng.auto.IInjectorService; - } - - /////////////////////////////////////////////////////////////////////////// - // Module - // see http://docs.angularjs.org/api/angular.Module - /////////////////////////////////////////////////////////////////////////// - interface IModule { - /** - * Use this method to register a component. - * - * @param name The name of the component. - * @param options A definition object passed into the component. - */ - component(name: string, options: IComponentOptions): IModule; - /** - * Use this method to register a component. - * - * @param object Object map of components where the keys are the names and the values are the component definition objects - */ - component(object: {[componentName: string]: IComponentOptions}): IModule; - /** - * Use this method to register work which needs to be performed on module loading. - * - * @param configFn Execute this function on module load. Useful for service configuration. - */ - config(configFn: Function): IModule; - /** - * Use this method to register work which needs to be performed on module loading. - * - * @param inlineAnnotatedFunction Execute this function on module load. Useful for service configuration. - */ - config(inlineAnnotatedFunction: any[]): IModule; - config(object: Object): IModule; - /** - * Register a constant service, such as a string, a number, an array, an object or a function, with the $injector. Unlike value it can be injected into a module configuration function (see config) and it cannot be overridden by an Angular decorator. - * - * @param name The name of the constant. - * @param value The constant value. - */ - constant(name: string, value: T): IModule; - constant(object: Object): IModule; - /** - * The $controller service is used by Angular to create new controllers. - * - * This provider allows controller registration via the register method. - * - * @param name Controller name, or an object map of controllers where the keys are the names and the values are the constructors. - * @param controllerConstructor Controller constructor fn (optionally decorated with DI annotations in the array notation). - */ - controller(name: string, controllerConstructor: Injectable): IModule; - controller(object: {[name: string]: Injectable}): IModule; - /** - * Register a new directive with the compiler. - * - * @param name Name of the directive in camel-case (i.e. ngBind which will match as ng-bind) - * @param directiveFactory An injectable directive factory function. - */ - directive(name: string, directiveFactory: Injectable>): IModule; - directive(object: {[directiveName: string]: Injectable>}): IModule; - - /** - * Register a service factory, which will be called to return the service instance. This is short for registering a service where its provider consists of only a $get property, which is the given service factory function. You should use $provide.factory(getFn) if you do not need to configure your service in a provider. - * - * @param name The name of the instance. - * @param $getFn The $getFn for the instance creation. Internally this is a short hand for $provide.provider(name, {$get: $getFn}). - */ - factory(name: string, $getFn: Injectable): IModule; - factory(object: {[name: string]: Injectable}): IModule; - filter(name: string, filterFactoryFunction: Injectable): IModule; - filter(object: {[name: string]: Injectable}): IModule; - provider(name: string, serviceProviderFactory: IServiceProviderFactory): IModule; - provider(name: string, serviceProviderConstructor: IServiceProviderClass): IModule; - provider(name: string, inlineAnnotatedConstructor: any[]): IModule; - provider(name: string, providerObject: IServiceProvider): IModule; - provider(object: Object): IModule; - /** - * Run blocks are the closest thing in Angular to the main method. A run block is the code which needs to run to kickstart the application. It is executed after all of the service have been configured and the injector has been created. Run blocks typically contain code which is hard to unit-test, and for this reason should be declared in isolated modules, so that they can be ignored in the unit-tests. - */ - run(initializationFunction: Injectable): IModule; - /** - * Register a service constructor, which will be invoked with new to create the service instance. This is short for registering a service where its provider's $get property is a factory function that returns an instance instantiated by the injector from the service constructor function. - * - * @param name The name of the instance. - * @param serviceConstructor An injectable class (constructor function) that will be instantiated. - */ - service(name: string, serviceConstructor: Injectable): IModule; - service(object: {[name: string]: Injectable}): IModule; - /** - * Register a value service with the $injector, such as a string, a number, an array, an object or a function. This is short for registering a service where its provider's $get property is a factory function that takes no arguments and returns the value service. - - Value services are similar to constant services, except that they cannot be injected into a module configuration function (see config) but they can be overridden by an Angular decorator. - * - * @param name The name of the instance. - * @param value The value. - */ - value(name: string, value: T): IModule; - value(object: Object): IModule; - - /** - * Register a service decorator with the $injector. A service decorator intercepts the creation of a service, allowing it to override or modify the behaviour of the service. The object returned by the decorator may be the original service, or a new service object which replaces or wraps and delegates to the original service. - * @param name The name of the service to decorate - * @param decorator This function will be invoked when the service needs to be instantiated and should return the decorated service instance. The function is called using the injector.invoke method and is therefore fully injectable. Local injection arguments: $delegate - The original service instance, which can be monkey patched, configured, decorated or delegated to. - */ - decorator(name: string, decorator: Injectable): IModule; - - // Properties - name: string; - requires: string[]; - } - - /////////////////////////////////////////////////////////////////////////// - // Attributes - // see http://docs.angularjs.org/api/ng.$compile.directive.Attributes - /////////////////////////////////////////////////////////////////////////// - interface IAttributes { - /** - * this is necessary to be able to access the scoped attributes. it's not very elegant - * because you have to use attrs['foo'] instead of attrs.foo but I don't know of a better way - * this should really be limited to return string but it creates this problem: http://stackoverflow.com/q/17201854/165656 - */ - [name: string]: any; - - /** - * Converts an attribute name (e.g. dash/colon/underscore-delimited string, optionally prefixed with x- or data-) to its normalized, camelCase form. - * - * Also there is special case for Moz prefix starting with upper case letter. - * - * For further information check out the guide on @see https://docs.angularjs.org/guide/directive#matching-directives - */ - $normalize(name: string): string; - - /** - * Adds the CSS class value specified by the classVal parameter to the - * element. If animations are enabled then an animation will be triggered - * for the class addition. - */ - $addClass(classVal: string): void; - - /** - * Removes the CSS class value specified by the classVal parameter from the - * element. If animations are enabled then an animation will be triggered for - * the class removal. - */ - $removeClass(classVal: string): void; - - /** - * Adds and removes the appropriate CSS class values to the element based on the difference between - * the new and old CSS class values (specified as newClasses and oldClasses). - */ - $updateClass(newClasses: string, oldClasses: string): void; - - /** - * Set DOM element attribute value. - */ - $set(key: string, value: any): void; - - /** - * Observes an interpolated attribute. - * The observer function will be invoked once during the next $digest - * following compilation. The observer is then invoked whenever the - * interpolated value changes. - */ - $observe(name: string, fn: (value?: T) => any): Function; - - /** - * A map of DOM element attribute names to the normalized name. This is needed - * to do reverse lookup from normalized name back to actual name. - */ - $attr: Object; - } - - /** - * form.FormController - type in module ng - * see https://docs.angularjs.org/api/ng/type/form.FormController - */ - interface IFormController { - /** - * Indexer which should return ng.INgModelController for most properties but cannot because of "All named properties must be assignable to string indexer type" constraint - see https://github.com/Microsoft/TypeScript/issues/272 - */ - [name: string]: any; - - $pristine: boolean; - $dirty: boolean; - $valid: boolean; - $invalid: boolean; - $submitted: boolean; - $error: { [validationErrorKey: string]: Array }; - $name?: string; - $pending?: { [validationErrorKey: string]: Array }; - $addControl(control: INgModelController | IFormController): void; - $removeControl(control: INgModelController | IFormController): void; - $setValidity(validationErrorKey: string, isValid: boolean, control: INgModelController | IFormController): void; - $setDirty(): void; - $setPristine(): void; - $commitViewValue(): void; - $rollbackViewValue(): void; - $setSubmitted(): void; - $setUntouched(): void; - } - - /////////////////////////////////////////////////////////////////////////// - // NgModelController - // see http://docs.angularjs.org/api/ng.directive:ngModel.NgModelController - /////////////////////////////////////////////////////////////////////////// - interface INgModelController { - $render(): void; - $setValidity(validationErrorKey: string, isValid: boolean): void; - // Documentation states viewValue and modelValue to be a string but other - // types do work and it's common to use them. - $setViewValue(value: any, trigger?: string): void; - $setPristine(): void; - $setDirty(): void; - $validate(): void; - $setTouched(): void; - $setUntouched(): void; - $rollbackViewValue(): void; - $commitViewValue(): void; - $processModelValue(): void; - $isEmpty(value: any): boolean; - $overrideModelOptions(options: INgModelOptions): void; - - $viewValue: any; - - $modelValue: any; - - $parsers: IModelParser[]; - $formatters: IModelFormatter[]; - $viewChangeListeners: IModelViewChangeListener[]; - $error: { [validationErrorKey: string]: boolean }; - $name?: string; - - $touched: boolean; - $untouched: boolean; - - $validators: IModelValidators; - $asyncValidators: IAsyncModelValidators; - - $pending?: { [validationErrorKey: string]: boolean }; - $pristine: boolean; - $dirty: boolean; - $valid: boolean; - $invalid: boolean; - } - - // Allows tuning how model updates are done. - // https://docs.angularjs.org/api/ng/directive/ngModelOptions - interface INgModelOptions { - updateOn?: string; - debounce?: number | { [key: string]: number; }; - allowInvalid?: boolean; - getterSetter?: boolean; - timezone?: string; - } - - interface IModelValidators { - /** - * viewValue is any because it can be an object that is called in the view like $viewValue.name:$viewValue.subName - */ - [index: string]: (modelValue: any, viewValue: any) => boolean; - } - - interface IAsyncModelValidators { - [index: string]: (modelValue: any, viewValue: any) => IPromise; - } - - interface IModelParser { - (value: any): any; - } - - interface IModelFormatter { - (value: any): any; - } - - interface IModelViewChangeListener { - (): void; - } - - /** - * $rootScope - $rootScopeProvider - service in module ng - * see https://docs.angularjs.org/api/ng/type/$rootScope.Scope and https://docs.angularjs.org/api/ng/service/$rootScope - */ - interface IRootScopeService { - $apply(): any; - $apply(exp: string): any; - $apply(exp: (scope: IScope) => any): any; - - $applyAsync(): any; - $applyAsync(exp: string): any; - $applyAsync(exp: (scope: IScope) => any): any; - - /** - * Dispatches an event name downwards to all child scopes (and their children) notifying the registered $rootScope.Scope listeners. - * - * The event life cycle starts at the scope on which $broadcast was called. All listeners listening for name event on this scope get notified. Afterwards, the event propagates to all direct and indirect scopes of the current scope and calls all registered listeners along the way. The event cannot be canceled. - * - * Any exception emitted from the listeners will be passed onto the $exceptionHandler service. - * - * @param name Event name to broadcast. - * @param args Optional one or more arguments which will be passed onto the event listeners. - */ - $broadcast(name: string, ...args: any[]): IAngularEvent; - $destroy(): void; - $digest(): void; - - /** - * Suspend watchers of this scope subtree so that they will not be invoked during digest. - * - * This can be used to optimize your application when you know that running those watchers - * is redundant. - * - * **Warning** - * - * Suspending scopes from the digest cycle can have unwanted and difficult to debug results. - * Only use this approach if you are confident that you know what you are doing and have - * ample tests to ensure that bindings get updated as you expect. - * - * Some of the things to consider are: - * - * * Any external event on a directive/component will not trigger a digest while the hosting - * scope is suspended - even if the event handler calls `$apply()` or `$rootScope.$digest()`. - * * Transcluded content exists on a scope that inherits from outside a directive but exists - * as a child of the directive's containing scope. If the containing scope is suspended the - * transcluded scope will also be suspended, even if the scope from which the transcluded - * scope inherits is not suspended. - * * Multiple directives trying to manage the suspended status of a scope can confuse each other: - * * A call to `$suspend()` on an already suspended scope is a no-op. - * * A call to `$resume()` on a non-suspended scope is a no-op. - * * If two directives suspend a scope, then one of them resumes the scope, the scope will no - * longer be suspended. This could result in the other directive believing a scope to be - * suspended when it is not. - * * If a parent scope is suspended then all its descendants will be also excluded from future - * digests whether or not they have been suspended themselves. Note that this also applies to - * isolate child scopes. - * * Calling `$digest()` directly on a descendant of a suspended scope will still run the watchers - * for that scope and its descendants. When digesting we only check whether the current scope is - * locally suspended, rather than checking whether it has a suspended ancestor. - * * Calling `$resume()` on a scope that has a suspended ancestor will not cause the scope to be - * included in future digests until all its ancestors have been resumed. - * * Resolved promises, e.g. from explicit `$q` deferreds and `$http` calls, trigger `$apply()` - * against the `$rootScope` and so will still trigger a global digest even if the promise was - * initiated by a component that lives on a suspended scope. - */ - $suspend(): void; - - /** - * Call this method to determine if this scope has been explicitly suspended. It will not - * tell you whether an ancestor has been suspended. - * To determine if this scope will be excluded from a digest triggered at the $rootScope, - * for example, you must check all its ancestors: - * - * ``` - * function isExcludedFromDigest(scope) { - * while(scope) { - * if (scope.$isSuspended()) return true; - * scope = scope.$parent; - * } - * return false; - * ``` - * - * Be aware that a scope may not be included in digests if it has a suspended ancestor, - * even if `$isSuspended()` returns false. - * - * @returns true if the current scope has been suspended. - */ - $isSuspended(): boolean; - - /** - * Resume watchers of this scope subtree in case it was suspended. - * - * See {$rootScope.Scope#$suspend} for information about the dangers of using this approach. - */ - $resume(): void; - - /** - * Dispatches an event name upwards through the scope hierarchy notifying the registered $rootScope.Scope listeners. - * - * The event life cycle starts at the scope on which $emit was called. All listeners listening for name event on this scope get notified. Afterwards, the event traverses upwards toward the root scope and calls all registered listeners along the way. The event will stop propagating if one of the listeners cancels it. - * - * Any exception emitted from the listeners will be passed onto the $exceptionHandler service. - * - * @param name Event name to emit. - * @param args Optional one or more arguments which will be passed onto the event listeners. - */ - $emit(name: string, ...args: any[]): IAngularEvent; - - $eval(): any; - $eval(expression: string, locals?: Object): any; - $eval(expression: (scope: IScope) => any, locals?: Object): any; - - $evalAsync(): void; - $evalAsync(expression: string, locals?: Object): void; - $evalAsync(expression: (scope: IScope) => void, locals?: Object): void; - - // Defaults to false by the implementation checking strategy - $new(isolate?: boolean, parent?: IScope): IScope; - - /** - * Listens on events of a given type. See $emit for discussion of event life cycle. - * - * The event listener function format is: function(event, args...). - * - * @param name Event name to listen on. - * @param listener Function to call when the event is emitted. - */ - $on(name: string, listener: (event: IAngularEvent, ...args: any[]) => any): () => void; - - $watch(watchExpression: string, listener?: string, objectEquality?: boolean): () => void; - $watch(watchExpression: string, listener?: (newValue: T, oldValue: T, scope: IScope) => any, objectEquality?: boolean): () => void; - $watch(watchExpression: (scope: IScope) => any, listener?: string, objectEquality?: boolean): () => void; - $watch(watchExpression: (scope: IScope) => T, listener?: (newValue: T, oldValue: T, scope: IScope) => any, objectEquality?: boolean): () => void; - - $watchCollection(watchExpression: string, listener: (newValue: T, oldValue: T, scope: IScope) => any): () => void; - $watchCollection(watchExpression: (scope: IScope) => T, listener: (newValue: T, oldValue: T, scope: IScope) => any): () => void; - - $watchGroup(watchExpressions: any[], listener: (newValue: any, oldValue: any, scope: IScope) => any): () => void; - $watchGroup(watchExpressions: Array<{ (scope: IScope): any }>, listener: (newValue: any, oldValue: any, scope: IScope) => any): () => void; - - $parent: IScope; - $root: IRootScopeService; - $id: number; - - // Hidden members - $$isolateBindings: any; - $$phase: any; - } - - interface IScope extends IRootScopeService { } - - /** - * $scope for ngRepeat directive. - * see https://docs.angularjs.org/api/ng/directive/ngRepeat - */ - interface IRepeatScope extends IScope { - /** - * iterator offset of the repeated element (0..length-1). - */ - $index: number; - - /** - * true if the repeated element is first in the iterator. - */ - $first: boolean; - - /** - * true if the repeated element is between the first and last in the iterator. - */ - $middle: boolean; - - /** - * true if the repeated element is last in the iterator. - */ - $last: boolean; - - /** - * true if the iterator position $index is even (otherwise false). - */ - $even: boolean; - - /** - * true if the iterator position $index is odd (otherwise false). - */ - $odd: boolean; - } - - interface IAngularEvent { - /** - * the scope on which the event was $emit-ed or $broadcast-ed. - */ - targetScope: IScope; - /** - * the scope that is currently handling the event. Once the event propagates through the scope hierarchy, this property is set to null. - */ - currentScope: IScope; - /** - * name of the event. - */ - name: string; - /** - * calling stopPropagation function will cancel further event propagation (available only for events that were $emit-ed). - */ - stopPropagation?(): void; - /** - * calling preventDefault sets defaultPrevented flag to true. - */ - preventDefault(): void; - /** - * true if preventDefault was called. - */ - defaultPrevented: boolean; - } - - /////////////////////////////////////////////////////////////////////////// - // WindowService - // see http://docs.angularjs.org/api/ng.$window - /////////////////////////////////////////////////////////////////////////// - interface IWindowService extends Window { - [key: string]: any; - } - - /////////////////////////////////////////////////////////////////////////// - // TimeoutService - // see http://docs.angularjs.org/api/ng.$timeout - /////////////////////////////////////////////////////////////////////////// - interface ITimeoutService { - (delay?: number, invokeApply?: boolean): IPromise; - (fn: (...args: any[]) => T | IPromise, delay?: number, invokeApply?: boolean, ...args: any[]): IPromise; - cancel(promise?: IPromise): boolean; - } - - /////////////////////////////////////////////////////////////////////////// - // IntervalService - // see http://docs.angularjs.org/api/ng.$interval - /////////////////////////////////////////////////////////////////////////// - interface IIntervalService { - (func: Function, delay: number, count?: number, invokeApply?: boolean, ...args: any[]): IPromise; - cancel(promise: IPromise): boolean; - } - - /** - * $filter - $filterProvider - service in module ng - * - * Filters are used for formatting data displayed to the user. - * - * see https://docs.angularjs.org/api/ng/service/$filter - */ - interface IFilterService { - (name: 'filter'): IFilterFilter; - (name: 'currency'): IFilterCurrency; - (name: 'number'): IFilterNumber; - (name: 'date'): IFilterDate; - (name: 'json'): IFilterJson; - (name: 'lowercase'): IFilterLowercase; - (name: 'uppercase'): IFilterUppercase; - (name: 'limitTo'): IFilterLimitTo; - (name: 'orderBy'): IFilterOrderBy; - /** - * Usage: - * $filter(name); - * - * @param name Name of the filter function to retrieve - */ - (name: string): T; - } - - interface IFilterFilter { - (array: T[], expression: string | IFilterFilterPatternObject | IFilterFilterPredicateFunc, comparator?: IFilterFilterComparatorFunc|boolean): T[]; - } - - interface IFilterFilterPatternObject { - [name: string]: any; - } - - interface IFilterFilterPredicateFunc { - (value: T, index: number, array: T[]): boolean; - } - - interface IFilterFilterComparatorFunc { - (actual: T, expected: T): boolean; - } - - interface IFilterOrderByItem { - value: any; - type: string; - index: any; - } - - interface IFilterOrderByComparatorFunc { - (left: IFilterOrderByItem, right: IFilterOrderByItem): -1 | 0 | 1; - } - - interface IFilterCurrency { - /** - * Formats a number as a currency (ie $1,234.56). When no currency symbol is provided, default symbol for current locale is used. - * @param amount Input to filter. - * @param symbol Currency symbol or identifier to be displayed. - * @param fractionSize Number of decimal places to round the amount to, defaults to default max fraction size for current locale - * @return Formatted number - */ - (amount: number, symbol?: string, fractionSize?: number): string; - } - - interface IFilterNumber { - /** - * Formats a number as text. - * @param number Number to format. - * @param fractionSize Number of decimal places to round the number to. If this is not provided then the fraction size is computed from the current locale's number formatting pattern. In the case of the default locale, it will be 3. - * @return Number rounded to decimalPlaces and places a “,” after each third digit. - */ - (value: number|string, fractionSize?: number|string): string; - } - - interface IFilterDate { - /** - * Formats date to a string based on the requested format. - * - * @param date Date to format either as Date object, milliseconds (string or number) or various ISO 8601 datetime string formats (e.g. yyyy-MM-ddTHH:mm:ss.sssZ and its shorter versions like yyyy-MM-ddTHH:mmZ, yyyy-MM-dd or yyyyMMddTHHmmssZ). If no timezone is specified in the string input, the time is considered to be in the local timezone. - * @param format Formatting rules (see Description). If not specified, mediumDate is used. - * @param timezone Timezone to be used for formatting. It understands UTC/GMT and the continental US time zone abbreviations, but for general use, use a time zone offset, for example, '+0430' (4 hours, 30 minutes east of the Greenwich meridian) If not specified, the timezone of the browser will be used. - * @return Formatted string or the input if input is not recognized as date/millis. - */ - (date: Date | number | string, format?: string, timezone?: string): string; - } - - interface IFilterJson { - /** - * Allows you to convert a JavaScript object into JSON string. - * @param object Any JavaScript object (including arrays and primitive types) to filter. - * @param spacing The number of spaces to use per indentation, defaults to 2. - * @return JSON string. - */ - (object: any, spacing?: number): string; - } - - interface IFilterLowercase { - /** - * Converts string to lowercase. - */ - (value: string): string; - } - - interface IFilterUppercase { - /** - * Converts string to uppercase. - */ - (value: string): string; - } - - interface IFilterLimitTo { - /** - * Creates a new array containing only a specified number of elements. The elements are taken from either the beginning or the end of the source array, string or number, as specified by the value and sign (positive or negative) of limit. - * @param input Source array to be limited. - * @param limit The length of the returned array. If the limit number is positive, limit number of items from the beginning of the source array/string are copied. If the number is negative, limit number of items from the end of the source array are copied. The limit will be trimmed if it exceeds array.length. If limit is undefined, the input will be returned unchanged. - * @param begin Index at which to begin limitation. As a negative index, begin indicates an offset from the end of input. Defaults to 0. - * @return A new sub-array of length limit or less if input array had less than limit elements. - */ - (input: T[], limit: string|number, begin?: string|number): T[]; - /** - * Creates a new string containing only a specified number of elements. The elements are taken from either the beginning or the end of the source string or number, as specified by the value and sign (positive or negative) of limit. If a number is used as input, it is converted to a string. - * @param input Source string or number to be limited. - * @param limit The length of the returned string. If the limit number is positive, limit number of items from the beginning of the source string are copied. If the number is negative, limit number of items from the end of the source string are copied. The limit will be trimmed if it exceeds input.length. If limit is undefined, the input will be returned unchanged. - * @param begin Index at which to begin limitation. As a negative index, begin indicates an offset from the end of input. Defaults to 0. - * @return A new substring of length limit or less if input had less than limit elements. - */ - (input: string|number, limit: string|number, begin?: string|number): string; - } - - interface IFilterOrderBy { - /** - * Orders a specified array by the expression predicate. It is ordered alphabetically for strings and numerically for numbers. Note: if you notice numbers are not being sorted as expected, make sure they are actually being saved as numbers and not strings. - * @param array The array to sort. - * @param expression A predicate to be used by the comparator to determine the order of elements. - * @param reverse Reverse the order of the array. - * @param comparator Function used to determine the relative order of value pairs. - * @return An array containing the items from the specified collection, ordered by a comparator function based on the values computed using the expression predicate. - */ - (array: T[], expression: string|((value: T) => any)|Array<((value: T) => any)|string>, reverse?: boolean, comparator?: IFilterOrderByComparatorFunc): T[]; - } - - /** - * $filterProvider - $filter - provider in module ng - * - * Filters are just functions which transform input to an output. However filters need to be Dependency Injected. To achieve this a filter definition consists of a factory function which is annotated with dependencies and is responsible for creating a filter function. - * - * see https://docs.angularjs.org/api/ng/provider/$filterProvider - */ - interface IFilterProvider extends IServiceProvider { - /** - * register(name); - * - * @param name Name of the filter function, or an object map of filters where the keys are the filter names and the values are the filter factories. Note: Filter names must be valid angular Expressions identifiers, such as uppercase or orderBy. Names with special characters, such as hyphens and dots, are not allowed. If you wish to namespace your filters, then you can use capitalization (myappSubsectionFilterx) or underscores (myapp_subsection_filterx). - */ - register(name: string | {}): IServiceProvider; - } - - /////////////////////////////////////////////////////////////////////////// - // LocaleService - // see http://docs.angularjs.org/api/ng.$locale - /////////////////////////////////////////////////////////////////////////// - interface ILocaleService { - id: string; - - // These are not documented - // Check angular's i18n files for exemples - NUMBER_FORMATS: ILocaleNumberFormatDescriptor; - DATETIME_FORMATS: ILocaleDateTimeFormatDescriptor; - pluralCat(num: any): string; - } - - interface ILocaleNumberFormatDescriptor { - DECIMAL_SEP: string; - GROUP_SEP: string; - PATTERNS: ILocaleNumberPatternDescriptor[]; - CURRENCY_SYM: string; - } - - interface ILocaleNumberPatternDescriptor { - minInt: number; - minFrac: number; - maxFrac: number; - posPre: string; - posSuf: string; - negPre: string; - negSuf: string; - gSize: number; - lgSize: number; - } - - interface ILocaleDateTimeFormatDescriptor { - MONTH: string[]; - SHORTMONTH: string[]; - DAY: string[]; - SHORTDAY: string[]; - AMPMS: string[]; - medium: string; - short: string; - fullDate: string; - longDate: string; - mediumDate: string; - shortDate: string; - mediumTime: string; - shortTime: string; - } - - /////////////////////////////////////////////////////////////////////////// - // LogService - // see http://docs.angularjs.org/api/ng.$log - // see http://docs.angularjs.org/api/ng.$logProvider - /////////////////////////////////////////////////////////////////////////// - interface ILogService { - debug: ILogCall; - error: ILogCall; - info: ILogCall; - log: ILogCall; - warn: ILogCall; - } - - interface ILogProvider extends IServiceProvider { - debugEnabled(): boolean; - debugEnabled(enabled: boolean): ILogProvider; - } - - // We define this as separate interface so we can reopen it later for - // the ngMock module. - interface ILogCall { - (...args: any[]): void; - } - - /////////////////////////////////////////////////////////////////////////// - // ParseService - // see http://docs.angularjs.org/api/ng.$parse - // see http://docs.angularjs.org/api/ng.$parseProvider - /////////////////////////////////////////////////////////////////////////// - interface IParseService { - (expression: string, interceptorFn?: (value: any, scope: IScope, locals: any) => any, expensiveChecks?: boolean): ICompiledExpression; - } - - interface IParseProvider { - logPromiseWarnings(): boolean; - logPromiseWarnings(value: boolean): IParseProvider; - - unwrapPromises(): boolean; - unwrapPromises(value: boolean): IParseProvider; - - /** - * Configure $parse service to add literal values that will be present as literal at expressions. - * - * @param literalName Token for the literal value. The literal name value must be a valid literal name. - * @param literalValue Value for this literal. All literal values must be primitives or `undefined`. - **/ - addLiteral(literalName: string, literalValue: any): void; - - /** - * Allows defining the set of characters that are allowed in Angular expressions. The function identifierStart will get called to know if a given character is a valid character to be the first character for an identifier. The function identifierContinue will get called to know if a given character is a valid character to be a follow-up identifier character. The functions identifierStart and identifierContinue will receive as arguments the single character to be identifier and the character code point. These arguments will be string and numeric. Keep in mind that the string parameter can be two characters long depending on the character representation. It is expected for the function to return true or false, whether that character is allowed or not. - * Since this function will be called extensivelly, keep the implementation of these functions fast, as the performance of these functions have a direct impact on the expressions parsing speed. - * - * @param identifierStart The function that will decide whether the given character is a valid identifier start character. - * @param identifierContinue The function that will decide whether the given character is a valid identifier continue character. - **/ - setIdentifierFns( - identifierStart?: (character: string, codePoint: number) => boolean, - identifierContinue?: (character: string, codePoint: number) => boolean): void; - } - - interface ICompiledExpression { - (context: any, locals?: any): any; - - literal: boolean; - constant: boolean; - - // If value is not provided, undefined is gonna be used since the implementation - // does not check the parameter. Let's force a value for consistency. If consumer - // whants to undefine it, pass the undefined value explicitly. - assign(context: any, value: any): any; - } - - /** - * $location - $locationProvider - service in module ng - * see https://docs.angularjs.org/api/ng/service/$location - */ - interface ILocationService { - absUrl(): string; - - /** - * Returns the hash fragment - */ - hash(): string; - - /** - * Changes the hash fragment and returns `$location` - */ - hash(newHash: string|null): ILocationService; - - host(): string; - - /** - * Return path of current url - */ - path(): string; - - /** - * Change path when called with parameter and return $location. - * Note: Path should always begin with forward slash (/), this method will add the forward slash if it is missing. - * - * @param path New path - */ - path(path: string): ILocationService; - - port(): number; - protocol(): string; - replace(): ILocationService; - - /** - * Return search part (as object) of current url - */ - search(): any; - - /** - * Change search part when called with parameter and return $location. - * - * @param search When called with a single argument the method acts as a setter, setting the search component of $location to the specified value. - * - * If the argument is a hash object containing an array of values, these values will be encoded as duplicate search parameters in the url. - */ - search(search: any): ILocationService; - - /** - * Change search part when called with parameter and return $location. - * - * @param search New search params - * @param paramValue If search is a string or a Number, then paramValue will override only a single search property. If paramValue is null, the property specified via the first argument will be deleted. If paramValue is an array, it will override the property of the search component of $location specified via the first argument. If paramValue is true, the property specified via the first argument will be added with no value nor trailing equal sign. - */ - search(search: string, paramValue: string|number|null|string[]|boolean): ILocationService; - - state(): any; - state(state: any): ILocationService; - url(): string; - url(url: string): ILocationService; - } - - interface ILocationProvider extends IServiceProvider { - hashPrefix(): string; - hashPrefix(prefix: string): ILocationProvider; - html5Mode(): boolean; - - // Documentation states that parameter is string, but - // implementation tests it as boolean, which makes more sense - // since this is a toggler - html5Mode(active: boolean): ILocationProvider; - html5Mode(mode: { enabled?: boolean; requireBase?: boolean; rewriteLinks?: boolean; }): ILocationProvider; - } - - /////////////////////////////////////////////////////////////////////////// - // DocumentService - // see http://docs.angularjs.org/api/ng.$document - /////////////////////////////////////////////////////////////////////////// - interface IDocumentService extends JQLite { - // Must return intersection type for index signature compatibility with JQuery - [index: number]: HTMLElement & Document; - } - - /////////////////////////////////////////////////////////////////////////// - // ExceptionHandlerService - // see http://docs.angularjs.org/api/ng.$exceptionHandler - /////////////////////////////////////////////////////////////////////////// - interface IExceptionHandlerService { - (exception: Error, cause?: string): void; - } - - /////////////////////////////////////////////////////////////////////////// - // RootElementService - // see http://docs.angularjs.org/api/ng.$rootElement - /////////////////////////////////////////////////////////////////////////// - interface IRootElementService extends JQLite {} - - interface IQResolveReject { - (): void; - (value: T): void; - } - /** - * $q - service in module ng - * A promise/deferred implementation inspired by Kris Kowal's Q. - * See http://docs.angularjs.org/api/ng/service/$q - */ - interface IQService { - new (resolver: (resolve: IQResolveReject, reject: IQResolveReject) => any): IPromise; - (resolver: (resolve: IQResolveReject, reject: IQResolveReject) => any): IPromise; - - /** - * Combines multiple promises into a single promise that is resolved when all of the input promises are resolved. - * - * Returns a single promise that will be resolved with an array of values, each value corresponding to the promise at the same index in the promises array. If any of the promises is resolved with a rejection, this resulting promise will be rejected with the same rejection value. - * - * @param promises An array of promises. - */ - all(values: [T1 | IPromise, T2 | IPromise, T3 | IPromise, T4 | IPromise , T5 | IPromise, T6 | IPromise, T7 | IPromise, T8 | IPromise, T9 | IPromise, T10 | IPromise]): IPromise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; - all(values: [T1 | IPromise, T2 | IPromise, T3 | IPromise, T4 | IPromise , T5 | IPromise, T6 | IPromise, T7 | IPromise, T8 | IPromise, T9 | IPromise]): IPromise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; - all(values: [T1 | IPromise, T2 | IPromise, T3 | IPromise, T4 | IPromise , T5 | IPromise, T6 | IPromise, T7 | IPromise, T8 | IPromise]): IPromise<[T1, T2, T3, T4, T5, T6, T7, T8]>; - all(values: [T1 | IPromise, T2 | IPromise, T3 | IPromise, T4 | IPromise , T5 | IPromise, T6 | IPromise, T7 | IPromise]): IPromise<[T1, T2, T3, T4, T5, T6, T7]>; - all(values: [T1 | IPromise, T2 | IPromise, T3 | IPromise, T4 | IPromise , T5 | IPromise, T6 | IPromise]): IPromise<[T1, T2, T3, T4, T5, T6]>; - all(values: [T1 | IPromise, T2 | IPromise, T3 | IPromise, T4 | IPromise , T5 | IPromise]): IPromise<[T1, T2, T3, T4, T5]>; - all(values: [T1 | IPromise, T2 | IPromise, T3 | IPromise, T4 | IPromise ]): IPromise<[T1, T2, T3, T4]>; - all(values: [T1 | IPromise, T2 | IPromise, T3 | IPromise]): IPromise<[T1, T2, T3]>; - all(values: [T1 | IPromise, T2 | IPromise]): IPromise<[T1, T2]>; - all(promises: Array>): IPromise; - /** - * Combines multiple promises into a single promise that is resolved when all of the input promises are resolved. - * - * Returns a single promise that will be resolved with a hash of values, each value corresponding to the promise at the same key in the promises hash. If any of the promises is resolved with a rejection, this resulting promise will be rejected with the same rejection value. - * - * @param promises A hash of promises. - */ - all(promises: { [K in keyof T]: (IPromise | T[K]); }): IPromise; - /** - * Creates a Deferred object which represents a task which will finish in the future. - */ - defer(): IDeferred; - /** - * Returns a promise that resolves or rejects as soon as one of those promises resolves or rejects, with the value or reason from that promise. - * - * @param promises A list or hash of promises. - */ - race(promises: Array> | {[key: string]: IPromise}): IPromise; - /** - * Creates a promise that is resolved as rejected with the specified reason. This api should be used to forward rejection in a chain of promises. If you are dealing with the last promise in a promise chain, you don't need to worry about it. - * - * When comparing deferreds/promises to the familiar behavior of try/catch/throw, think of reject as the throw keyword in JavaScript. This also means that if you "catch" an error via a promise error callback and you want to forward the error to the promise derived from the current promise, you have to "rethrow" the error by returning a rejection constructed via reject. - * - * @param reason Constant, message, exception or an object representing the rejection reason. - */ - reject(reason?: any): IPromise; - /** - * Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. This is useful when you are dealing with an object that might or might not be a promise, or if the promise comes from a source that can't be trusted. - * - * @param value Value or a promise - */ - resolve(value: PromiseLike|T): IPromise; - /** - * @deprecated Since TS 2.4, inference is stricter and no longer produces the desired type when T1 !== T2. - * To use resolve with two different types, pass a union type to the single-type-argument overload. - */ - resolve(value: PromiseLike|T2): IPromise; - /** - * Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. This is useful when you are dealing with an object that might or might not be a promise, or if the promise comes from a source that can't be trusted. - */ - resolve(): IPromise; - /** - * Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. This is useful when you are dealing with an object that might or might not be a promise, or if the promise comes from a source that can't be trusted. - * - * @param value Value or a promise - */ - when(value: PromiseLike|T): IPromise; - when(value: PromiseLike|T2): IPromise; - when(value: PromiseLike|T, successCallback: (promiseValue: T) => PromiseLike|TResult): IPromise; - when(value: T, successCallback: (promiseValue: T) => PromiseLike|TResult, errorCallback: null | undefined | ((reason: any) => any), notifyCallback?: (state: any) => any): IPromise; - when(value: PromiseLike, successCallback: (promiseValue: T) => PromiseLike|TResult, errorCallback: (reason: any) => TResult2 | PromiseLike, notifyCallback?: (state: any) => any): IPromise; - /** - * Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. This is useful when you are dealing with an object that might or might not be a promise, or if the promise comes from a source that can't be trusted. - */ - when(): IPromise; - } - - interface IQProvider { - /** - * Retrieves or overrides whether to generate an error when a rejected promise is not handled. - * This feature is enabled by default. - * - * @returns Current value - */ - errorOnUnhandledRejections(): boolean; - - /** - * Retrieves or overrides whether to generate an error when a rejected promise is not handled. - * This feature is enabled by default. - * - * @param value Whether to generate an error when a rejected promise is not handled. - * @returns Self for chaining otherwise. - */ - errorOnUnhandledRejections(value: boolean): IQProvider; - } - - interface IPromise { - /** - * Regardless of when the promise was or will be resolved or rejected, then calls one of - * the success or error callbacks asynchronously as soon as the result is available. The - * callbacks are called with a single argument: the result or rejection reason. - * Additionally, the notify callback may be called zero or more times to provide a - * progress indication, before the promise is resolved or rejected. - * The `successCallBack` may return `IPromise` for when a `$q.reject()` needs to - * be returned. - * This method returns a new promise which is resolved or rejected via the return value - * of the `successCallback`, `errorCallback`. It also notifies via the return value of - * the `notifyCallback` method. The promise can not be resolved or rejected from the - * `notifyCallback` method. - */ - then( - successCallback?: - | ((value: T) => PromiseLike | PromiseLike | TResult1) - | null, - errorCallback?: - | ((reason: any) => PromiseLike | PromiseLike | TResult2) - | null, - notifyCallback?: (state: any) => any - ): IPromise; - then( - successCallback?: - | ((value: T) => IPromise | IPromise | TResult1) - | null, - errorCallback?: - | ((reason: any) => IPromise | IPromise | TResult2) - | null, - notifyCallback?: (state: any) => any - ): IPromise; - - /** - * Shorthand for promise.then(null, errorCallback) - */ - catch( - onRejected?: - | ((reason: any) => PromiseLike | PromiseLike | TResult) - | null - ): IPromise; - catch( - onRejected?: - | ((reason: any) => IPromise | IPromise | TResult) - | null - ): IPromise; - - /** - * Allows you to observe either the fulfillment or rejection of a promise, but to do so without modifying the final value. This is useful to release resources or do some clean-up that needs to be done whether the promise was rejected or resolved. See the full specification for more information. - * - * Because finally is a reserved word in JavaScript and reserved keywords are not supported as property names by ES3, you'll need to invoke the method like promise['finally'](callback) to make your code IE8 and Android 2.x compatible. - */ - finally(finallyCallback: () => void): IPromise; - } - - interface IDeferred { - resolve(value?: T|IPromise): void; - reject(reason?: any): void; - notify(state?: any): void; - promise: IPromise; - } - - /////////////////////////////////////////////////////////////////////////// - // AnchorScrollService - // see http://docs.angularjs.org/api/ng.$anchorScroll - /////////////////////////////////////////////////////////////////////////// - interface IAnchorScrollService { - (): void; - (hash: string): void; - yOffset: any; - } - - interface IAnchorScrollProvider extends IServiceProvider { - disableAutoScrolling(): void; - } - - /** - * $cacheFactory - service in module ng - * - * Factory that constructs Cache objects and gives access to them. - * - * see https://docs.angularjs.org/api/ng/service/$cacheFactory - */ - interface ICacheFactoryService { - /** - * Factory that constructs Cache objects and gives access to them. - * - * @param cacheId Name or id of the newly created cache. - * @param optionsMap Options object that specifies the cache behavior. Properties: - * - * capacity — turns the cache into LRU cache. - */ - (cacheId: string, optionsMap?: { capacity?: number; }): ICacheObject; - - /** - * Get information about all the caches that have been created. - * @returns key-value map of cacheId to the result of calling cache#info - */ - info(): any; - - /** - * Get access to a cache object by the cacheId used when it was created. - * - * @param cacheId Name or id of a cache to access. - */ - get(cacheId: string): ICacheObject; - } - - /** - * $cacheFactory.Cache - type in module ng - * - * A cache object used to store and retrieve data, primarily used by $http and the script directive to cache templates and other data. - * - * see https://docs.angularjs.org/api/ng/type/$cacheFactory.Cache - */ - interface ICacheObject { - /** - * Retrieve information regarding a particular Cache. - */ - info(): { - /** - * the id of the cache instance - */ - id: string; - - /** - * the number of entries kept in the cache instance - */ - size: number; - - // ...: any additional properties from the options object when creating the cache. - }; - - /** - * Inserts a named entry into the Cache object to be retrieved later, and incrementing the size of the cache if the key was not already present in the cache. If behaving like an LRU cache, it will also remove stale entries from the set. - * - * It will not insert undefined values into the cache. - * - * @param key the key under which the cached data is stored. - * @param value the value to store alongside the key. If it is undefined, the key will not be stored. - */ - put(key: string, value?: T): T; - - /** - * Retrieves named data stored in the Cache object. - * - * @param key the key of the data to be retrieved - */ - get(key: string): T | undefined; - - /** - * Removes an entry from the Cache object. - * - * @param key the key of the entry to be removed - */ - remove(key: string): void; - - /** - * Clears the cache object of any entries. - */ - removeAll(): void; - - /** - * Destroys the Cache object entirely, removing it from the $cacheFactory set. - */ - destroy(): void; - } - - /////////////////////////////////////////////////////////////////////////// - // CompileService - // see http://docs.angularjs.org/api/ng.$compile - // see http://docs.angularjs.org/api/ng.$compileProvider - /////////////////////////////////////////////////////////////////////////// - interface ICompileService { - (element: string | Element | JQuery, transclude?: ITranscludeFunction, maxPriority?: number): ITemplateLinkingFunction; - } - - interface ICompileProvider extends IServiceProvider { - directive(name: string, directiveFactory: Injectable>): ICompileProvider; - directive(object: {[directiveName: string]: Injectable>}): ICompileProvider; - - component(name: string, options: IComponentOptions): ICompileProvider; - component(object: {[componentName: string]: IComponentOptions}): ICompileProvider; - - aHrefSanitizationWhitelist(): RegExp; - aHrefSanitizationWhitelist(regexp: RegExp): ICompileProvider; - - imgSrcSanitizationWhitelist(): RegExp; - imgSrcSanitizationWhitelist(regexp: RegExp): ICompileProvider; - - debugInfoEnabled(): boolean; - debugInfoEnabled(enabled: boolean): ICompileProvider; - - /** - * Call this method to enable/disable whether directive controllers are assigned bindings before calling the controller's constructor. - * If enabled (true), the compiler assigns the value of each of the bindings to the properties of the controller object before the constructor of this object is called. - * If disabled (false), the compiler calls the constructor first before assigning bindings. - * Defaults to false. - * See: https://docs.angularjs.org/api/ng/provider/$compileProvider#preAssignBindingsEnabled - */ - preAssignBindingsEnabled(): boolean; - preAssignBindingsEnabled(enabled: boolean): ICompileProvider; - - /** - * Sets the number of times $onChanges hooks can trigger new changes before giving up and assuming that the model is unstable. - * Increasing the TTL could have performance implications, so you should not change it without proper justification. - * Default: 10. - * See: https://docs.angularjs.org/api/ng/provider/$compileProvider#onChangesTtl - */ - onChangesTtl(): number; - onChangesTtl(limit: number): ICompileProvider; - - /** - * It indicates to the compiler whether or not directives on comments should be compiled. - * It results in a compilation performance gain since the compiler doesn't have to check comments when looking for directives. - * Defaults to true. - * See: https://docs.angularjs.org/api/ng/provider/$compileProvider#commentDirectivesEnabled - */ - commentDirectivesEnabled(): boolean; - commentDirectivesEnabled(enabled: boolean): ICompileProvider; - - /** - * It indicates to the compiler whether or not directives on element classes should be compiled. - * It results in a compilation performance gain since the compiler doesn't have to check element classes when looking for directives. - * Defaults to true. - * See: https://docs.angularjs.org/api/ng/provider/$compileProvider#cssClassDirectivesEnabled - */ - cssClassDirectivesEnabled(): boolean; - cssClassDirectivesEnabled(enabled: boolean): ICompileProvider; - - /** - * Call this method to enable/disable strict component bindings check. - * If enabled, the compiler will enforce that for all bindings of a - * component that are not set as optional with ?, an attribute needs - * to be provided on the component's HTML tag. - * Defaults to false. - * See: https://docs.angularjs.org/api/ng/provider/$compileProvider#strictComponentBindingsEnabled - */ - strictComponentBindingsEnabled(): boolean; - strictComponentBindingsEnabled(enabled: boolean): ICompileProvider; - } - - interface ICloneAttachFunction { - // Let's hint but not force cloneAttachFn's signature - (clonedElement?: JQLite, scope?: IScope): any; - } - - // This corresponds to the "publicLinkFn" returned by $compile. - interface ITemplateLinkingFunction { - (scope: IScope, cloneAttachFn?: ICloneAttachFunction, options?: ITemplateLinkingFunctionOptions): JQLite; - } - - interface ITemplateLinkingFunctionOptions { - parentBoundTranscludeFn?: ITranscludeFunction; - transcludeControllers?: { - [controller: string]: { instance: IController } - }; - futureParentElement?: JQuery; - } - - /** - * This corresponds to $transclude passed to controllers and to the transclude function passed to link functions. - * https://docs.angularjs.org/api/ng/service/$compile#-controller- - * http://teropa.info/blog/2015/06/09/transclusion.html - */ - interface ITranscludeFunction { - // If the scope is provided, then the cloneAttachFn must be as well. - (scope: IScope, cloneAttachFn: ICloneAttachFunction, futureParentElement?: JQuery, slotName?: string): JQLite; - // If one argument is provided, then it's assumed to be the cloneAttachFn. - (cloneAttachFn?: ICloneAttachFunction, futureParentElement?: JQuery, slotName?: string): JQLite; - - /** - * Returns true if the specified slot contains content (i.e. one or more DOM nodes) - */ - isSlotFilled(slotName: string): boolean; - } - - /////////////////////////////////////////////////////////////////////////// - // ControllerService - // see http://docs.angularjs.org/api/ng.$controller - // see http://docs.angularjs.org/api/ng.$controllerProvider - /////////////////////////////////////////////////////////////////////////// - - /** - * The minimal local definitions required by $controller(ctrl, locals) calls. - */ - interface IControllerLocals { - $scope: ng.IScope; - $element: JQuery; - } - - interface IControllerService { - // Although the documentation doesn't state this, locals are optional - (controllerConstructor: new (...args: any[]) => T, locals?: any): T; - (controllerConstructor: (...args: any[]) => T, locals?: any): T; - (controllerName: string, locals?: any): T; - } - - interface IControllerProvider extends IServiceProvider { - register(name: string, controllerConstructor: Function): void; - register(name: string, dependencyAnnotatedConstructor: any[]): void; - allowGlobals(): void; - } - - /** - * xhrFactory - * Replace or decorate this service to create your own custom XMLHttpRequest objects. - * see https://docs.angularjs.org/api/ng/service/$xhrFactory - */ - interface IXhrFactory { - (method: string, url: string): T; - } - - /** - * HttpService - * see http://docs.angularjs.org/api/ng/service/$http - */ - interface IHttpService { - /** - * Object describing the request to be made and how it should be processed. - */ - (config: IRequestConfig): IHttpPromise; - - /** - * Shortcut method to perform GET request. - * - * @param url Relative or absolute URL specifying the destination of the request - * @param config Optional configuration object - */ - get(url: string, config?: IRequestShortcutConfig): IHttpPromise; - - /** - * Shortcut method to perform DELETE request. - * - * @param url Relative or absolute URL specifying the destination of the request - * @param config Optional configuration object - */ - delete(url: string, config?: IRequestShortcutConfig): IHttpPromise; - - /** - * Shortcut method to perform HEAD request. - * - * @param url Relative or absolute URL specifying the destination of the request - * @param config Optional configuration object - */ - head(url: string, config?: IRequestShortcutConfig): IHttpPromise; - - /** - * Shortcut method to perform JSONP request. - * - * @param url Relative or absolute URL specifying the destination of the request - * @param config Optional configuration object - */ - jsonp(url: string, config?: IRequestShortcutConfig): IHttpPromise; - - /** - * Shortcut method to perform POST request. - * - * @param url Relative or absolute URL specifying the destination of the request - * @param data Request content - * @param config Optional configuration object - */ - post(url: string, data: any, config?: IRequestShortcutConfig): IHttpPromise; - - /** - * Shortcut method to perform PUT request. - * - * @param url Relative or absolute URL specifying the destination of the request - * @param data Request content - * @param config Optional configuration object - */ - put(url: string, data: any, config?: IRequestShortcutConfig): IHttpPromise; - - /** - * Shortcut method to perform PATCH request. - * - * @param url Relative or absolute URL specifying the destination of the request - * @param data Request content - * @param config Optional configuration object - */ - patch(url: string, data: any, config?: IRequestShortcutConfig): IHttpPromise; - - /** - * Runtime equivalent of the $httpProvider.defaults property. Allows configuration of default headers, withCredentials as well as request and response transformations. - */ - defaults: IHttpProviderDefaults; - - /** - * Array of config objects for currently pending requests. This is primarily meant to be used for debugging purposes. - */ - pendingRequests: IRequestConfig[]; - } - - /** - * Object describing the request to be made and how it should be processed. - * see http://docs.angularjs.org/api/ng/service/$http#usage - */ - interface IRequestShortcutConfig extends IHttpProviderDefaults { - /** - * {Object.} - * Map of strings or objects which will be turned to ?key1=value1&key2=value2 after the url. If the value is not a string, it will be JSONified. - */ - params?: any; - - /** - * {string|Object} - * Data to be sent as the request message data. - */ - data?: any; - - /** - * Timeout in milliseconds, or promise that should abort the request when resolved. - */ - timeout?: number|IPromise; - - /** - * See [XMLHttpRequest.responseType]https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#xmlhttprequest-responsetype - */ - responseType?: string; - - /** - * Name of the parameter added (by AngularJS) to the request to specify the name (in the server response) of the JSON-P callback to invoke. - * If unspecified, $http.defaults.jsonpCallbackParam will be used by default. This property is only applicable to JSON-P requests. - */ - jsonpCallbackParam?: string; - } - - /** - * Object describing the request to be made and how it should be processed. - * see http://docs.angularjs.org/api/ng/service/$http#usage - */ - interface IRequestConfig extends IRequestShortcutConfig { - /** - * HTTP method (e.g. 'GET', 'POST', etc) - */ - method: string; - /** - * Absolute or relative URL of the resource that is being requested. - */ - url: string; - /** - * Event listeners to be bound to the XMLHttpRequest object. - * To bind events to the XMLHttpRequest upload object, use uploadEventHandlers. The handler will be called in the context of a $apply block. - */ - eventHandlers?: { [type: string]: EventListenerOrEventListenerObject }; - /** - * Event listeners to be bound to the XMLHttpRequest upload object. - * To bind events to the XMLHttpRequest object, use eventHandlers. The handler will be called in the context of a $apply block. - */ - uploadEventHandlers?: { [type: string]: EventListenerOrEventListenerObject }; - } - - interface IHttpHeadersGetter { - (): { [name: string]: string; }; - (headerName: string): string; - } - - interface IHttpPromiseCallback { - (data: T, status: number, headers: IHttpHeadersGetter, config: IRequestConfig): void; - } - - interface IHttpResponse { - data: T; - status: number; - headers: IHttpHeadersGetter; - config: IRequestConfig; - statusText: string; - /** Added in AngularJS 1.6.6 */ - xhrStatus: 'complete' | 'error' | 'timeout' | 'abort'; - } - - /** @deprecated The old name of IHttpResponse. Kept for compatibility. */ - type IHttpPromiseCallbackArg = IHttpResponse; - - type IHttpPromise = IPromise>; - - // See the jsdoc for transformData() at https://github.com/angular/angular.js/blob/master/src/ng/http.js#L228 - interface IHttpRequestTransformer { - (data: any, headersGetter: IHttpHeadersGetter): any; - } - - // The definition of fields are the same as IHttpResponse - interface IHttpResponseTransformer { - (data: any, headersGetter: IHttpHeadersGetter, status: number): any; - } - - interface HttpHeaderType { - [requestType: string]: string|((config: IRequestConfig) => string); - } - - interface IHttpRequestConfigHeaders { - [requestType: string]: any; - common?: any; - get?: any; - post?: any; - put?: any; - patch?: any; - } - - /** - * Object that controls the defaults for $http provider. Not all fields of IRequestShortcutConfig can be configured - * via defaults and the docs do not say which. The following is based on the inspection of the source code. - * https://docs.angularjs.org/api/ng/service/$http#defaults - * https://docs.angularjs.org/api/ng/service/$http#usage - * https://docs.angularjs.org/api/ng/provider/$httpProvider The properties section - */ - interface IHttpProviderDefaults { - /** - * {boolean|Cache} - * If true, a default $http cache will be used to cache the GET request, otherwise if a cache instance built with $cacheFactory, this cache will be used for caching. - */ - cache?: any; - - /** - * Transform function or an array of such functions. The transform function takes the http request body and - * headers and returns its transformed (typically serialized) version. - * @see {@link https://docs.angularjs.org/api/ng/service/$http#transforming-requests-and-responses} - */ - transformRequest?: IHttpRequestTransformer |IHttpRequestTransformer[]; - - /** - * Transform function or an array of such functions. The transform function takes the http response body and - * headers and returns its transformed (typically deserialized) version. - */ - transformResponse?: IHttpResponseTransformer | IHttpResponseTransformer[]; - - /** - * Map of strings or functions which return strings representing HTTP headers to send to the server. If the - * return value of a function is null, the header will not be sent. - * The key of the map is the request verb in lower case. The "common" key applies to all requests. - * @see {@link https://docs.angularjs.org/api/ng/service/$http#setting-http-headers} - */ - headers?: IHttpRequestConfigHeaders; - - /** Name of HTTP header to populate with the XSRF token. */ - xsrfHeaderName?: string; - - /** Name of cookie containing the XSRF token. */ - xsrfCookieName?: string; - - /** - * whether to to set the withCredentials flag on the XHR object. See [requests with credentials]https://developer.mozilla.org/en/http_access_control#section_5 for more information. - */ - withCredentials?: boolean; - - /** - * A function used to the prepare string representation of request parameters (specified as an object). If - * specified as string, it is interpreted as a function registered with the $injector. Defaults to - * $httpParamSerializer. - */ - paramSerializer?: string | ((obj: any) => string); - } - - interface IHttpInterceptor { - request?(config: IRequestConfig): IRequestConfig | IPromise; - requestError?(rejection: any): IRequestConfig | IPromise; - response?(response: IHttpResponse): IPromise> | IHttpResponse; - responseError?(rejection: any): IPromise> | IHttpResponse; - } - - interface IHttpInterceptorFactory { - (...args: any[]): IHttpInterceptor; - } - - interface IHttpProvider extends IServiceProvider { - defaults: IHttpProviderDefaults; - - /** - * Register service factories (names or implementations) for interceptors which are called before and after - * each request. - */ - interceptors: Array>; - useApplyAsync(): boolean; - useApplyAsync(value: boolean): IHttpProvider; - - /** - * @param value If true, `$http` will return a normal promise without the `success` and `error` methods. - * @returns If a value is specified, returns the $httpProvider for chaining. - * otherwise, returns the current configured value. - */ - useLegacyPromiseExtensions(value: boolean): boolean | IHttpProvider; - } - - /////////////////////////////////////////////////////////////////////////// - // HttpBackendService - // see http://docs.angularjs.org/api/ng.$httpBackend - // You should never need to use this service directly. - /////////////////////////////////////////////////////////////////////////// - interface IHttpBackendService { - // XXX Perhaps define callback signature in the future - (method: string, url: string, post?: any, callback?: Function, headers?: any, timeout?: number, withCredentials?: boolean): void; - } - - /////////////////////////////////////////////////////////////////////////// - // InterpolateService - // see http://docs.angularjs.org/api/ng.$interpolate - // see http://docs.angularjs.org/api/ng.$interpolateProvider - /////////////////////////////////////////////////////////////////////////// - interface IInterpolateService { - (text: string, mustHaveExpression?: boolean, trustedContext?: string, allOrNothing?: boolean): IInterpolationFunction; - endSymbol(): string; - startSymbol(): string; - } - - interface IInterpolationFunction { - (context: any): string; - } - - interface IInterpolateProvider extends IServiceProvider { - startSymbol(): string; - startSymbol(value: string): IInterpolateProvider; - endSymbol(): string; - endSymbol(value: string): IInterpolateProvider; - } - - /////////////////////////////////////////////////////////////////////////// - // TemplateCacheService - // see http://docs.angularjs.org/api/ng.$templateCache - /////////////////////////////////////////////////////////////////////////// - interface ITemplateCacheService extends ICacheObject {} - - /////////////////////////////////////////////////////////////////////////// - // SCEService - // see http://docs.angularjs.org/api/ng.$sce - /////////////////////////////////////////////////////////////////////////// - interface ISCEService { - getTrusted(type: string, mayBeTrusted: any): any; - getTrustedCss(value: any): any; - getTrustedHtml(value: any): any; - getTrustedJs(value: any): any; - getTrustedResourceUrl(value: any): any; - getTrustedUrl(value: any): any; - parse(type: string, expression: string): (context: any, locals: any) => any; - parseAsCss(expression: string): (context: any, locals: any) => any; - parseAsHtml(expression: string): (context: any, locals: any) => any; - parseAsJs(expression: string): (context: any, locals: any) => any; - parseAsResourceUrl(expression: string): (context: any, locals: any) => any; - parseAsUrl(expression: string): (context: any, locals: any) => any; - trustAs(type: string, value: any): any; - trustAsHtml(value: any): any; - trustAsJs(value: any): any; - trustAsResourceUrl(value: any): any; - trustAsUrl(value: any): any; - isEnabled(): boolean; - } - - /////////////////////////////////////////////////////////////////////////// - // SCEProvider - // see http://docs.angularjs.org/api/ng.$sceProvider - /////////////////////////////////////////////////////////////////////////// - interface ISCEProvider extends IServiceProvider { - enabled(value: boolean): void; - } - - /////////////////////////////////////////////////////////////////////////// - // SCEDelegateService - // see http://docs.angularjs.org/api/ng.$sceDelegate - /////////////////////////////////////////////////////////////////////////// - interface ISCEDelegateService { - getTrusted(type: string, mayBeTrusted: any): any; - trustAs(type: string, value: any): any; - valueOf(value: any): any; - } - - /////////////////////////////////////////////////////////////////////////// - // SCEDelegateProvider - // see http://docs.angularjs.org/api/ng.$sceDelegateProvider - /////////////////////////////////////////////////////////////////////////// - interface ISCEDelegateProvider extends IServiceProvider { - resourceUrlBlacklist(): any[]; - resourceUrlBlacklist(blacklist: any[]): void; - resourceUrlWhitelist(): any[]; - resourceUrlWhitelist(whitelist: any[]): void; - } - - /** - * $templateRequest service - * see http://docs.angularjs.org/api/ng/service/$templateRequest - */ - interface ITemplateRequestService { - /** - * Downloads a template using $http and, upon success, stores the - * contents inside of $templateCache. - * - * If the HTTP request fails or the response data of the HTTP request is - * empty then a $compile error will be thrown (unless - * {ignoreRequestError} is set to true). - * - * @param tpl The template URL. - * @param ignoreRequestError Whether or not to ignore the exception - * when the request fails or the template is - * empty. - * - * @return A promise whose value is the template content. - */ - (tpl: string, ignoreRequestError?: boolean): IPromise; - /** - * total amount of pending template requests being downloaded. - */ - totalPendingRequests: number; - } - - /////////////////////////////////////////////////////////////////////////// - // Component - // see http://angularjs.blogspot.com.br/2015/11/angularjs-15-beta2-and-14-releases.html - // and http://toddmotto.com/exploring-the-angular-1-5-component-method/ - /////////////////////////////////////////////////////////////////////////// - /** - * Component definition object (a simplified directive definition object) - */ - interface IComponentOptions { - /** - * Controller constructor function that should be associated with newly created scope or the name of a registered - * controller if passed as a string. Empty function by default. - * Use the array form to define dependencies (necessary if strictDi is enabled and you require dependency injection) - */ - controller?: string | Injectable; - /** - * An identifier name for a reference to the controller. If present, the controller will be published to its scope under - * the specified name. If not present, this will default to '$ctrl'. - */ - controllerAs?: string; - /** - * html template as a string or a function that returns an html template as a string which should be used as the - * contents of this component. Empty string by default. - * If template is a function, then it is injected with the following locals: - * $element - Current element - * $attrs - Current attributes object for the element - * Use the array form to define dependencies (necessary if strictDi is enabled and you require dependency injection) - */ - template?: string | Injectable<(...args: any[]) => string>; - /** - * Path or function that returns a path to an html template that should be used as the contents of this component. - * If templateUrl is a function, then it is injected with the following locals: - * $element - Current element - * $attrs - Current attributes object for the element - * Use the array form to define dependencies (necessary if strictDi is enabled and you require dependency injection) - */ - templateUrl?: string | Injectable<(...args: any[]) => string>; - /** - * Define DOM attribute binding to component properties. Component properties are always bound to the component - * controller and not to the scope. - */ - bindings?: {[boundProperty: string]: string}; - /** - * Whether transclusion is enabled. Disabled by default. - */ - transclude?: boolean | {[slot: string]: string}; - /** - * Requires the controllers of other directives and binds them to this component's controller. - * The object keys specify the property names under which the required controllers (object values) will be bound. - * Note that the required controllers will not be available during the instantiation of the controller, - * but they are guaranteed to be available just before the $onInit method is executed! - */ - require?: {[controller: string]: string}; - } - - type IControllerConstructor = - (new (...args: any[]) => IController) | - // Instead of classes, plain functions are often used as controller constructors, especially in examples. - ((...args: any[]) => (void | IController)); - - /** - * Directive controllers have a well-defined lifecycle. Each controller can implement "lifecycle hooks". These are methods that - * will be called by Angular at certain points in the life cycle of the directive. - * https://docs.angularjs.org/api/ng/service/$compile#life-cycle-hooks - * https://docs.angularjs.org/guide/component - */ - interface IController { - /** - * Called on each controller after all the controllers on an element have been constructed and had their bindings - * initialized (and before the pre & post linking functions for the directives on this element). This is a good - * place to put initialization code for your controller. - */ - $onInit?(): void; - /** - * Called on each turn of the digest cycle. Provides an opportunity to detect and act on changes. - * Any actions that you wish to take in response to the changes that you detect must be invoked from this hook; - * implementing this has no effect on when `$onChanges` is called. For example, this hook could be useful if you wish - * to perform a deep equality check, or to check a `Dat`e object, changes to which would not be detected by Angular's - * change detector and thus not trigger `$onChanges`. This hook is invoked with no arguments; if detecting changes, - * you must store the previous value(s) for comparison to the current values. - */ - $doCheck?(): void; - /** - * Called whenever one-way bindings are updated. The onChangesObj is a hash whose keys are the names of the bound - * properties that have changed, and the values are an {@link IChangesObject} object of the form - * { currentValue, previousValue, isFirstChange() }. Use this hook to trigger updates within a component such as - * cloning the bound value to prevent accidental mutation of the outer value. - */ - $onChanges?(onChangesObj: IOnChangesObject): void; - /** - * Called on a controller when its containing scope is destroyed. Use this hook for releasing external resources, - * watches and event handlers. - */ - $onDestroy?(): void; - /** - * Called after this controller's element and its children have been linked. Similar to the post-link function this - * hook can be used to set up DOM event handlers and do direct DOM manipulation. Note that child elements that contain - * templateUrl directives will not have been compiled and linked since they are waiting for their template to load - * asynchronously and their own compilation and linking has been suspended until that occurs. This hook can be considered - * analogous to the ngAfterViewInit and ngAfterContentInit hooks in Angular 2. Since the compilation process is rather - * different in Angular 1 there is no direct mapping and care should be taken when upgrading. - */ - $postLink?(): void; - - // IController implementations frequently do not implement any of its methods. - // A string indexer indicates to TypeScript not to issue a weak type error in this case. - [s: string]: any; - } - - /** - * Interface for the $onInit lifecycle hook - * https://docs.angularjs.org/api/ng/service/$compile#life-cycle-hooks - */ - interface IOnInit { - /** - * Called on each controller after all the controllers on an element have been constructed and had their bindings - * initialized (and before the pre & post linking functions for the directives on this element). This is a good - * place to put initialization code for your controller. - */ - $onInit(): void; - } - - /** - * Interface for the $doCheck lifecycle hook - * https://docs.angularjs.org/api/ng/service/$compile#life-cycle-hooks - */ - interface IDoCheck { - /** - * Called on each turn of the digest cycle. Provides an opportunity to detect and act on changes. - * Any actions that you wish to take in response to the changes that you detect must be invoked from this hook; - * implementing this has no effect on when `$onChanges` is called. For example, this hook could be useful if you wish - * to perform a deep equality check, or to check a `Dat`e object, changes to which would not be detected by Angular's - * change detector and thus not trigger `$onChanges`. This hook is invoked with no arguments; if detecting changes, - * you must store the previous value(s) for comparison to the current values. - */ - $doCheck(): void; - } - - /** - * Interface for the $onChanges lifecycle hook - * https://docs.angularjs.org/api/ng/service/$compile#life-cycle-hooks - */ - interface IOnChanges { - /** - * Called whenever one-way bindings are updated. The onChangesObj is a hash whose keys are the names of the bound - * properties that have changed, and the values are an {@link IChangesObject} object of the form - * { currentValue, previousValue, isFirstChange() }. Use this hook to trigger updates within a component such as - * cloning the bound value to prevent accidental mutation of the outer value. - */ - $onChanges(onChangesObj: IOnChangesObject): void; - } - - /** - * Interface for the $onDestroy lifecycle hook - * https://docs.angularjs.org/api/ng/service/$compile#life-cycle-hooks - */ - interface IOnDestroy { - /** - * Called on a controller when its containing scope is destroyed. Use this hook for releasing external resources, - * watches and event handlers. - */ - $onDestroy(): void; - } - - /** - * Interface for the $postLink lifecycle hook - * https://docs.angularjs.org/api/ng/service/$compile#life-cycle-hooks - */ - interface IPostLink { - /** - * Called after this controller's element and its children have been linked. Similar to the post-link function this - * hook can be used to set up DOM event handlers and do direct DOM manipulation. Note that child elements that contain - * templateUrl directives will not have been compiled and linked since they are waiting for their template to load - * asynchronously and their own compilation and linking has been suspended until that occurs. This hook can be considered - * analogous to the ngAfterViewInit and ngAfterContentInit hooks in Angular 2. Since the compilation process is rather - * different in Angular 1 there is no direct mapping and care should be taken when upgrading. - */ - $postLink(): void; - } - - interface IOnChangesObject { - [property: string]: IChangesObject; - } - - interface IChangesObject { - currentValue: T; - previousValue: T; - isFirstChange(): boolean; - } - - /////////////////////////////////////////////////////////////////////////// - // Directive - // see http://docs.angularjs.org/api/ng.$compileProvider#directive - // and http://docs.angularjs.org/guide/directive - /////////////////////////////////////////////////////////////////////////// - - type IDirectiveController = IController | IController[] | {[key: string]: IController}; - - interface IDirectiveFactory { - (...args: any[]): IDirective | IDirectiveLinkFn; - } - - interface IDirectiveLinkFn { - ( - scope: TScope, - instanceElement: TElement, - instanceAttributes: TAttributes, - controller?: TController, - transclude?: ITranscludeFunction - ): void; - } - - interface IDirectivePrePost { - pre?: IDirectiveLinkFn; - post?: IDirectiveLinkFn; - } - - interface IDirectiveCompileFn { - ( - templateElement: TElement, - templateAttributes: TAttributes, - /** - * @deprecated - * Note: The transclude function that is passed to the compile function is deprecated, - * as it e.g. does not know about the right outer scope. Please use the transclude function - * that is passed to the link function instead. - */ - transclude: ITranscludeFunction - ): void | IDirectiveLinkFn | IDirectivePrePost; - } - - interface IDirective { - compile?: IDirectiveCompileFn; - controller?: string | Injectable; - controllerAs?: string; - /** - * Deprecation warning: although bindings for non-ES6 class controllers are currently bound to this before - * the controller constructor is called, this use is now deprecated. Please place initialization code that - * relies upon bindings inside a $onInit method on the controller, instead. - */ - bindToController?: boolean | {[boundProperty: string]: string}; - link?: IDirectiveLinkFn | IDirectivePrePost; - multiElement?: boolean; - priority?: number; - /** - * @deprecated - */ - replace?: boolean; - require?: string | string[] | {[controller: string]: string}; - restrict?: string; - scope?: boolean | {[boundProperty: string]: string}; - template?: string | ((tElement: TElement, tAttrs: TAttributes) => string); - templateNamespace?: string; - templateUrl?: string | ((tElement: TElement, tAttrs: TAttributes) => string); - terminal?: boolean; - transclude?: boolean | 'element' | {[slot: string]: string}; - } - - /** - * These interfaces are kept for compatibility with older versions of these type definitions. - * Actually, Angular doesn't create a special subclass of jQuery objects. It extends jQuery.prototype - * like jQuery plugins do, that's why all jQuery objects have these Angular-specific methods, not - * only those returned from angular.element. - * See: http://docs.angularjs.org/api/angular.element - */ - interface IAugmentedJQueryStatic extends JQueryStatic {} - interface IAugmentedJQuery extends JQLite {} - - /** - * Same as IController. Keeping it for compatibility with older versions of these type definitions. - */ - interface IComponentController extends IController {} - - /////////////////////////////////////////////////////////////////////////// - // AUTO module (angular.js) - /////////////////////////////////////////////////////////////////////////// - namespace auto { - /////////////////////////////////////////////////////////////////////// - // InjectorService - // see http://docs.angularjs.org/api/AUTO.$injector - /////////////////////////////////////////////////////////////////////// - interface IInjectorService { - annotate(fn: Function, strictDi?: boolean): string[]; - annotate(inlineAnnotatedFunction: any[]): string[]; - get(name: string, caller?: string): T; - get(name: '$anchorScroll'): IAnchorScrollService; - get(name: '$cacheFactory'): ICacheFactoryService; - get(name: '$compile'): ICompileService; - get(name: '$controller'): IControllerService; - get(name: '$document'): IDocumentService; - get(name: '$exceptionHandler'): IExceptionHandlerService; - get(name: '$filter'): IFilterService; - get(name: '$http'): IHttpService; - get(name: '$httpBackend'): IHttpBackendService; - get(name: '$httpParamSerializer'): IHttpParamSerializer; - get(name: '$httpParamSerializerJQLike'): IHttpParamSerializer; - get(name: '$interpolate'): IInterpolateService; - get(name: '$interval'): IIntervalService; - get(name: '$locale'): ILocaleService; - get(name: '$location'): ILocationService; - get(name: '$log'): ILogService; - get(name: '$parse'): IParseService; - get(name: '$q'): IQService; - get(name: '$rootElement'): IRootElementService; - get(name: '$rootScope'): IRootScopeService; - get(name: '$sce'): ISCEService; - get(name: '$sceDelegate'): ISCEDelegateService; - get(name: '$templateCache'): ITemplateCacheService; - get(name: '$templateRequest'): ITemplateRequestService; - get(name: '$timeout'): ITimeoutService; - get(name: '$window'): IWindowService; - get(name: '$xhrFactory'): IXhrFactory; - has(name: string): boolean; - instantiate(typeConstructor: {new(...args: any[]): T}, locals?: any): T; - invoke(func: Injectable T)>, context?: any, locals?: any): T; - /** - * Add the specified modules to the current injector. - * This method will add each of the injectables to the injector and execute all of the config and run blocks for each module passed to the method. - * @param modules A module, module name or annotated injection function. - */ - loadNewModules(modules: Array void>>): void; - /** An object map of all the modules that have been loaded into the injector. */ - modules: {[moduleName: string]: IModule}; - strictDi: boolean; - } - - /////////////////////////////////////////////////////////////////////// - // ProvideService - // see http://docs.angularjs.org/api/AUTO.$provide - /////////////////////////////////////////////////////////////////////// - interface IProvideService { - // Documentation says it returns the registered instance, but actual - // implementation does not return anything. - // constant(name: string, value: any): any; - /** - * Register a constant service, such as a string, a number, an array, an object or a function, with the $injector. Unlike value it can be injected into a module configuration function (see config) and it cannot be overridden by an Angular decorator. - * - * @param name The name of the constant. - * @param value The constant value. - */ - constant(name: string, value: any): void; - - /** - * Register a service decorator with the $injector. A service decorator intercepts the creation of a service, allowing it to override or modify the behaviour of the service. The object returned by the decorator may be the original service, or a new service object which replaces or wraps and delegates to the original service. - * - * @param name The name of the service to decorate. - * @param decorator This function will be invoked when the service needs to be instantiated and should return the decorated service instance. The function is called using the injector.invoke method and is therefore fully injectable. Local injection arguments: - * - * $delegate - The original service instance, which can be monkey patched, configured, decorated or delegated to. - */ - decorator(name: string, decorator: Function): void; - /** - * Register a service decorator with the $injector. A service decorator intercepts the creation of a service, allowing it to override or modify the behaviour of the service. The object returned by the decorator may be the original service, or a new service object which replaces or wraps and delegates to the original service. - * - * @param name The name of the service to decorate. - * @param inlineAnnotatedFunction This function will be invoked when the service needs to be instantiated and should return the decorated service instance. The function is called using the injector.invoke method and is therefore fully injectable. Local injection arguments: - * - * $delegate - The original service instance, which can be monkey patched, configured, decorated or delegated to. - */ - decorator(name: string, inlineAnnotatedFunction: any[]): void; - factory(name: string, serviceFactoryFunction: Function): IServiceProvider; - factory(name: string, inlineAnnotatedFunction: any[]): IServiceProvider; - provider(name: string, provider: IServiceProvider): IServiceProvider; - provider(name: string, serviceProviderConstructor: Function): IServiceProvider; - service(name: string, constructor: Function): IServiceProvider; - service(name: string, inlineAnnotatedFunction: any[]): IServiceProvider; - value(name: string, value: any): IServiceProvider; - } - } - - /** - * $http params serializer that converts objects to strings - * see https://docs.angularjs.org/api/ng/service/$httpParamSerializer - */ - interface IHttpParamSerializer { - (obj: Object): string; - } - - interface IFilterFunction extends Function { - /** - * By default, filters are only run once the input value changes. By marking the filter as `$stateful`, the filter will be run on every `$digest` to update the output. **This is strongly discouraged.** - * See https://docs.angularjs.org/guide/filter#stateful-filters - */ - $stateful?: boolean; - } - type FilterFactory = (...I: any[]) => IFilterFunction; -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/@types/angular/jqlite.d.ts b/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/@types/angular/jqlite.d.ts deleted file mode 100755 index ac4f8ec10..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/@types/angular/jqlite.d.ts +++ /dev/null @@ -1,829 +0,0 @@ -// Project: http://jquery.com/ -// Definitions by: Boris Yankov -// Christian Hoffmeister -// Steve Fenton -// Diullei Gomes -// Tass Iliopoulos -// Jason Swearingen -// Sean Hill -// Guus Goossens -// Kelly Summerlin -// Basarat Ali Syed -// Nicholas Wolverson -// Derek Cicerone -// Andrew Gaspar -// Seikichi Kondo -// Benjamin Jackman -// Poul Sorensen -// Josh Strobl -// John Reilly -// Dick van den Brink -// Thomas Schulz -// Leonard Thieu -// Andre Wiggins -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -// Definitions copied from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/0480c5ec87fab41aa23047a02b27f0ea71aaf975/types/jquery/v2/index.d.ts - -interface JQLite extends JQuery { - [index: number]: HTMLElement; -} - -interface JQuery { - /** - * Adds the specified class(es) to each of the set of matched elements. - * - * @param className One or more space-separated classes to be added to the class attribute of each matched element. - * @see {@link https://api.jquery.com/addClass/#addClass-className} - */ - addClass(className: string): this; - - /** - * Insert content, specified by the parameter, after each element in the set of matched elements. - * - * @param content1 HTML string, DOM element, DocumentFragment, array of elements, or jQuery object to insert after each element in the set of matched elements. - * @param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert after each element in the set of matched elements. - * @see {@link https://api.jquery.com/after/#after-content-content} - */ - after(content1: JQuery | any[] | Element | DocumentFragment | Text | string, ...content2: any[]): this; - /** - * Insert content, specified by the parameter, after each element in the set of matched elements. - * - * @param func A function that returns an HTML string, DOM element(s), or jQuery object to insert after each element in the set of matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set. - * @see {@link https://api.jquery.com/after/#after-function} - */ - after(func: (index: number, html: string) => string | Element | JQuery): this; - - /** - * Insert content, specified by the parameter, to the end of each element in the set of matched elements. - * - * @param content1 DOM element, DocumentFragment, array of elements, HTML string, or jQuery object to insert at the end of each element in the set of matched elements. - * @param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert at the end of each element in the set of matched elements. - * @see {@link https://api.jquery.com/append/#append-content-content} - */ - append(content1: JQuery | any[] | Element | DocumentFragment | Text | string, ...content2: any[]): this; - /** - * Insert content, specified by the parameter, to the end of each element in the set of matched elements. - * - * @param func A function that returns an HTML string, DOM element(s), or jQuery object to insert at the end of each element in the set of matched elements. Receives the index position of the element in the set and the old HTML value of the element as arguments. Within the function, this refers to the current element in the set. - * @see {@link https://api.jquery.com/append/#append-function} - */ - append(func: (index: number, html: string) => string | Element | JQuery): this; - - /** - * Get the value of an attribute for the first element in the set of matched elements. - * - * @param attributeName The name of the attribute to get. - * @see {@link https://api.jquery.com/attr/#attr-attributeName} - */ - attr(attributeName: string): string; - /** - * Set one or more attributes for the set of matched elements. - * - * @param attributeName The name of the attribute to set. - * @param value A value to set for the attribute. If this is `null`, the attribute will be deleted. - * @see {@link https://api.jquery.com/attr/#attr-attributeName-value} - */ - attr(attributeName: string, value: string | number | null): this; - /** - * Set one or more attributes for the set of matched elements. - * - * @param attributes An object of attribute-value pairs to set. - * @see {@link https://api.jquery.com/attr/#attr-attributes} - */ - attr(attributes: Object): this; - - /** - * Attach a handler to an event for the elements. - * - * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. - * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/bind/#bind-eventType-eventData-handler} - */ - bind(eventType: string, handler: (eventObject: JQueryEventObject) => any): this; - /** - * Attach a handler to an event for the elements. - * - * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. - * @param preventBubble Setting the third argument to false will attach a function that prevents the default action from occurring and stops the event from bubbling. The default is true. - * @see {@link https://api.jquery.com/bind/#bind-eventType-eventData-preventBubble} - */ - bind(eventType: string, preventBubble: boolean): this; - /** - * Attach a handler to an event for the elements. - * - * @param events An object containing one or more DOM event types and functions to execute for them. - * @see {@link https://api.jquery.com/bind/#bind-events} - */ - bind(events: any): this; - - /** - * Get the children of each element in the set of matched elements, optionally filtered by a selector. - * - * @see {@link https://api.jquery.com/children/} - */ - children(): this; - - /** - * Create a deep copy of the set of matched elements. - * - * @param withDataAndEvents A Boolean indicating whether event handlers and data should be copied along with the elements. The default value is false. - * @param deepWithDataAndEvents A Boolean indicating whether event handlers and data for all children of the cloned element should be copied. By default its value matches the first argument's value (which defaults to false). - * @see {@link https://api.jquery.com/clone/} - */ - clone(withDataAndEvents?: boolean, deepWithDataAndEvents?: boolean): this; - - /** - * Get the children of each element in the set of matched elements, including text and comment nodes. - * @see {@link https://api.jquery.com/contents/} - */ - contents(): this; - - /** - * Get the value of style properties for the first element in the set of matched elements. - * - * @param propertyName A CSS property. - * @see {@link https://api.jquery.com/css/#css-propertyName} - */ - css(propertyName: string): string; - /** - * Get the value of style properties for the first element in the set of matched elements. - * Results in an object of property-value pairs. - * - * @param propertyNames An array of one or more CSS properties. - * @see {@link https://api.jquery.com/css/#css-propertyNames} - */ - css(propertyNames: string[]): any; - /** - * Set one or more CSS properties for the set of matched elements. - * - * @param propertyName A CSS property name. - * @param value A value to set for the property. - * @see {@link https://api.jquery.com/css/#css-propertyName-value} - */ - css(propertyName: string, value: string | number): this; - /** - * Set one or more CSS properties for the set of matched elements. - * - * @param propertyName A CSS property name. - * @param value A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old value as arguments. - * @see {@link https://api.jquery.com/css/#css-propertyName-function} - */ - css(propertyName: string, value: (index: number, value: string) => string | number): this; - /** - * Set one or more CSS properties for the set of matched elements. - * - * @param properties An object of property-value pairs to set. - * @see {@link https://api.jquery.com/css/#css-properties} - */ - css(properties: JQLiteCssProperties): this; - - /** - * Store arbitrary data associated with the matched elements. - * - * @param key A string naming the piece of data to set. - * @param value The new data value; it can be any JavaScript type including Array or Object. - * @see {@link https://api.jquery.com/data/#data-key-value} - */ - data(key: string, value: any): this; - /** - * Return the value at the named data store for the first element in the jQuery collection, as set by data(name, value) or by an HTML5 data-* attribute. - * - * @param key Name of the data stored. - * @see {@link https://api.jquery.com/data/#data-key} - */ - data(key: string): any; - /** - * Store arbitrary data associated with the matched elements. - * - * @param obj An object of key-value pairs of data to update. - * @see {@link https://api.jquery.com/data/#data-obj} - */ - data(obj: { [key: string]: any; }): this; - /** - * Return the value at the named data store for the first element in the jQuery collection, as set by data(name, value) or by an HTML5 data-* attribute. - * @see {@link https://api.jquery.com/data/#data} - */ - data(): any; - - /** - * Remove the set of matched elements from the DOM. - * - * @param selector A selector expression that filters the set of matched elements to be removed. - * @see {@link https://api.jquery.com/detach/} - */ - detach(selector?: string): this; - - /** - * Remove all child nodes of the set of matched elements from the DOM. - * @see {@link https://api.jquery.com/empty/} - */ - empty(): this; - - /** - * Reduce the set of matched elements to the one at the specified index. - * - * @param index An integer indicating the 0-based position of the element. OR An integer indicating the position of the element, counting backwards from the last element in the set. - * @see {@link https://api.jquery.com/eq/} - */ - eq(index: number): this; - - /** - * Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element. - * - * @param selector A string containing a selector expression to match elements against. - * @see {@link https://api.jquery.com/find/#find-selector} - */ - find(selector: string): this; - find(element: any): this; - find(obj: JQuery): this; - - /** - * Determine whether any of the matched elements are assigned the given class. - * - * @param className The class name to search for. - * @see {@link https://api.jquery.com/hasClass/} - */ - hasClass(className: string): boolean; - - /** - * Get the HTML contents of the first element in the set of matched elements. - * @see {@link https://api.jquery.com/html/#html} - */ - html(): string; - /** - * Set the HTML contents of each element in the set of matched elements. - * - * @param htmlString A string of HTML to set as the content of each matched element. - * @see {@link https://api.jquery.com/html/#html-htmlString} - */ - html(htmlString: string): this; - /** - * Set the HTML contents of each element in the set of matched elements. - * - * @param func A function returning the HTML content to set. Receives the index position of the element in the set and the old HTML value as arguments. jQuery empties the element before calling the function; use the oldhtml argument to reference the previous content. Within the function, this refers to the current element in the set. - * @see {@link https://api.jquery.com/html/#html-function} - */ - html(func: (index: number, oldhtml: string) => string): this; - - /** - * Get the immediately following sibling of each element in the set of matched elements. If a selector is provided, it retrieves the next sibling only if it matches that selector. - * - * @see {@link https://api.jquery.com/next/} - */ - next(): this; - - /** - * Attach an event handler function for one or more events to the selected elements. - * - * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". - * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. Rest parameter args is for optional parameters passed to jQuery.trigger(). Note that the actual parameters on the event handler function must be marked as optional (? syntax). - * @see {@link https://api.jquery.com/on/#on-events-selector-data-handler} - */ - on(events: string, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): this; - /** - * Attach an event handler function for one or more events to the selected elements. - * - * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". - * @param data Data to be passed to the handler in event.data when an event is triggered. - * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. - * @see {@link https://api.jquery.com/on/#on-events-selector-data-handler} - */ - on(events: string, data: any, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): this; - /** - * Attach an event handler function for one or more events to the selected elements. - * - * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". - * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. - * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. - * @see {@link https://api.jquery.com/on/#on-events-selector-data-handler} - */ - on(events: string, selector: string, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): this; - /** - * Attach an event handler function for one or more events to the selected elements. - * - * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". - * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. - * @param data Data to be passed to the handler in event.data when an event is triggered. - * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. - * @see {@link https://api.jquery.com/on/#on-events-selector-data-handler} - */ - on(events: string, selector: string, data: any, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): this; - /** - * Attach an event handler function for one or more events to the selected elements. - * - * @param events An object in which the string keys represent one or more space-separated event types and optional namespaces, and the values represent a handler function to be called for the event(s). - * @param selector A selector string to filter the descendants of the selected elements that will call the handler. If the selector is null or omitted, the handler is always called when it reaches the selected element. - * @param data Data to be passed to the handler in event.data when an event occurs. - * @see {@link https://api.jquery.com/on/#on-events-selector-data} - */ - on(events: { [key: string]: (eventObject: JQueryEventObject, ...args: any[]) => any; }, selector?: string, data?: any): this; - /** - * Attach an event handler function for one or more events to the selected elements. - * - * @param events An object in which the string keys represent one or more space-separated event types and optional namespaces, and the values represent a handler function to be called for the event(s). - * @param data Data to be passed to the handler in event.data when an event occurs. - * @see {@link https://api.jquery.com/on/#on-events-selector-data} - */ - on(events: { [key: string]: (eventObject: JQueryEventObject, ...args: any[]) => any; }, data?: any): this; - - /** - * Remove an event handler. - * @see {@link https://api.jquery.com/off/#off} - */ - off(): this; - /** - * Remove an event handler. - * - * @param events One or more space-separated event types and optional namespaces, or just namespaces, such as "click", "keydown.myPlugin", or ".myPlugin". - * @param selector A selector which should match the one originally passed to .on() when attaching event handlers. - * @param handler A handler function previously attached for the event(s), or the special value false. - * @see {@link https://api.jquery.com/off/#off-events-selector-handler} - */ - off(events: string, selector?: string, handler?: (eventObject: JQueryEventObject) => any): this; - /** - * Remove an event handler. - * - * @param events One or more space-separated event types and optional namespaces, or just namespaces, such as "click", "keydown.myPlugin", or ".myPlugin". - * @param handler A handler function previously attached for the event(s), or the special value false. Takes handler with extra args that can be attached with on(). - * @see {@link https://api.jquery.com/off/#off-events-selector-handler} - */ - off(events: string, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): this; - /** - * Remove an event handler. - * - * @param events One or more space-separated event types and optional namespaces, or just namespaces, such as "click", "keydown.myPlugin", or ".myPlugin". - * @param handler A handler function previously attached for the event(s), or the special value false. - * @see {@link https://api.jquery.com/off/#off-events-selector-handler} - */ - off(events: string, handler: (eventObject: JQueryEventObject) => any): this; - /** - * Remove an event handler. - * - * @param events An object where the string keys represent one or more space-separated event types and optional namespaces, and the values represent handler functions previously attached for the event(s). - * @param selector A selector which should match the one originally passed to .on() when attaching event handlers. - * @see {@link https://api.jquery.com/off/#off-events-selector} - */ - off(events: { [key: string]: any; }, selector?: string): this; - - /** - * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. - * - * @param events A string containing one or more JavaScript event types, such as "click" or "submit," or custom event names. - * @param handler A function to execute at the time the event is triggered. - * @see {@link https://api.jquery.com/one/#one-events-data-handler} - */ - one(events: string, handler: (eventObject: JQueryEventObject) => any): this; - /** - * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. - * - * @param events A string containing one or more JavaScript event types, such as "click" or "submit," or custom event names. - * @param data An object containing data that will be passed to the event handler. - * @param handler A function to execute at the time the event is triggered. - * @see {@link https://api.jquery.com/one/#one-events-data-handler} - */ - one(events: string, data: Object, handler: (eventObject: JQueryEventObject) => any): this; - /** - * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. - * - * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". - * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. - * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. - * @see {@link https://api.jquery.com/one/#one-events-selector-data-handler} - */ - one(events: string, selector: string, handler: (eventObject: JQueryEventObject) => any): this; - /** - * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. - * - * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". - * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. - * @param data Data to be passed to the handler in event.data when an event is triggered. - * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. - * @see {@link https://api.jquery.com/one/#one-events-selector-data-handler} - */ - one(events: string, selector: string, data: any, handler: (eventObject: JQueryEventObject) => any): this; - /** - * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. - * - * @param events An object in which the string keys represent one or more space-separated event types and optional namespaces, and the values represent a handler function to be called for the event(s). - * @param selector A selector string to filter the descendants of the selected elements that will call the handler. If the selector is null or omitted, the handler is always called when it reaches the selected element. - * @param data Data to be passed to the handler in event.data when an event occurs. - * @see {@link https://api.jquery.com/one/#one-events-selector-data} - */ - one(events: { [key: string]: any; }, selector?: string, data?: any): this; - /** - * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. - * - * @param events An object in which the string keys represent one or more space-separated event types and optional namespaces, and the values represent a handler function to be called for the event(s). - * @param data Data to be passed to the handler in event.data when an event occurs. - * @see {@link https://api.jquery.com/one/#one-events-selector-data} - */ - one(events: { [key: string]: any; }, data?: any): this; - - /** - * Get the parent of each element in the current set of matched elements, optionally filtered by a selector. - * - * @see {@link https://api.jquery.com/parent/} - */ - parent(): this; - - /** - * Insert content, specified by the parameter, to the beginning of each element in the set of matched elements. - * - * @param content1 DOM element, DocumentFragment, array of elements, HTML string, or jQuery object to insert at the beginning of each element in the set of matched elements. - * @param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert at the beginning of each element in the set of matched elements. - * @see {@link https://api.jquery.com/prepend/#prepend-content-content} - */ - prepend(content1: JQuery | any[] | Element | DocumentFragment | Text | string, ...content2: any[]): this; - /** - * Insert content, specified by the parameter, to the beginning of each element in the set of matched elements. - * - * @param func A function that returns an HTML string, DOM element(s), or jQuery object to insert at the beginning of each element in the set of matched elements. Receives the index position of the element in the set and the old HTML value of the element as arguments. Within the function, this refers to the current element in the set. - * @see {@link https://api.jquery.com/prepend/#prepend-function} - */ - prepend(func: (index: number, html: string) => string | Element | JQuery): this; - - /** - * Get the value of a property for the first element in the set of matched elements. - * - * @param propertyName The name of the property to get. - * @see {@link https://api.jquery.com/prop/#prop-propertyName} - */ - prop(propertyName: string): any; - /** - * Set one or more properties for the set of matched elements. - * - * @param propertyName The name of the property to set. - * @param value A value to set for the property. - * @see {@link https://api.jquery.com/prop/#prop-propertyName-value} - */ - prop(propertyName: string, value: string | number | boolean): this; - /** - * Set one or more properties for the set of matched elements. - * - * @param properties An object of property-value pairs to set. - * @see {@link https://api.jquery.com/prop/#prop-properties} - */ - prop(properties: Object): this; - /** - * Set one or more properties for the set of matched elements. - * - * @param propertyName The name of the property to set. - * @param func A function returning the value to set. Receives the index position of the element in the set and the old property value as arguments. Within the function, the keyword this refers to the current element. - * @see {@link https://api.jquery.com/prop/#prop-propertyName-function} - */ - prop(propertyName: string, func: (index: number, oldPropertyValue: any) => any): this; - - /** - * Specify a function to execute when the DOM is fully loaded. - * - * @param handler A function to execute after the DOM is ready. - * @see {@link https://api.jquery.com/ready/} - */ - ready(handler: (jQueryAlias?: JQueryStatic) => any): this; - - /** - * Remove the set of matched elements from the DOM. - * - * @param selector A selector expression that filters the set of matched elements to be removed. - * @see {@link https://api.jquery.com/remove/} - */ - remove(selector?: string): this; - - /** - * Remove an attribute from each element in the set of matched elements. - * - * @param attributeName An attribute to remove; as of version 1.7, it can be a space-separated list of attributes. - * @see {@link https://api.jquery.com/removeAttr/} - */ - removeAttr(attributeName: string): this; - - /** - * Remove a single class, multiple classes, or all classes from each element in the set of matched elements. - * - * @param className One or more space-separated classes to be removed from the class attribute of each matched element. - * @see {@link https://api.jquery.com/removeClass/#removeClass-className} - */ - removeClass(className?: string): this; - - /** - * Remove a previously-stored piece of data. - * - * @param name A string naming the piece of data to delete or space-separated string naming the pieces of data to delete. - * @see {@link https://api.jquery.com/removeData/#removeData-name} - */ - removeData(name: string): this; - /** - * Remove a previously-stored piece of data. - * - * @param list An array of strings naming the pieces of data to delete. - * @see {@link https://api.jquery.com/removeData/#removeData-list} - */ - removeData(list: string[]): this; - /** - * Remove all previously-stored piece of data. - * @see {@link https://api.jquery.com/removeData/} - */ - removeData(): this; - - /** - * Replace each element in the set of matched elements with the provided new content and return the set of elements that was removed. - * - * @param newContent The content to insert. May be an HTML string, DOM element, array of DOM elements, or jQuery object. - * @see {@link https://api.jquery.com/replaceWith/#replaceWith-newContent} - */ - replaceWith(newContent: JQuery | any[] | Element | Text | string): this; - /** - * Replace each element in the set of matched elements with the provided new content and return the set of elements that was removed. - * - * @param func A function that returns content with which to replace the set of matched elements. - * @see {@link https://api.jquery.com/replaceWith/#replaceWith-function} - */ - replaceWith(func: () => Element | JQuery): this; - - /** - * Get the combined text contents of each element in the set of matched elements, including their descendants. - * @see {@link https://api.jquery.com/text/#text} - */ - text(): string; - /** - * Set the content of each element in the set of matched elements to the specified text. - * - * @param text The text to set as the content of each matched element. When Number or Boolean is supplied, it will be converted to a String representation. - * @see {@link https://api.jquery.com/text/#text-text} - */ - text(text: string | number | boolean): this; - /** - * Set the content of each element in the set of matched elements to the specified text. - * - * @param func A function returning the text content to set. Receives the index position of the element in the set and the old text value as arguments. - * @see {@link https://api.jquery.com/text/#text-function} - */ - text(func: (index: number, text: string) => string): this; - - /** - * Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument. - * - * @param className One or more class names (separated by spaces) to be toggled for each element in the matched set. - * @param swtch A Boolean (not just truthy/falsy) value to determine whether the class should be added or removed. - * @see {@link https://api.jquery.com/toggleClass/#toggleClass-className} - */ - toggleClass(className: string, swtch?: boolean): this; - /** - * Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument. - * - * @param swtch A boolean value to determine whether the class should be added or removed. - * @see {@link https://api.jquery.com/toggleClass/#toggleClass-state} - */ - toggleClass(swtch?: boolean): this; - - /** - * Execute all handlers attached to an element for an event. - * - * @param eventType A string containing a JavaScript event type, such as click or submit. - * @param extraParameters An array of additional parameters to pass along to the event handler. - * @see {@link https://api.jquery.com/triggerHandler/#triggerHandler-eventType-extraParameters} - */ - triggerHandler(eventType: string, ...extraParameters: any[]): Object; - /** - * Execute all handlers attached to an element for an event. - * - * @param event A jQuery.Event object. - * @param extraParameters An array of additional parameters to pass along to the event handler. - * @see {@link https://api.jquery.com/triggerHandler/#triggerHandler-event-extraParameters} - */ - triggerHandler(event: JQueryEventObject, ...extraParameters: any[]): Object; - - /** - * Remove a previously-attached event handler from the elements. - * - * @param eventType A string containing a JavaScript event type, such as click or submit. - * @param handler The function that is to be no longer executed. - * @see {@link https://api.jquery.com/unbind/#unbind-eventType-handler} - */ - unbind(eventType?: string, handler?: (eventObject: JQueryEventObject) => any): this; - /** - * Remove a previously-attached event handler from the elements. - * - * @param eventType A string containing a JavaScript event type, such as click or submit. - * @param fls Unbinds the corresponding 'return false' function that was bound using .bind( eventType, false ). - * @see {@link https://api.jquery.com/unbind/#unbind-eventType-false} - */ - unbind(eventType: string, fls: boolean): this; - /** - * Remove a previously-attached event handler from the elements. - * - * @param evt A JavaScript event object as passed to an event handler. - * @see {@link https://api.jquery.com/unbind/#unbind-event} - */ - unbind(evt: any): this; - - /** - * Get the current value of the first element in the set of matched elements. - * @see {@link https://api.jquery.com/val/#val} - */ - val(): any; - /** - * Set the value of each element in the set of matched elements. - * - * @param value A string of text, an array of strings or number corresponding to the value of each matched element to set as selected/checked. - * @see {@link https://api.jquery.com/val/#val-value} - */ - val(value: string | string[] | number): this; - /** - * Set the value of each element in the set of matched elements. - * - * @param func A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old value as arguments. - * @see {@link https://api.jquery.com/val/#val-function} - */ - val(func: (index: number, value: string) => string): this; - - /** - * Wrap an HTML structure around each element in the set of matched elements. - * - * @param wrappingElement A selector, element, HTML string, or jQuery object specifying the structure to wrap around the matched elements. - * @see {@link https://api.jquery.com/wrap/#wrap-wrappingElement} - */ - wrap(wrappingElement: JQuery | Element | string): this; - /** - * Wrap an HTML structure around each element in the set of matched elements. - * - * @param func A callback function returning the HTML content or jQuery object to wrap around the matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set. - * @see {@link https://api.jquery.com/wrap/#wrap-function} - */ - wrap(func: (index: number) => string | JQuery): this; - - // Undocumented - length: number; - - // TODO: events, how to define? - // $destroy - - controller(name?: string): any; - injector(): ng.auto.IInjectorService; - /** - * Returns the `$scope` of the element. - * - * **IMPORTANT**: Requires `debugInfoEnabled` to be true. - * - * See https://docs.angularjs.org/guide/production#disabling-debug-data for more information. - */ - scope(): T; - /** - * Returns the `$scope` of the element. - * - * **IMPORTANT**: Requires `debugInfoEnabled` to be true. - * - * See https://docs.angularjs.org/guide/production#disabling-debug-data for more information. - */ - isolateScope(): T; - - inheritedData(key: string, value: any): this; - inheritedData(obj: { [key: string]: any; }): this; - inheritedData(key?: string): any; -} - -interface JQueryStatic { - (element: string | Element | Document | JQuery | ArrayLike | (() => void)): JQLite; -} - -/** - * Interface of the JQuery extension of the W3C event object - * @see {@link https://api.jquery.com/category/events/event-object/} - */ -interface BaseJQueryEventObject extends Event { - /** - * The current DOM element within the event bubbling phase. - * @see {@link https://api.jquery.com/event.currentTarget/} - */ - currentTarget: Element; - /** - * An optional object of data passed to an event method when the current executing handler is bound. - * @see {@link https://api.jquery.com/event.data/} - */ - data: any; - /** - * The element where the currently-called jQuery event handler was attached. - * @see {@link https://api.jquery.com/event.delegateTarget/} - */ - delegateTarget: Element; - /** - * Returns whether event.preventDefault() was ever called on this event object. - * @see {@link https://api.jquery.com/event.isDefaultPrevented/} - */ - isDefaultPrevented(): boolean; - /** - * Returns whether event.stopImmediatePropagation() was ever called on this event object. - * @see {@link https://api.jquery.com/event.isImmediatePropagationStopped/} - */ - isImmediatePropagationStopped(): boolean; - /** - * Returns whether event.stopPropagation() was ever called on this event object. - * @see {@link https://api.jquery.com/event.isPropagationStopped/} - */ - isPropagationStopped(): boolean; - /** - * The namespace specified when the event was triggered. - * @see {@link https://api.jquery.com/event.namespace/} - */ - namespace: string; - /** - * The browser's original Event object. - * @see {@link https://api.jquery.com/category/events/event-object/} - */ - originalEvent: Event; - /** - * If this method is called, the default action of the event will not be triggered. - * @see {@link https://api.jquery.com/event.preventDefault/} - */ - preventDefault(): any; - /** - * The other DOM element involved in the event, if any. - * @see {@link https://api.jquery.com/event.relatedTarget/} - */ - relatedTarget: Element; - /** - * The last value returned by an event handler that was triggered by this event, unless the value was undefined. - * @see {@link https://api.jquery.com/event.result/} - */ - result: any; - /** - * Keeps the rest of the handlers from being executed and prevents the event from bubbling up the DOM tree. - * @see {@link https://api.jquery.com/event.stopImmediatePropagation/} - */ - stopImmediatePropagation(): void; - /** - * Prevents the event from bubbling up the DOM tree, preventing any parent handlers from being notified of the event. - * @see {@link https://api.jquery.com/event.stopPropagation/} - */ - stopPropagation(): void; - /** - * The DOM element that initiated the event. - * @see {@link https://api.jquery.com/event.target/} - */ - target: Element; - /** - * The mouse position relative to the left edge of the document. - * @see {@link https://api.jquery.com/event.pageX/} - */ - pageX: number; - /** - * The mouse position relative to the top edge of the document. - * @see {@link https://api.jquery.com/event.pageY/} - */ - pageY: number; - /** - * For key or mouse events, this property indicates the specific key or button that was pressed. - * @deprecated Use `key` for KeyEvents or `button` for MouseEvents instead. - * @see {@link https://api.jquery.com/event.which/} - */ - which: number; - /** - * Indicates whether the META key was pressed when the event fired. - * @see {@link https://api.jquery.com/event.metaKey/} - */ - metaKey: boolean; -} - -interface JQueryInputEventObject extends BaseJQueryEventObject { - altKey: boolean; - ctrlKey: boolean; - metaKey: boolean; - shiftKey: boolean; -} - -interface JQueryMouseEventObject extends JQueryInputEventObject { - button: number; - clientX: number; - clientY: number; - offsetX: number; - offsetY: number; - pageX: number; - pageY: number; - screenX: number; - screenY: number; -} - -interface JQueryKeyEventObject extends JQueryInputEventObject { - /** @deprecated */ - char: string; - /** @deprecated */ - charCode: number; - key: string; - /** @deprecated */ - keyCode: number; -} - -interface JQueryEventObject extends BaseJQueryEventObject, JQueryInputEventObject, JQueryMouseEventObject, JQueryKeyEventObject { -} - -/** - * The interface used to specify the properties parameter in css() - */ -// tslint:disable-next-line:class-name -interface cssPropertySetter { - (index: number, value?: string): string | number; -} -interface JQLiteCssProperties { - [propertyName: string]: string | number | cssPropertySetter; -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/@types/angular/package.json b/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/@types/angular/package.json deleted file mode 100755 index 59796e6a3..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/@types/angular/package.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "_args": [ - [ - "@types/angular@1.6.54", - "/shd/CTC/TOOLS/TDS/TDS-source/Lts/Tools/ArAssetsV2" - ] - ], - "_development": true, - "_from": "@types/angular@1.6.54", - "_id": "@types/angular@1.6.54", - "_inBundle": false, - "_integrity": "sha512-xA1FuozWXeRQ7FClUbvk8ePL+dydBeDoCWRPFTHU5+8uvVtIIfLGiHA8CMkwsbddFCYnTDVbLxG85a/HBx7LtA==", - "_location": "/@types/angular", - "_phantomChildren": {}, - "_requested": { - "type": "version", - "registry": true, - "raw": "@types/angular@1.6.54", - "name": "@types/angular", - "escapedName": "@types%2fangular", - "scope": "@types", - "rawSpec": "1.6.54", - "saveSpec": null, - "fetchSpec": "1.6.54" - }, - "_requiredBy": [ - "#DEV:/" - ], - "_resolved": "https://registry.npmjs.org/@types/angular/-/angular-1.6.54.tgz", - "_spec": "1.6.54", - "_where": "/shd/CTC/TOOLS/TDS/TDS-source/Lts/Tools/ArAssetsV2", - "bugs": { - "url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues" - }, - "contributors": [ - { - "name": "Diego Vilar", - "url": "https://github.com/diegovilar" - }, - { - "name": "Georgii Dolzhykov", - "url": "https://github.com/thorn0" - }, - { - "name": "Caleb St-Denis", - "url": "https://github.com/calebstdenis" - }, - { - "name": "Leonard Thieu", - "url": "https://github.com/leonard-thieu" - }, - { - "name": "Steffen Kowalski", - "url": "https://github.com/scipper" - } - ], - "dependencies": {}, - "description": "TypeScript definitions for Angular JS", - "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped#readme", - "license": "MIT", - "main": "", - "name": "@types/angular", - "repository": { - "type": "git", - "url": "git+https://github.com/DefinitelyTyped/DefinitelyTyped.git" - }, - "scripts": {}, - "typeScriptVersion": "2.3", - "types": "index", - "typesPublisherContentHash": "0d6dd74d56b56b6a5d13d2e6c34e2ffd8a406fbe13fa7f38a2b85ccb1a82fdad", - "version": "1.6.54" -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/@types/geojson/LICENSE b/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/@types/geojson/LICENSE deleted file mode 100755 index 21071075c..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/@types/geojson/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ - MIT License - - Copyright (c) Microsoft Corporation. All rights reserved. - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/@types/geojson/README.md b/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/@types/geojson/README.md deleted file mode 100755 index 9b6772c0a..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/@types/geojson/README.md +++ /dev/null @@ -1,16 +0,0 @@ -# Installation -> `npm install --save @types/geojson` - -# Summary -This package contains type definitions for geojson ( https://geojson.org/ ). - -# Details -Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/geojson - -Additional Details - * Last updated: Wed, 13 Feb 2019 18:42:09 GMT - * Dependencies: none - * Global values: GeoJSON - -# Credits -These definitions were written by Jacob Bruun , Arne Schubert , Jeff Jacobson , Ilia Choly , Dan Vanderkam . diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/@types/geojson/index.d.ts b/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/@types/geojson/index.d.ts deleted file mode 100755 index 90beca01c..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/@types/geojson/index.d.ts +++ /dev/null @@ -1,175 +0,0 @@ -// Type definitions for geojson 7946.0 -// Project: https://geojson.org/, https://github.com/caseycesari/geojson.js -// Definitions by: Jacob Bruun -// Arne Schubert -// Jeff Jacobson -// Ilia Choly -// Dan Vanderkam -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -// Note: as of the RFC 7946 version of GeoJSON, Coordinate Reference Systems -// are no longer supported. (See https://tools.ietf.org/html/rfc7946#appendix-B)} - -export as namespace GeoJSON; - -/** - * The valid values for the "type" property of GeoJSON geometry objects. - * https://tools.ietf.org/html/rfc7946#section-1.4 - */ -export type GeoJsonGeometryTypes = Geometry['type']; - -/** - * The value values for the "type" property of GeoJSON Objects. - * https://tools.ietf.org/html/rfc7946#section-1.4 - */ -export type GeoJsonTypes = GeoJSON['type']; - -/** - * Bounding box - * https://tools.ietf.org/html/rfc7946#section-5 - */ -export type BBox = [number, number, number, number] | [number, number, number, number, number, number]; - -/** - * A Position is an array of coordinates. - * https://tools.ietf.org/html/rfc7946#section-3.1.1 - * Array should contain between two and three elements. - * The previous GeoJSON specification allowed more elements (e.g., which could be used to represent M values), - * but the current specification only allows X, Y, and (optionally) Z to be defined. - */ -export type Position = number[]; // [number, number] | [number, number, number]; - -/** - * The base GeoJSON object. - * https://tools.ietf.org/html/rfc7946#section-3 - * The GeoJSON specification also allows foreign members - * (https://tools.ietf.org/html/rfc7946#section-6.1) - * Developers should use "&" type in TypeScript or extend the interface - * to add these foreign members. - */ -export interface GeoJsonObject { - // Don't include foreign members directly into this type def. - // in order to preserve type safety. - // [key: string]: any; - /** - * Specifies the type of GeoJSON object. - */ - type: GeoJsonTypes; - /** - * Bounding box of the coordinate range of the object's Geometries, Features, or Feature Collections. - * The value of the bbox member is an array of length 2*n where n is the number of dimensions - * represented in the contained geometries, with all axes of the most southwesterly point - * followed by all axes of the more northeasterly point. - * The axes order of a bbox follows the axes order of geometries. - * https://tools.ietf.org/html/rfc7946#section-5 - */ - bbox?: BBox; -} - -/** - * Union of GeoJSON objects. - */ -export type GeoJSON = Geometry | Feature | FeatureCollection; - -/** - * Geometry object. - * https://tools.ietf.org/html/rfc7946#section-3 - */ -export type Geometry = Point | MultiPoint | LineString | MultiLineString | Polygon | MultiPolygon | GeometryCollection; -export type GeometryObject = Geometry; - -/** - * Point geometry object. - * https://tools.ietf.org/html/rfc7946#section-3.1.2 - */ -export interface Point extends GeoJsonObject { - type: "Point"; - coordinates: Position; -} - -/** - * MultiPoint geometry object. - * https://tools.ietf.org/html/rfc7946#section-3.1.3 - */ -export interface MultiPoint extends GeoJsonObject { - type: "MultiPoint"; - coordinates: Position[]; -} - -/** - * LineString geometry object. - * https://tools.ietf.org/html/rfc7946#section-3.1.4 - */ -export interface LineString extends GeoJsonObject { - type: "LineString"; - coordinates: Position[]; -} - -/** - * MultiLineString geometry object. - * https://tools.ietf.org/html/rfc7946#section-3.1.5 - */ -export interface MultiLineString extends GeoJsonObject { - type: "MultiLineString"; - coordinates: Position[][]; -} - -/** - * Polygon geometry object. - * https://tools.ietf.org/html/rfc7946#section-3.1.6 - */ -export interface Polygon extends GeoJsonObject { - type: "Polygon"; - coordinates: Position[][]; -} - -/** - * MultiPolygon geometry object. - * https://tools.ietf.org/html/rfc7946#section-3.1.7 - */ -export interface MultiPolygon extends GeoJsonObject { - type: "MultiPolygon"; - coordinates: Position[][][]; -} - -/** - * Geometry Collection - * https://tools.ietf.org/html/rfc7946#section-3.1.8 - */ -export interface GeometryCollection extends GeoJsonObject { - type: "GeometryCollection"; - geometries: Geometry[]; -} - -export type GeoJsonProperties = { [name: string]: any; } | null; - -/** - * A feature object which contains a geometry and associated properties. - * https://tools.ietf.org/html/rfc7946#section-3.2 - */ -export interface Feature extends GeoJsonObject { - type: "Feature"; - /** - * The feature's geometry - */ - geometry: G; - /** - * A value that uniquely identifies this feature in a - * https://tools.ietf.org/html/rfc7946#section-3.2. - */ - id?: string | number; - /** - * Properties associated with this feature. - */ - properties: P; -} - -/** - * A collection of feature objects. - * https://tools.ietf.org/html/rfc7946#section-3.3 - */ -export interface FeatureCollection extends GeoJsonObject { - type: "FeatureCollection"; - features: Array>; -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/@types/geojson/package.json b/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/@types/geojson/package.json deleted file mode 100755 index 303226733..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/@types/geojson/package.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "_args": [ - [ - "@types/geojson@7946.0.6", - "/shd/CTC/TOOLS/TDS/TDS-source/Lts/Tools/ArAssetsV2" - ] - ], - "_development": true, - "_from": "@types/geojson@7946.0.6", - "_id": "@types/geojson@7946.0.6", - "_inBundle": false, - "_integrity": "sha512-f6qai3iR62QuMPPdgyH+LyiXTL2n9Rf62UniJjV7KHrbiwzLTZUKsdq0mFSTxAHbO7JvwxwC4tH0m1UnweuLrA==", - "_location": "/@types/geojson", - "_phantomChildren": {}, - "_requested": { - "type": "version", - "registry": true, - "raw": "@types/geojson@7946.0.6", - "name": "@types/geojson", - "escapedName": "@types%2fgeojson", - "scope": "@types", - "rawSpec": "7946.0.6", - "saveSpec": null, - "fetchSpec": "7946.0.6" - }, - "_requiredBy": [ - "#DEV:/", - "/@types/leaflet" - ], - "_resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.6.tgz", - "_spec": "7946.0.6", - "_where": "/shd/CTC/TOOLS/TDS/TDS-source/Lts/Tools/ArAssetsV2", - "bugs": { - "url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues" - }, - "contributors": [ - { - "name": "Jacob Bruun", - "url": "https://github.com/cobster" - }, - { - "name": "Arne Schubert", - "url": "https://github.com/atd-schubert" - }, - { - "name": "Jeff Jacobson", - "url": "https://github.com/JeffJacobson" - }, - { - "name": "Ilia Choly", - "url": "https://github.com/icholy" - }, - { - "name": "Dan Vanderkam", - "url": "https://github.com/danvk" - } - ], - "dependencies": {}, - "description": "TypeScript definitions for geojson", - "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped#readme", - "license": "MIT", - "main": "", - "name": "@types/geojson", - "repository": { - "type": "git", - "url": "git+https://github.com/DefinitelyTyped/DefinitelyTyped.git" - }, - "scripts": {}, - "typeScriptVersion": "2.3", - "types": "index", - "typesPublisherContentHash": "6fa1b4d098782bf1b169ffa27e24d7b40e668c22633c8cd169b000c4fc08dc8a", - "version": "7946.0.6" -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/@types/leaflet/LICENSE b/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/@types/leaflet/LICENSE deleted file mode 100755 index 21071075c..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/@types/leaflet/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ - MIT License - - Copyright (c) Microsoft Corporation. All rights reserved. - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/@types/leaflet/README.md b/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/@types/leaflet/README.md deleted file mode 100755 index 2c791a6a8..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/@types/leaflet/README.md +++ /dev/null @@ -1,16 +0,0 @@ -# Installation -> `npm install --save @types/leaflet` - -# Summary -This package contains type definitions for Leaflet.js ( https://github.com/Leaflet/Leaflet ). - -# Details -Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/leaflet - -Additional Details - * Last updated: Thu, 21 Feb 2019 18:40:08 GMT - * Dependencies: @types/geojson - * Global values: L - -# Credits -These definitions were written by Alejandro Sánchez , Arne Schubert , Michael Auer , Roni Karilkar . diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/@types/leaflet/index.d.ts b/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/@types/leaflet/index.d.ts deleted file mode 100755 index 708b8af38..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/@types/leaflet/index.d.ts +++ /dev/null @@ -1,1616 +0,0 @@ -// Type definitions for Leaflet.js 1.4 -// Project: https://github.com/Leaflet/Leaflet -// Definitions by: Alejandro Sánchez -// Arne Schubert -// Michael Auer -// Roni Karilkar -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -export as namespace L; - -import * as geojson from 'geojson'; - -export class Class { - static extend(props: any): {new(...args: any[]): any} & typeof Class; - static include(props: any): any & typeof Class; - static mergeOptions(props: any): any & typeof Class; - - static addInitHook(initHookFn: () => void): any & typeof Class; - static addInitHook(methodName: string, ...args: any[]): any & typeof Class; -} - -export class Transformation { - constructor(a: number, b: number, c: number, d: number); - transform(point: Point, scale?: number): Point; - untransform(point: Point, scale?: number): Point; -} - -export namespace LineUtil { - function simplify(points: Point[], tolerance: number): Point[]; - function pointToSegmentDistance(p: Point, p1: Point, p2: Point): number; - function closestPointOnSegment(p: Point, p1: Point, p2: Point): Point; - function isFlat(latlngs: LatLngExpression[]): boolean; -} - -export namespace PolyUtil { - function clipPolygon(points: Point[], bounds: BoundsExpression, round?: boolean): Point[]; -} - -export namespace DomUtil { - /** - * Get Element by its ID or with the given HTML-Element - */ - function get(element: string | HTMLElement): HTMLElement | null; - function getStyle(el: HTMLElement, styleAttrib: string): string | null; - function create(tagName: string, className?: string, container?: HTMLElement): HTMLElement; - function remove(el: HTMLElement): void; - function empty(el: HTMLElement): void; - function toFront(el: HTMLElement): void; - function toBack(el: HTMLElement): void; - function hasClass(el: HTMLElement, name: string): boolean; - function addClass(el: HTMLElement, name: string): void; - function removeClass(el: HTMLElement, name: string): void; - function setClass(el: HTMLElement, name: string): void; - function getClass(el: HTMLElement): string; - function setOpacity(el: HTMLElement, opacity: number): void; - function testProp(props: string[]): string | false; - function setTransform(el: HTMLElement, offset: Point, scale?: number): void; - function setPosition(el: HTMLElement, position: Point): void; - function getPosition(el: HTMLElement): Point; - function disableTextSelection(): void; - function enableTextSelection(): void; - function disableImageDrag(): void; - function enableImageDrag(): void; - function preventOutline(el: HTMLElement): void; - function restoreOutline(): void; - - let TRANSFORM: string; - let TRANSITION: string; - let TRANSITION_END: string; -} - -export interface CRS { - latLngToPoint(latlng: LatLngExpression, zoom: number): Point; - pointToLatLng(point: PointExpression, zoom: number): LatLng; - project(latlng: LatLng | LatLngLiteral): Point; - unproject(point: PointExpression): LatLng; - scale(zoom: number): number; - zoom(scale: number): number; - getProjectedBounds(zoom: number): Bounds; - distance(latlng1: LatLngExpression, latlng2: LatLngExpression): number; - wrapLatLng(latlng: LatLng | LatLngLiteral): LatLng; - - code?: string; - wrapLng?: [number, number]; - wrapLat?: [number, number]; - infinite: boolean; -} - -export namespace CRS { - const EPSG3395: CRS; - const EPSG3857: CRS; - const EPSG4326: CRS; - const Earth: CRS; - const Simple: CRS; -} - -export interface Projection { - project(latlng: LatLng | LatLngLiteral): Point; - unproject(point: PointExpression): LatLng; - - bounds: Bounds; -} - -export namespace Projection { - const LonLat: Projection; - const Mercator: Projection; - const SphericalMercator: Projection; -} - -export class LatLng { - constructor(latitude: number, longitude: number, altitude?: number); - equals(otherLatLng: LatLngExpression, maxMargin?: number): boolean; - toString(): string; - distanceTo(otherLatLng: LatLngExpression): number; - wrap(): LatLng; - toBounds(sizeInMeters: number): LatLngBounds; - - lat: number; - lng: number; - alt?: number; -} - -export interface LatLngLiteral { - lat: number; - lng: number; -} - -export type LatLngTuple = [number, number]; - -export type LatLngExpression = LatLng | LatLngLiteral | LatLngTuple; - -export function latLng(latitude: number, longitude: number, altitude?: number): LatLng; - -export function latLng(coords: LatLngTuple | [number, number, number] | LatLngLiteral | {lat: number, lng: number, alt?: number}): LatLng; - -export class LatLngBounds { - constructor(southWest: LatLngExpression, northEast: LatLngExpression); - constructor(latlngs: LatLngBoundsLiteral); - extend(latlngOrBounds: LatLngExpression | LatLngBoundsExpression): this; - pad(bufferRatio: number): LatLngBounds; // does this modify the current instance or does it return a new one? - getCenter(): LatLng; - getSouthWest(): LatLng; - getNorthEast(): LatLng; - getNorthWest(): LatLng; - getSouthEast(): LatLng; - getWest(): number; - getSouth(): number; - getEast(): number; - getNorth(): number; - contains(otherBoundsOrLatLng: LatLngBoundsExpression | LatLngExpression): boolean; - intersects(otherBounds: LatLngBoundsExpression): boolean; - overlaps(otherBounds: BoundsExpression): boolean; // investigate if this is really bounds and not latlngbounds - toBBoxString(): string; - equals(otherBounds: LatLngBoundsExpression): boolean; - isValid(): boolean; -} - -export type LatLngBoundsLiteral = LatLngTuple[]; // Must be [LatLngTuple, LatLngTuple], cant't change because Map.setMaxBounds - -export type LatLngBoundsExpression = LatLngBounds | LatLngBoundsLiteral; - -export function latLngBounds(southWest: LatLngExpression, northEast: LatLngExpression): LatLngBounds; - -export function latLngBounds(latlngs: LatLngExpression[]): LatLngBounds; - -export type PointTuple = [number, number]; - -export class Point { - constructor(x: number, y: number, round?: boolean); - clone(): Point; - add(otherPoint: PointExpression): Point; // non-destructive, returns a new point - subtract(otherPoint: PointExpression): Point; - divideBy(num: number): Point; - multiplyBy(num: number): Point; - scaleBy(scale: PointExpression): Point; - unscaleBy(scale: PointExpression): Point; - round(): Point; - floor(): Point; - ceil(): Point; - distanceTo(otherPoint: PointExpression): number; - equals(otherPoint: PointExpression): boolean; - contains(otherPoint: PointExpression): boolean; - toString(): string; - x: number; - y: number; -} - -export interface Coords extends Point { - z: number; -} - -export type PointExpression = Point | PointTuple; - -export function point(x: number, y: number, round?: boolean): Point; - -export function point(coords: PointTuple | {x: number, y: number}): Point; - -export type BoundsLiteral = [PointTuple, PointTuple]; - -export class Bounds { - constructor(topLeft: PointExpression, bottomRight: PointExpression); - constructor(points: Point[] | BoundsLiteral); - extend(point: PointExpression): this; - getCenter(round?: boolean): Point; - getBottomLeft(): Point; - getTopRight(): Point; - getSize(): Point; - contains(pointOrBounds: BoundsExpression | PointExpression): boolean; - intersects(otherBounds: BoundsExpression): boolean; - overlaps(otherBounds: BoundsExpression): boolean; - - min?: Point; - max?: Point; -} - -export type BoundsExpression = Bounds | BoundsLiteral; - -export function bounds(topLeft: PointExpression, bottomRight: PointExpression): Bounds; - -export function bounds(points: Point[] | BoundsLiteral): Bounds; - -export type LeafletEventHandlerFn = (event: LeafletEvent) => void; - -export interface LeafletEventHandlerFnMap { - [type: string]: LeafletEventHandlerFn; -} - -/** - * A set of methods shared between event-powered classes (like Map and Marker). - * Generally, events allow you to execute some function when something happens - * with an object (e.g. the user clicks on the map, causing the map to fire - * 'click' event). - */ -export abstract class Evented extends Class { - /** - * Adds a listener function (fn) to a particular event type of the object. - * You can optionally specify the context of the listener (object the this - * keyword will point to). You can also pass several space-separated types - * (e.g. 'click dblclick'). - */ - on(type: string, fn: LeafletEventHandlerFn, context?: any): this; - - /** - * Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove} - */ - on(eventMap: LeafletEventHandlerFnMap): this; - - /** - * Removes a previously added listener function. If no function is specified, - * it will remove all the listeners of that particular event from the object. - * Note that if you passed a custom context to on, you must pass the same context - * to off in order to remove the listener. - */ - // With an eventMap there are no additional arguments allowed - // tslint:disable-next-line:unified-signatures - off(type: string, fn?: LeafletEventHandlerFn, context?: any): this; - - /** - * Removes a set of type/listener pairs. - */ - // With an eventMap there are no additional arguments allowed - // tslint:disable-next-line:unified-signatures - off(eventMap: LeafletEventHandlerFnMap): this; - /** - * Removes all listeners to all events on the object. - */ - off(): this; - - /** - * Fires an event of the specified type. You can optionally provide a data - * object — the first argument of the listener function will contain its properties. - * The event might can optionally be propagated to event parents. - */ - fire(type: string, data?: any, propagate?: boolean): this; - - /** - * Returns true if a particular event type has any listeners attached to it. - */ - listens(type: string): boolean; - - /** - * Behaves as on(...), except the listener will only get fired once and then removed. - */ - once(type: string, fn: LeafletEventHandlerFn, context?: any): this; - - /** - * Behaves as on(...), except the listener will only get fired once and then removed. - */ - once(eventMap: LeafletEventHandlerFnMap): this; - - /** - * Adds an event parent - an Evented that will receive propagated events - */ - addEventParent(obj: Evented): this; - - /** - * Removes an event parent, so it will stop receiving propagated events - */ - removeEventParent(obj: Evented): this; - - /** - * Alias for on(...) - * - * Adds a listener function (fn) to a particular event type of the object. - * You can optionally specify the context of the listener (object the this - * keyword will point to). You can also pass several space-separated types - * (e.g. 'click dblclick'). - */ - addEventListener(type: string, fn: LeafletEventHandlerFn, context?: any): this; - - /** - * Alias for on(...) - * - * Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove} - */ - addEventListener(eventMap: LeafletEventHandlerFnMap): this; - - /** - * Alias for off(...) - * - * Removes a previously added listener function. If no function is specified, - * it will remove all the listeners of that particular event from the object. - * Note that if you passed a custom context to on, you must pass the same context - * to off in order to remove the listener. - */ - removeEventListener(type: string, fn?: LeafletEventHandlerFn, context?: any): this; - - /** - * Alias for off(...) - * - * Removes a set of type/listener pairs. - */ - removeEventListener(eventMap: LeafletEventHandlerFnMap): this; - - /** - * Alias for off() - * - * Removes all listeners to all events on the object. - */ - clearAllEventListeners(): this; - - /** - * Alias for once(...) - * - * Behaves as on(...), except the listener will only get fired once and then removed. - */ - addOneTimeEventListener(type: string, fn: LeafletEventHandlerFn, context?: any): this; - - /** - * Alias for once(...) - * - * Behaves as on(...), except the listener will only get fired once and then removed. - */ - addOneTimeEventListener(eventMap: LeafletEventHandlerFnMap): this; - - /** - * Alias for fire(...) - * - * Fires an event of the specified type. You can optionally provide a data - * object — the first argument of the listener function will contain its properties. - * The event might can optionally be propagated to event parents. - */ - fireEvent(type: string, data?: any, propagate?: boolean): this; - - /** - * Alias for listens(...) - * - * Returns true if a particular event type has any listeners attached to it. - */ - hasEventListeners(type: string): boolean; -} - -/** - * A class for making DOM elements draggable (including touch support). - * Used internally for map and marker dragging. Only works for elements - * that were positioned with [`L.DomUtil.setPosition`](#domutil-setposition). - */ -export class Draggable extends Evented { - constructor(element: HTMLElement, dragStartTarget?: HTMLElement, preventOutline?: boolean); - - enable(): void; - - disable(): void; - - finishDrag(): void; -} - -export interface LayerOptions { - pane?: string; - attribution?: string; -} - -export interface InteractiveLayerOptions extends LayerOptions { - interactive?: boolean; - bubblingMouseEvents?: boolean; -} - -export class Layer extends Evented { - constructor(options?: LayerOptions); - addTo(map: Map|LayerGroup): this; - remove(): this; - removeFrom(map: Map): this; - getPane(name?: string): HTMLElement | undefined; - - // Popup methods - bindPopup(content: ((layer: Layer) => Content) | Content | Popup, options?: PopupOptions): this; - unbindPopup(): this; - openPopup(latlng?: LatLngExpression): this; - closePopup(): this; - togglePopup(): this; - isPopupOpen(): boolean; - setPopupContent(content: Content | Popup): this; - getPopup(): Popup | undefined; - - // Tooltip methods - bindTooltip(content: ((layer: Layer) => Content) | Tooltip | Content, options?: TooltipOptions): this; - unbindTooltip(): this; - openTooltip(latlng?: LatLngExpression): this; - closeTooltip(): this; - toggleTooltip(): this; - isTooltipOpen(): boolean; - setTooltipContent(content: Content | Tooltip): this; - getTooltip(): Tooltip | undefined; - - // Extension methods - onAdd(map: Map): this; - onRemove(map: Map): this; - getEvents?(): {[name: string]: (event: LeafletEvent) => void}; - getAttribution?(): string | null; - beforeAdd?(map: Map): this; - - protected _map: Map; -} - -export interface GridLayerOptions { - tileSize?: number | Point; - opacity?: number; - updateWhenIdle?: boolean; - updateWhenZooming?: boolean; - updateInterval?: number; - attribution?: string; - zIndex?: number; - bounds?: LatLngBoundsExpression; - minZoom?: number; - maxZoom?: number; - noWrap?: boolean; - pane?: string; - className?: string; - keepBuffer?: number; -} - -export type DoneCallback = (error?: Error, tile?: HTMLElement) => void; - -export interface InternalTiles { - [key: string]: { - active?: boolean, - coords: Coords, - current: boolean, - el: HTMLElement, - loaded?: Date, - retain?: boolean, - }; -} - -export class GridLayer extends Layer { - constructor(options?: GridLayerOptions); - bringToFront(): this; - bringToBack(): this; - getContainer(): HTMLElement | null; - setOpacity(opacity: number): this; - setZIndex(zIndex: number): this; - isLoading(): boolean; - redraw(): this; - getTileSize(): Point; - - protected createTile(coords: Coords, done: DoneCallback): HTMLElement; - protected _tileCoordsToKey(coords: Coords): string; - - protected _tiles: InternalTiles; - protected _tileZoom?: number; -} - -export function gridLayer(options?: GridLayerOptions): GridLayer; - -export interface TileLayerOptions extends GridLayerOptions { - minZoom?: number; - maxZoom?: number; - maxNativeZoom?: number; - minNativeZoom?: number; - subdomains?: string | string[]; - errorTileUrl?: string; - zoomOffset?: number; - tms?: boolean; - zoomReverse?: boolean; - detectRetina?: boolean; - crossOrigin?: CrossOrigin; - // [name: string]: any; - // You are able add additional properties, but it makes this interface unchackable. - // See: https://github.com/DefinitelyTyped/DefinitelyTyped/issues/15313 - // Example: - // tileLayer = L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png?{foo}&{bar}&{abc}', {foo: 'bar', bar: (data: any) => 'foo', abc: () => ''}); -} - -export class TileLayer extends GridLayer { - constructor(urlTemplate: string, options?: TileLayerOptions); - setUrl(url: string, noRedraw?: boolean): this; - - protected _abortLoading(): void; - protected _getZoomForUrl(): number; - - options: TileLayerOptions; -} - -export function tileLayer(urlTemplate: string, options?: TileLayerOptions): TileLayer; - -export namespace TileLayer { - class WMS extends TileLayer { - constructor(baseUrl: string, options: WMSOptions); - setParams(params: WMSParams, noRedraw?: boolean): this; - - wmsParams: WMSParams; - options: WMSOptions; - } -} - -export interface WMSOptions extends TileLayerOptions { - layers?: string; - styles?: string; - format?: string; - transparent?: boolean; - version?: string; - crs?: CRS; - uppercase?: boolean; -} - -export interface WMSParams { - format?: string; - layers: string; - request?: string; - service?: string; - styles?: string; - version?: string; - transparent?: boolean; - width?: number; - height?: number; -} - -export namespace tileLayer { - function wms(baseUrl: string, options?: WMSOptions): TileLayer.WMS; -} - -export type CrossOrigin = boolean | string; - -export interface ImageOverlayOptions extends InteractiveLayerOptions { - opacity?: number; - alt?: string; - interactive?: boolean; - attribution?: string; - crossOrigin?: CrossOrigin; - errorOverlayUrl?: string; - zIndex?: number; - className?: string; -} - -export class ImageOverlay extends Layer { - constructor(imageUrl: string, bounds: LatLngBoundsExpression, options?: ImageOverlayOptions); - setOpacity(opacity: number): this; - bringToFront(): this; - bringToBack(): this; - setUrl(url: string): this; - - /** Update the bounds that this ImageOverlay covers */ - setBounds(bounds: LatLngBounds): this; - - /** Changes the zIndex of the image overlay */ - setZIndex(value: number): this; - - /** Get the bounds that this ImageOverlay covers */ - getBounds(): LatLngBounds; - - /** Get the img element that represents the ImageOverlay on the map */ - getElement(): HTMLImageElement | undefined; - - options: ImageOverlayOptions; -} - -export function imageOverlay(imageUrl: string, bounds: LatLngBoundsExpression, options?: ImageOverlayOptions): ImageOverlay; - -export interface VideoOverlayOptions extends ImageOverlayOptions { - autoplay?: boolean; - loop?: boolean; -} - -export class VideoOverlay extends Layer { /** VideoOverlay doesn't extend ImageOverlay because ImageOverlay.getElement returns HTMLImageElement */ - constructor(video: string | string[] | HTMLVideoElement, bounds: LatLngBoundsExpression, options?: VideoOverlayOptions); - setOpacity(opacity: number): this; - bringToFront(): this; - bringToBack(): this; - setUrl(url: string): this; - - /** Update the bounds that this VideoOverlay covers */ - setBounds(bounds: LatLngBounds): this; - - /** Get the bounds that this VideoOverlay covers */ - getBounds(): LatLngBounds; - - /** Get the video element that represents the VideoOverlay on the map */ - getElement(): HTMLVideoElement | undefined; - - options: VideoOverlayOptions; -} - -export function videoOverlay(video: string | string[] | HTMLVideoElement, bounds: LatLngBoundsExpression, options?: VideoOverlayOptions): VideoOverlay; - -export type LineCapShape = 'butt' | 'round' | 'square' | 'inherit'; - -export type LineJoinShape = 'miter' | 'round' | 'bevel' | 'inherit'; - -export type FillRule = 'nonzero' | 'evenodd' | 'inherit'; - -export interface PathOptions extends InteractiveLayerOptions { - stroke?: boolean; - color?: string; - weight?: number; - opacity?: number; - lineCap?: LineCapShape; - lineJoin?: LineJoinShape; - dashArray?: string | number[]; - dashOffset?: string; - fill?: boolean; - fillColor?: string; - fillOpacity?: number; - fillRule?: FillRule; - renderer?: Renderer; - className?: string; -} - -export abstract class Path extends Layer { - redraw(): this; - setStyle(style: PathOptions): this; - bringToFront(): this; - bringToBack(): this; - getElement(): Element | undefined; - - options: PathOptions; -} - -export interface PolylineOptions extends PathOptions { - smoothFactor?: number; - noClip?: boolean; -} - -export class Polyline extends Path { - constructor(latlngs: LatLngExpression[] | LatLngExpression[][], options?: PolylineOptions); - toGeoJSON(): geojson.Feature; - getLatLngs(): LatLng[] | LatLng[][] | LatLng[][][]; - setLatLngs(latlngs: LatLngExpression[] | LatLngExpression[][] | LatLngExpression[][][]): this; - isEmpty(): boolean; - getCenter(): LatLng; - getBounds(): LatLngBounds; - addLatLng(latlng: LatLngExpression | LatLngExpression[]): this; - - feature?: geojson.Feature; - options: PolylineOptions; -} - -export function polyline(latlngs: LatLngExpression[] | LatLngExpression[][], options?: PolylineOptions): Polyline; - -export class Polygon

    extends Polyline { - constructor(latlngs: LatLngExpression[] | LatLngExpression[][] | LatLngExpression[][][], options?: PolylineOptions); -} - -export function polygon(latlngs: LatLngExpression[] | LatLngExpression[][] | LatLngExpression[][][], options?: PolylineOptions): Polygon; - -export class Rectangle

    extends Polygon

    { - constructor(latLngBounds: LatLngBoundsExpression, options?: PolylineOptions); - setBounds(latLngBounds: LatLngBoundsExpression): this; -} - -export function rectangle(latLngBounds: LatLngBoundsExpression, options?: PolylineOptions): Rectangle; - -export interface CircleMarkerOptions extends PathOptions { - radius?: number; -} - -export class CircleMarker

    extends Path { - constructor(latlng: LatLngExpression, options?: CircleMarkerOptions); - toGeoJSON(): geojson.Feature; - setLatLng(latLng: LatLngExpression): this; - getLatLng(): LatLng; - setRadius(radius: number): this; - getRadius(): number; - - options: CircleMarkerOptions; - feature?: geojson.Feature; -} - -export function circleMarker(latlng: LatLngExpression, options?: CircleMarkerOptions): CircleMarker; - -export class Circle

    extends CircleMarker

    { - constructor(latlng: LatLngExpression, options?: CircleMarkerOptions); - constructor(latlng: LatLngExpression, radius: number, options?: CircleMarkerOptions); // deprecated! - getBounds(): LatLngBounds; -} - -export function circle(latlng: LatLngExpression, options?: CircleMarkerOptions): Circle; -export function circle(latlng: LatLngExpression, radius: number, options?: CircleMarkerOptions): Circle; // deprecated! - -export interface RendererOptions extends LayerOptions { - padding?: number; -} - -export class Renderer extends Layer { - constructor(options?: RendererOptions); - - options: RendererOptions; -} - -export class SVG extends Renderer {} - -export namespace SVG { - function create(name: string): SVGElement; - - function pointsToPath(rings: PointExpression[], close: boolean): string; -} - -export function svg(options?: RendererOptions): SVG; - -export class Canvas extends Renderer {} - -export function canvas(options?: RendererOptions): Canvas; - -/** - * Used to group several layers and handle them as one. - * If you add it to the map, any layers added or removed from the group will be - * added/removed on the map as well. Extends Layer. - */ -export class LayerGroup

    extends Layer { - constructor(layers?: Layer[], options?: LayerOptions); - - /** - * Returns a GeoJSON representation of the layer group (as a GeoJSON GeometryCollection, GeoJSONFeatureCollection or Multipoint). - */ - toGeoJSON(): geojson.FeatureCollection | geojson.Feature | geojson.GeometryCollection; - - /** - * Adds the given layer to the group. - */ - addLayer(layer: Layer): this; - - /** - * Removes the layer with the given internal ID or the given layer from the group. - */ - removeLayer(layer: number | Layer): this; - - /** - * Returns true if the given layer is currently added to the group. - */ - hasLayer(layer: Layer): boolean; - - /** - * Removes all the layers from the group. - */ - clearLayers(): this; - - /** - * Calls methodName on every layer contained in this group, passing any additional parameters. - * Has no effect if the layers contained do not implement methodName. - */ - invoke(methodName: string, ...params: any[]): this; - - /** - * Iterates over the layers of the group, - * optionally specifying context of the iterator function. - */ - eachLayer(fn: (layer: Layer) => void, context?: any): this; - - /** - * Returns the layer with the given internal ID. - */ - getLayer(id: number): Layer | undefined; - - /** - * Returns an array of all the layers added to the group. - */ - getLayers(): Layer[]; - - /** - * Calls setZIndex on every layer contained in this group, passing the z-index. - */ - setZIndex(zIndex: number): this; - - /** - * Returns the internal ID for a layer - */ - getLayerId(layer: Layer): number; - - feature?: geojson.FeatureCollection | geojson.Feature | geojson.GeometryCollection; -} - -/** - * Create a layer group, optionally given an initial set of layers and an `options` object. - */ -export function layerGroup(layers?: Layer[], options?: LayerOptions): LayerGroup; - -/** - * Extended LayerGroup that also has mouse events (propagated from - * members of the group) and a shared bindPopup method. - */ -export class FeatureGroup

    extends LayerGroup

    { - /** - * Sets the given path options to each layer of the group that has a setStyle method. - */ - setStyle(style: PathOptions): this; - - /** - * Brings the layer group to the top of all other layers - */ - bringToFront(): this; - - /** - * Brings the layer group to the top [sic] of all other layers - */ - bringToBack(): this; - - /** - * Returns the LatLngBounds of the Feature Group (created from - * bounds and coordinates of its children). - */ - getBounds(): LatLngBounds; -} - -/** - * Create a feature group, optionally given an initial set of layers. - */ -export function featureGroup(layers?: Layer[]): FeatureGroup; - -export type StyleFunction

    = (feature?: geojson.Feature) => PathOptions; - -export interface GeoJSONOptions

    extends LayerOptions { - /** - * A Function defining how GeoJSON points spawn Leaflet layers. - * It is internally called when data is added, passing the GeoJSON point - * feature and its LatLng. - * - * The default is to spawn a default Marker: - * - * ``` - * function(geoJsonPoint, latlng) { - * return L.marker(latlng); - * } - * ``` - */ - pointToLayer?(geoJsonPoint: geojson.Feature, latlng: LatLng): Layer; // should import GeoJSON typings - - /** - * PathOptions or a Function defining the Path options for styling GeoJSON lines and polygons, - * called internally when data is added. - * - * The default value is to not override any defaults: - * - * ``` - * function (geoJsonFeature) { - * return {} - * } - * ``` - */ - style?: PathOptions | StyleFunction

    ; - - /** - * A Function that will be called once for each created Feature, after it - * has been created and styled. Useful for attaching events and popups to features. - * - * The default is to do nothing with the newly created layers: - * - * ``` - * function (feature, layer) {} - * ``` - */ - onEachFeature?(feature: geojson.Feature, layer: Layer): void; - - /** - * A Function that will be used to decide whether to show a feature or not. - * - * The default is to show all features: - * - * ``` - * function (geoJsonFeature) { - * return true; - * } - * ``` - */ - filter?(geoJsonFeature: geojson.Feature): boolean; - - /** - * A Function that will be used for converting GeoJSON coordinates to LatLngs. - * The default is the coordsToLatLng static method. - */ - coordsToLatLng?(coords: [number, number] | [number, number, number]): LatLng; // check if LatLng has an altitude property -} - -/** - * Represents a GeoJSON object or an array of GeoJSON objects. - * Allows you to parse GeoJSON data and display it on the map. Extends FeatureGroup. - */ -export class GeoJSON

    extends FeatureGroup

    { - /** - * Creates a Layer from a given GeoJSON feature. Can use a custom pointToLayer - * and/or coordsToLatLng functions if provided as options. - */ - static geometryToLayer

    (featureData: geojson.Feature, options?: GeoJSONOptions

    ): Layer; - - /** - * Creates a LatLng object from an array of 2 numbers (longitude, latitude) or - * 3 numbers (longitude, latitude, altitude) used in GeoJSON for points. - */ - static coordsToLatLng(coords: [number, number] | [number, number, number]): LatLng; - - /** - * Creates a multidimensional array of LatLngs from a GeoJSON coordinates array. - * levelsDeep specifies the nesting level (0 is for an array of points, 1 for an array of - * arrays of points, etc., 0 by default). - * Can use a custom coordsToLatLng function. - */ - static coordsToLatLngs( - coords: any[], - levelsDeep?: number, - coordsToLatLng?: (coords: [number, number] | [number, number, number]) => LatLng): any[]; // Using any[] to avoid artificially limiting valid calls - - /** - * Reverse of coordsToLatLng - */ - static latLngToCoords(latlng: LatLng): [number, number] | [number, number, number]; - - /** - * Reverse of coordsToLatLngs closed determines whether the first point should be - * appended to the end of the array to close the feature, only used when levelsDeep is 0. - * False by default. - */ - static latLngsToCoords(latlngs: any[], levelsDeep?: number, closed?: boolean): any[]; // Using any[] to avoid artificially limiting valid calls - - /** - * Normalize GeoJSON geometries/features into GeoJSON features. - */ - static asFeature

    (geojson: geojson.Feature | geojson.GeometryObject): geojson.Feature; - - constructor(geojson?: geojson.GeoJsonObject, options?: GeoJSONOptions

    ) - /** - * Adds a GeoJSON object to the layer. - */ - addData(data: geojson.GeoJsonObject): Layer; - - /** - * Resets the given vector layer's style to the original GeoJSON style, - * useful for resetting style after hover events. - */ - resetStyle(layer: Layer): Layer; - - /** - * Same as FeatureGroup's setStyle method, but style-functions are also - * allowed here to set the style according to the feature. - */ - setStyle(style: PathOptions | StyleFunction

    ): this; - - options: GeoJSONOptions

    ; -} - -/** - * Creates a GeoJSON layer. - * - * Optionally accepts an object in GeoJSON format to display on the - * map (you can alternatively add it later with addData method) and - * an options object. - */ -export function geoJSON

    (geojson?: geojson.GeoJsonObject, options?: GeoJSONOptions

    ): GeoJSON

    ; - -export type Zoom = boolean | 'center'; - -export interface MapOptions { - preferCanvas?: boolean; - - // Control options - attributionControl?: boolean; - zoomControl?: boolean; - - // Interaction options - closePopupOnClick?: boolean; - zoomSnap?: number; - zoomDelta?: number; - trackResize?: boolean; - boxZoom?: boolean; - doubleClickZoom?: Zoom; - dragging?: boolean; - - // Map state options - crs?: CRS; - center?: LatLngExpression; - zoom?: number; - minZoom?: number; - maxZoom?: number; - layers?: Layer[]; - maxBounds?: LatLngBoundsExpression; - renderer?: Renderer; - - // Animation options - fadeAnimation?: boolean; - markerZoomAnimation?: boolean; - transform3DLimit?: number; - zoomAnimation?: boolean; - zoomAnimationThreshold?: number; - - // Panning inertia options - inertia?: boolean; - inertiaDeceleration?: number; - inertiaMaxSpeed?: number; - easeLinearity?: number; - worldCopyJump?: boolean; - maxBoundsViscosity?: number; - - // Keyboard navigation options - keyboard?: boolean; - keyboardPanDelta?: number; - - // Mousewheel options - scrollWheelZoom?: Zoom; - wheelDebounceTime?: number; - wheelPxPerZoomLevel?: number; - - // Touch interaction options - tap?: boolean; - tapTolerance?: number; - touchZoom?: Zoom; - bounceAtZoomLimits?: boolean; -} - -export type ControlPosition = 'topleft' | 'topright' | 'bottomleft' | 'bottomright'; - -export interface ControlOptions { - position?: ControlPosition; -} - -export class Control extends Class { - constructor(options?: ControlOptions); - getPosition(): ControlPosition; - setPosition(position: ControlPosition): this; - getContainer(): HTMLElement | undefined; - addTo(map: Map): this; - remove(): this; - - // Extension methods - onAdd?(map: Map): HTMLElement; - onRemove?(map: Map): void; - - options: ControlOptions; -} - -export namespace Control { - interface ZoomOptions extends ControlOptions { - zoomInText?: string; - zoomInTitle?: string; - zoomOutText?: string; - zoomOutTitle?: string; - } - - class Zoom extends Control { - constructor(options?: ZoomOptions); - options: ZoomOptions; - } - - interface AttributionOptions extends ControlOptions { - prefix?: string | boolean; - } - - class Attribution extends Control { - constructor(options?: AttributionOptions); - setPrefix(prefix: string): this; - addAttribution(text: string): this; - removeAttribution(text: string): this; - options: AttributionOptions; - } - - interface LayersOptions extends ControlOptions { - collapsed?: boolean; - autoZIndex?: boolean; - hideSingleBase?: boolean; - } - - interface LayersObject { - [name: string]: Layer; - } - - class Layers extends Control { - constructor(baseLayers?: LayersObject, overlays?: LayersObject, options?: LayersOptions); - addBaseLayer(layer: Layer, name: string): this; - addOverlay(layer: Layer, name: string): this; - removeLayer(layer: Layer): this; - expand(): this; - collapse(): this; - options: LayersOptions; - } - - interface ScaleOptions extends ControlOptions { - maxWidth?: number; - metric?: boolean; - imperial?: boolean; - updateWhenIdle?: boolean; - } - - class Scale extends Control { - constructor(options?: ScaleOptions); - options: ScaleOptions; - } -} - -export namespace control { - function zoom(options?: Control.ZoomOptions): Control.Zoom; - - function attribution(options?: Control.AttributionOptions): Control.Attribution; - - function layers(baseLayers?: Control.LayersObject, overlays?: Control.LayersObject, options?: Control.LayersOptions): Control.Layers; - - function scale(options?: Control.ScaleOptions): Control.Scale; -} - -export interface DivOverlayOptions { - offset?: PointExpression; - zoomAnimation?: boolean; - className?: string; - pane?: string; -} - -export interface PopupOptions extends DivOverlayOptions { - maxWidth?: number; - minWidth?: number; - maxHeight?: number; - keepInView?: boolean; - closeButton?: boolean; - autoPan?: boolean; - autoPanPaddingTopLeft?: PointExpression; - autoPanPaddingBottomRight?: PointExpression; - autoPanPadding?: PointExpression; - autoClose?: boolean; - closeOnClick?: boolean; - closeOnEscapeKey?: boolean; -} - -export type Content = string | HTMLElement; - -export class Popup extends Layer { - constructor(options?: PopupOptions, source?: Layer); - getLatLng(): LatLng | undefined; - setLatLng(latlng: LatLngExpression): this; - getContent(): Content | ((source: Layer) => Content) | undefined; - setContent(htmlContent: ((source: Layer) => Content) | Content): this; - getElement(): HTMLElement | undefined; - update(): void; - isOpen(): boolean; - bringToFront(): this; - bringToBack(): this; - openOn(map: Map): this; - - options: PopupOptions; -} - -export function popup(options?: PopupOptions, source?: Layer): Popup; - -export type Direction = 'right' | 'left' | 'top' | 'bottom' | 'center' | 'auto'; - -export interface TooltipOptions extends DivOverlayOptions { - pane?: string; - offset?: PointExpression; - direction?: Direction; - permanent?: boolean; - sticky?: boolean; - interactive?: boolean; - opacity?: number; -} - -export class Tooltip extends Layer { - constructor(options?: TooltipOptions, source?: Layer); - setOpacity(val: number): void; - getLatLng(): LatLng | undefined; - setLatLng(latlng: LatLngExpression): this; - getContent(): Content | undefined; - setContent(htmlContent: ((source: Layer) => Content) | Content): this; - getElement(): HTMLElement | undefined; - update(): void; - isOpen(): boolean; - bringToFront(): this; - bringToBack(): this; - - options: TooltipOptions; -} - -export function tooltip(options?: TooltipOptions, source?: Layer): Tooltip; - -export interface ZoomOptions { - animate?: boolean; -} - -export interface PanOptions { - animate?: boolean; - duration?: number; - easeLinearity?: number; - noMoveStart?: boolean; -} - -// This is not empty, it extends two interfaces into one... -export interface ZoomPanOptions extends ZoomOptions, PanOptions {} - -export interface FitBoundsOptions extends ZoomOptions, PanOptions { - paddingTopLeft?: PointExpression; - paddingBottomRight?: PointExpression; - padding?: PointExpression; - maxZoom?: number; -} - -export interface PanInsideOptions { - paddingTopLeft?: PointExpression; - paddingBottomRight?: PointExpression; - padding?: PointExpression; -} - -export interface LocateOptions { - watch?: boolean; - setView?: boolean; - maxZoom?: number; - timeout?: number; - maximumAge?: number; - enableHighAccuracy?: boolean; -} - -export class Handler extends Class { - constructor(map: Map); - enable(): this; - disable(): this; - enabled(): boolean; - - // Extension methods - addHooks?(): void; - removeHooks?(): void; -} - -export interface LeafletEvent { - type: string; - target: any; -} - -export interface LeafletMouseEvent extends LeafletEvent { - latlng: LatLng; - layerPoint: Point; - containerPoint: Point; - originalEvent: MouseEvent; -} - -export interface LeafletKeyboardEvent extends LeafletEvent { - originalEvent: KeyboardEvent; -} - -export interface LocationEvent extends LeafletEvent { - latlng: LatLng; - bounds: LatLngBounds; - accuracy: number; - altitude: number; - altitudeAccuracy: number; - heading: number; - speed: number; - timestamp: number; -} - -export interface ErrorEvent extends LeafletEvent { - message: string; - code: number; -} - -export interface LayerEvent extends LeafletEvent { - layer: Layer; -} - -export interface LayersControlEvent extends LayerEvent { - name: string; -} - -export interface TileEvent extends LeafletEvent { - tile: HTMLImageElement; - coords: Point; // apparently not a normal point, since docs say it has z (zoom) -} - -export interface TileErrorEvent extends TileEvent { - error: Error; -} - -export interface ResizeEvent extends LeafletEvent { - oldSize: Point; - newSize: Point; -} - -export interface GeoJSONEvent extends LeafletEvent { - layer: Layer; - properties: any; - geometryType: string; - id: string; -} - -export interface PopupEvent extends LeafletEvent { - popup: Popup; -} - -export interface TooltipEvent extends LeafletEvent { - tooltip: Tooltip; -} - -export interface DragEndEvent extends LeafletEvent { - distance: number; -} - -export interface ZoomAnimEvent extends LeafletEvent { - center: LatLng; - zoom: number; - noUpdate: boolean; -} - -export namespace DomEvent { - type EventHandlerFn = (event: Event) => void; - - function on(el: HTMLElement, types: string, fn: EventHandlerFn, context?: any): typeof DomEvent; - - function on(el: HTMLElement, eventMap: {[eventName: string]: EventHandlerFn}, context?: any): typeof DomEvent; - - function off(el: HTMLElement, types: string, fn: EventHandlerFn, context?: any): typeof DomEvent; - - function off(el: HTMLElement, eventMap: {[eventName: string]: EventHandlerFn}, context?: any): typeof DomEvent; - - function stopPropagation(ev: Event): typeof DomEvent; - - function disableScrollPropagation(el: HTMLElement): typeof DomEvent; - - function disableClickPropagation(el: HTMLElement): typeof DomEvent; - - function preventDefault(ev: Event): typeof DomEvent; - - function stop(ev: Event): typeof DomEvent; - - function getMousePosition(ev: MouseEvent, container?: HTMLElement): Point; - - function getWheelDelta(ev: Event): number; - - function addListener(el: HTMLElement, types: string, fn: EventHandlerFn, context?: any): typeof DomEvent; - - function addListener(el: HTMLElement, eventMap: {[eventName: string]: EventHandlerFn}, context?: any): typeof DomEvent; - - function removeListener(el: HTMLElement, types: string, fn: EventHandlerFn, context?: any): typeof DomEvent; - - function removeListener(el: HTMLElement, eventMap: {[eventName: string]: EventHandlerFn}, context?: any): typeof DomEvent; -} - -export interface DefaultMapPanes { - mapPane: HTMLElement; - tilePane: HTMLElement; - overlayPane: HTMLElement; - shadowPane: HTMLElement; - markerPane: HTMLElement; - tooltipPane: HTMLElement; - popupPane: HTMLElement; -} - -export class Map extends Evented { - constructor(element: string | HTMLElement, options?: MapOptions); - getRenderer(layer: Path): Renderer; - - // Methods for layers and controls - addControl(control: Control): this; - removeControl(control: Control): this; - addLayer(layer: Layer): this; - removeLayer(layer: Layer): this; - hasLayer(layer: Layer): boolean; - eachLayer(fn: (layer: Layer) => void, context?: any): this; - openPopup(popup: Popup): this; - openPopup(content: Content, latlng: LatLngExpression, options?: PopupOptions): this; - closePopup(popup?: Popup): this; - openTooltip(tooltip: Tooltip): this; - openTooltip(content: Content, latlng: LatLngExpression, options?: TooltipOptions): this; - closeTooltip(tooltip?: Tooltip): this; - - // Methods for modifying map state - setView(center: LatLngExpression, zoom: number, options?: ZoomPanOptions): this; - setZoom(zoom: number, options?: ZoomPanOptions): this; - zoomIn(delta?: number, options?: ZoomOptions): this; - zoomOut(delta?: number, options?: ZoomOptions): this; - setZoomAround(position: Point | LatLngExpression, zoom: number, options?: ZoomOptions): this; - fitBounds(bounds: LatLngBoundsExpression, options?: FitBoundsOptions): this; - fitWorld(options?: FitBoundsOptions): this; - panTo(latlng: LatLngExpression, options?: PanOptions): this; - panBy(offset: PointExpression): this; - setMaxBounds(bounds: LatLngBoundsExpression): this; - setMinZoom(zoom: number): this; - setMaxZoom(zoom: number): this; - panInside(latLng: LatLngExpression, options?: PanInsideOptions): this; - panInsideBounds(bounds: LatLngBoundsExpression, options?: PanOptions): this; - /** - * Boolean for animate or advanced ZoomPanOptions - */ - invalidateSize(options?: boolean | ZoomPanOptions): this; - stop(): this; - flyTo(latlng: LatLngExpression, zoom?: number, options?: ZoomPanOptions): this; - flyToBounds(bounds: LatLngBoundsExpression, options?: FitBoundsOptions): this; - - // Other methods - addHandler(name: string, HandlerClass: typeof Handler): this; // Alternatively, HandlerClass: new(map: Map) => Handler - remove(): this; - createPane(name: string, container?: HTMLElement): HTMLElement; - /** - * Name of the pane or the pane as HTML-Element - */ - getPane(pane: string | HTMLElement): HTMLElement | undefined; - getPanes(): {[name: string]: HTMLElement} & DefaultMapPanes; - getContainer(): HTMLElement; - whenReady(fn: () => void, context?: any): this; - - // Methods for getting map state - getCenter(): LatLng; - getZoom(): number; - getBounds(): LatLngBounds; - getMinZoom(): number; - getMaxZoom(): number; - getBoundsZoom(bounds: LatLngBoundsExpression, inside?: boolean): number; - getSize(): Point; - getPixelBounds(): Bounds; - getPixelOrigin(): Point; - getPixelWorldBounds(zoom?: number): Bounds; - - // Conversion methods - getZoomScale(toZoom: number, fromZoom: number): number; - getScaleZoom(scale: number, fromZoom: number): number; - project(latlng: LatLngExpression, zoom: number): Point; - unproject(point: PointExpression, zoom: number): LatLng; - layerPointToLatLng(point: PointExpression): LatLng; - latLngToLayerPoint(latlng: LatLngExpression): Point; - wrapLatLng(latlng: LatLngExpression): LatLng; - wrapLatLngBounds(bounds: LatLngBounds): LatLngBounds; - distance(latlng1: LatLngExpression, latlng2: LatLngExpression): number; - containerPointToLayerPoint(point: PointExpression): Point; - containerPointToLatLng(point: PointExpression): LatLng; - layerPointToContainerPoint(point: PointExpression): Point; - latLngToContainerPoint(latlng: LatLngExpression): Point; - mouseEventToContainerPoint(ev: MouseEvent): Point; - mouseEventToLayerPoint(ev: MouseEvent): Point; - mouseEventToLatLng(ev: MouseEvent): LatLng; - - // Geolocation methods - locate(options?: LocateOptions): this; - stopLocate(): this; - - // Properties - boxZoom: Handler; - doubleClickZoom: Handler; - dragging: Handler; - keyboard: Handler; - scrollWheelZoom: Handler; - tap?: Handler; - touchZoom: Handler; - zoomControl: Control.Zoom; - - options: MapOptions; -} - -/** - * ID of a HTML-Element as string or the HTML-ELement itself - */ -export function map(element: string | HTMLElement, options?: MapOptions): Map; - -export interface BaseIconOptions extends LayerOptions { - iconUrl?: string; - iconRetinaUrl?: string; - iconSize?: PointExpression; - iconAnchor?: PointExpression; - popupAnchor?: PointExpression; - tooltipAnchor?: PointExpression; - shadowUrl?: string; - shadowRetinaUrl?: string; - shadowSize?: PointExpression; - shadowAnchor?: PointExpression; - className?: string; -} - -export interface IconOptions extends BaseIconOptions { - iconUrl: string; -} - -export class Icon extends Layer { - constructor(options: T); - createIcon(oldIcon?: HTMLElement): HTMLElement; - createShadow(oldIcon?: HTMLElement): HTMLElement; - - options: T; -} - -export namespace Icon { - interface DefaultIconOptions extends BaseIconOptions { - imagePath?: string; - } - - class Default extends Icon { - static imagePath?: string; - constructor(options?: DefaultIconOptions); - } -} - -export function icon(options: IconOptions): Icon; - -export interface DivIconOptions extends BaseIconOptions { - html?: string | false; - bgPos?: PointExpression; - iconSize?: PointExpression; - iconAnchor?: PointExpression; - popupAnchor?: PointExpression; - className?: string; -} - -export class DivIcon extends Icon { - constructor(options?: DivIconOptions); -} - -export function divIcon(options?: DivIconOptions): DivIcon; - -export interface MarkerOptions extends InteractiveLayerOptions { - icon?: Icon | DivIcon; - clickable?: boolean; - draggable?: boolean; - keyboard?: boolean; - title?: string; - alt?: string; - zIndexOffset?: number; - opacity?: number; - riseOnHover?: boolean; - riseOffset?: number; - autoPan?: boolean; - autoPanSpeed?: number; - autoPanPadding?: PointExpression; -} - -export class Marker

    extends Layer { - constructor(latlng: LatLngExpression, options?: MarkerOptions); - toGeoJSON(): geojson.Feature; - getLatLng(): LatLng; - setLatLng(latlng: LatLngExpression): this; - setZIndexOffset(offset: number): this; - setIcon(icon: Icon | DivIcon): this; - setOpacity(opacity: number): this; - getElement(): HTMLElement | undefined; - - // Properties - options: MarkerOptions; - dragging?: Handler; - feature?: geojson.Feature; -} - -export function marker(latlng: LatLngExpression, options?: MarkerOptions): Marker; - -export namespace Browser { - const ie: boolean; - const ielt9: boolean; - const edge: boolean; - const webkit: boolean; - const gecko: boolean; - const android: boolean; - const android23: boolean; - const chrome: boolean; - const safari: boolean; - const win: boolean; - const ie3d: boolean; - const webkit3d: boolean; - const gecko3d: boolean; - const opera12: boolean; - const any3d: boolean; - const mobile: boolean; - const mobileWebkit: boolean; - const mobileWebkit3d: boolean; - const mobileOpera: boolean; - const mobileGecko: boolean; - const touch: boolean; - const msPointer: boolean; - const pointer: boolean; - const retina: boolean; - const canvas: boolean; - const vml: boolean; - const svg: boolean; -} - -export namespace Util { - function extend(dest: D, src?: S1): D & S1; - function extend(dest: D, src1: S1, src2: S2): D & S1 & S2; - function extend(dest: D, src1: S1, src2: S2, src3: S3): D & S1 & S2 & S3; - function extend(dest: any, ...src: any[]): any; - - function create(proto: object | null, properties?: PropertyDescriptorMap): any; - function bind(fn: () => void, ...obj: any[]): () => void; - function stamp(obj: any): number; - function throttle(fn: () => void, time: number, context: any): () => void; - function wrapNum(num: number, range: number[], includeMax?: boolean): number; - function falseFn(): false; - function formatNum(num: number, digits?: number): number; - function trim(str: string): string; - function splitWords(str: string): string[]; - function setOptions(obj: any, options: any): any; - function getParamString(obj: any, existingUrl?: string, uppercase?: boolean): string; - function template(str: string, data: any): string; - function isArray(obj: any): boolean; - function indexOf(array: any[], el: any): number; - function requestAnimFrame(fn: (timestamp: number) => void, context?: any, immediate?: boolean): number; - function cancelAnimFrame(id: number): void; - - let lastId: number; - let emptyImageUrl: string; -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/@types/leaflet/package.json b/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/@types/leaflet/package.json deleted file mode 100755 index 626f615f8..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/@types/leaflet/package.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "_args": [ - [ - "@types/leaflet@1.4.3", - "/shd/CTC/TOOLS/TDS/TDS-source/Lts/Tools/ArAssetsV2" - ] - ], - "_development": true, - "_from": "@types/leaflet@1.4.3", - "_id": "@types/leaflet@1.4.3", - "_inBundle": false, - "_integrity": "sha512-jFRBSsPHi1EwQSwrN0cOJLdPhwOZsRl4IMxvm/2ShLh0YM5GfCtQXCzsrv8RE7DWL+AykXdYSAd9bFLWbZT4CQ==", - "_location": "/@types/leaflet", - "_phantomChildren": {}, - "_requested": { - "type": "version", - "registry": true, - "raw": "@types/leaflet@1.4.3", - "name": "@types/leaflet", - "escapedName": "@types%2fleaflet", - "scope": "@types", - "rawSpec": "1.4.3", - "saveSpec": null, - "fetchSpec": "1.4.3" - }, - "_requiredBy": [ - "#DEV:/" - ], - "_resolved": "https://registry.npmjs.org/@types/leaflet/-/leaflet-1.4.3.tgz", - "_spec": "1.4.3", - "_where": "/shd/CTC/TOOLS/TDS/TDS-source/Lts/Tools/ArAssetsV2", - "bugs": { - "url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues" - }, - "contributors": [ - { - "name": "Alejandro Sánchez", - "url": "https://github.com/alejo90" - }, - { - "name": "Arne Schubert", - "url": "https://github.com/atd-schubert" - }, - { - "name": "Michael Auer", - "url": "https://github.com/mcauer" - }, - { - "name": "Roni Karilkar", - "url": "https://github.com/ronikar" - } - ], - "dependencies": { - "@types/geojson": "*" - }, - "description": "TypeScript definitions for Leaflet.js", - "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped#readme", - "license": "MIT", - "main": "", - "name": "@types/leaflet", - "repository": { - "type": "git", - "url": "git+https://github.com/DefinitelyTyped/DefinitelyTyped.git" - }, - "scripts": {}, - "typeScriptVersion": "2.3", - "types": "index", - "typesPublisherContentHash": "d6ab1715fa8311f4f2c70d725cb407e3f3c595161e94c7ee85caaeeb496578cc", - "version": "1.4.3" -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/angular/LICENSE.md b/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/angular/LICENSE.md deleted file mode 100755 index 2c395eef1..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/angular/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016 Angular - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/angular/README.md b/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/angular/README.md deleted file mode 100755 index d1bc0eddf..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/angular/README.md +++ /dev/null @@ -1,64 +0,0 @@ -# packaged angular - -This repo is for distribution on `npm` and `bower`. The source for this module is in the -[main AngularJS repo](https://github.com/angular/angular.js). -Please file issues and pull requests against that repo. - -## Install - -You can install this package either with `npm` or with `bower`. - -### npm - -```shell -npm install angular -``` - -Then add a ` -``` - -Or `require('angular')` from your code. - -### bower - -```shell -bower install angular -``` - -Then add a ` -``` - -## Documentation - -Documentation is available on the -[AngularJS docs site](http://docs.angularjs.org/). - -## License - -The MIT License - -Copyright (c) 2010-2015 Google, Inc. http://angularjs.org - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/angular/angular-csp.css b/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/angular/angular-csp.css deleted file mode 100755 index 5e3a079cb..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/angular/angular-csp.css +++ /dev/null @@ -1,25 +0,0 @@ -/* Include this file in your html if you are using the CSP mode. */ - -@charset "UTF-8"; - -[ng\:cloak], -[ng-cloak], -[data-ng-cloak], -[x-ng-cloak], -.ng-cloak, -.x-ng-cloak, -.ng-hide:not(.ng-hide-animate) { - display: none !important; -} - -ng\:form { - display: block; -} - -.ng-animate-shim { - visibility:hidden; -} - -.ng-anchor { - position:absolute; -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/angular/angular.js b/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/angular/angular.js deleted file mode 100755 index 2a008cfbd..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/angular/angular.js +++ /dev/null @@ -1,36429 +0,0 @@ -/** - * @license AngularJS v1.7.7 - * (c) 2010-2018 Google, Inc. http://angularjs.org - * License: MIT - */ -(function(window) {'use strict'; - -/* exported - minErrConfig, - errorHandlingConfig, - isValidObjectMaxDepth -*/ - -var minErrConfig = { - objectMaxDepth: 5, - urlErrorParamsEnabled: true -}; - -/** - * @ngdoc function - * @name angular.errorHandlingConfig - * @module ng - * @kind function - * - * @description - * Configure several aspects of error handling in AngularJS if used as a setter or return the - * current configuration if used as a getter. The following options are supported: - * - * - **objectMaxDepth**: The maximum depth to which objects are traversed when stringified for error messages. - * - * Omitted or undefined options will leave the corresponding configuration values unchanged. - * - * @param {Object=} config - The configuration object. May only contain the options that need to be - * updated. Supported keys: - * - * * `objectMaxDepth` **{Number}** - The max depth for stringifying objects. Setting to a - * non-positive or non-numeric value, removes the max depth limit. - * Default: 5 - * - * * `urlErrorParamsEnabled` **{Boolean}** - Specifies wether the generated error url will - * contain the parameters of the thrown error. Disabling the parameters can be useful if the - * generated error url is very long. - * - * Default: true. When used without argument, it returns the current value. - */ -function errorHandlingConfig(config) { - if (isObject(config)) { - if (isDefined(config.objectMaxDepth)) { - minErrConfig.objectMaxDepth = isValidObjectMaxDepth(config.objectMaxDepth) ? config.objectMaxDepth : NaN; - } - if (isDefined(config.urlErrorParamsEnabled) && isBoolean(config.urlErrorParamsEnabled)) { - minErrConfig.urlErrorParamsEnabled = config.urlErrorParamsEnabled; - } - } else { - return minErrConfig; - } -} - -/** - * @private - * @param {Number} maxDepth - * @return {boolean} - */ -function isValidObjectMaxDepth(maxDepth) { - return isNumber(maxDepth) && maxDepth > 0; -} - - -/** - * @description - * - * This object provides a utility for producing rich Error messages within - * AngularJS. It can be called as follows: - * - * var exampleMinErr = minErr('example'); - * throw exampleMinErr('one', 'This {0} is {1}', foo, bar); - * - * The above creates an instance of minErr in the example namespace. The - * resulting error will have a namespaced error code of example.one. The - * resulting error will replace {0} with the value of foo, and {1} with the - * value of bar. The object is not restricted in the number of arguments it can - * take. - * - * If fewer arguments are specified than necessary for interpolation, the extra - * interpolation markers will be preserved in the final string. - * - * Since data will be parsed statically during a build step, some restrictions - * are applied with respect to how minErr instances are created and called. - * Instances should have names of the form namespaceMinErr for a minErr created - * using minErr('namespace') . Error codes, namespaces and template strings - * should all be static strings, not variables or general expressions. - * - * @param {string} module The namespace to use for the new minErr instance. - * @param {function} ErrorConstructor Custom error constructor to be instantiated when returning - * error from returned function, for cases when a particular type of error is useful. - * @returns {function(code:string, template:string, ...templateArgs): Error} minErr instance - */ - -function minErr(module, ErrorConstructor) { - ErrorConstructor = ErrorConstructor || Error; - - var url = 'https://errors.angularjs.org/1.7.7/'; - var regex = url.replace('.', '\\.') + '[\\s\\S]*'; - var errRegExp = new RegExp(regex, 'g'); - - return function() { - var code = arguments[0], - template = arguments[1], - message = '[' + (module ? module + ':' : '') + code + '] ', - templateArgs = sliceArgs(arguments, 2).map(function(arg) { - return toDebugString(arg, minErrConfig.objectMaxDepth); - }), - paramPrefix, i; - - // A minErr message has two parts: the message itself and the url that contains the - // encoded message. - // The message's parameters can contain other error messages which also include error urls. - // To prevent the messages from getting too long, we strip the error urls from the parameters. - - message += template.replace(/\{\d+\}/g, function(match) { - var index = +match.slice(1, -1); - - if (index < templateArgs.length) { - return templateArgs[index].replace(errRegExp, ''); - } - - return match; - }); - - message += '\n' + url + (module ? module + '/' : '') + code; - - if (minErrConfig.urlErrorParamsEnabled) { - for (i = 0, paramPrefix = '?'; i < templateArgs.length; i++, paramPrefix = '&') { - message += paramPrefix + 'p' + i + '=' + encodeURIComponent(templateArgs[i]); - } - } - - return new ErrorConstructor(message); - }; -} - -/* We need to tell ESLint what variables are being exported */ -/* exported - angular, - msie, - jqLite, - jQuery, - slice, - splice, - push, - toString, - minErrConfig, - errorHandlingConfig, - isValidObjectMaxDepth, - ngMinErr, - angularModule, - uid, - REGEX_STRING_REGEXP, - VALIDITY_STATE_PROPERTY, - - lowercase, - uppercase, - nodeName_, - isArrayLike, - forEach, - forEachSorted, - reverseParams, - nextUid, - setHashKey, - extend, - toInt, - inherit, - merge, - noop, - identity, - valueFn, - isUndefined, - isDefined, - isObject, - isBlankObject, - isString, - isNumber, - isNumberNaN, - isDate, - isError, - isArray, - isFunction, - isRegExp, - isWindow, - isScope, - isFile, - isFormData, - isBlob, - isBoolean, - isPromiseLike, - trim, - escapeForRegexp, - isElement, - makeMap, - includes, - arrayRemove, - copy, - simpleCompare, - equals, - csp, - jq, - concat, - sliceArgs, - bind, - toJsonReplacer, - toJson, - fromJson, - convertTimezoneToLocal, - timezoneToOffset, - addDateMinutes, - startingTag, - tryDecodeURIComponent, - parseKeyValue, - toKeyValue, - encodeUriSegment, - encodeUriQuery, - angularInit, - bootstrap, - getTestability, - snake_case, - bindJQuery, - assertArg, - assertArgFn, - assertNotHasOwnProperty, - getter, - getBlockNodes, - hasOwnProperty, - createMap, - stringify, - - NODE_TYPE_ELEMENT, - NODE_TYPE_ATTRIBUTE, - NODE_TYPE_TEXT, - NODE_TYPE_COMMENT, - NODE_TYPE_DOCUMENT, - NODE_TYPE_DOCUMENT_FRAGMENT -*/ - -//////////////////////////////////// - -/** - * @ngdoc module - * @name ng - * @module ng - * @installation - * @description - * - * The ng module is loaded by default when an AngularJS application is started. The module itself - * contains the essential components for an AngularJS application to function. The table below - * lists a high level breakdown of each of the services/factories, filters, directives and testing - * components available within this core module. - * - */ - -var REGEX_STRING_REGEXP = /^\/(.+)\/([a-z]*)$/; - -// The name of a form control's ValidityState property. -// This is used so that it's possible for internal tests to create mock ValidityStates. -var VALIDITY_STATE_PROPERTY = 'validity'; - - -var hasOwnProperty = Object.prototype.hasOwnProperty; - -/** - * @private - * - * @description Converts the specified string to lowercase. - * @param {string} string String to be converted to lowercase. - * @returns {string} Lowercased string. - */ -var lowercase = function(string) {return isString(string) ? string.toLowerCase() : string;}; - -/** - * @private - * - * @description Converts the specified string to uppercase. - * @param {string} string String to be converted to uppercase. - * @returns {string} Uppercased string. - */ -var uppercase = function(string) {return isString(string) ? string.toUpperCase() : string;}; - - -var - msie, // holds major version number for IE, or NaN if UA is not IE. - jqLite, // delay binding since jQuery could be loaded after us. - jQuery, // delay binding - slice = [].slice, - splice = [].splice, - push = [].push, - toString = Object.prototype.toString, - getPrototypeOf = Object.getPrototypeOf, - ngMinErr = minErr('ng'), - - /** @name angular */ - angular = window.angular || (window.angular = {}), - angularModule, - uid = 0; - -// Support: IE 9-11 only -/** - * documentMode is an IE-only property - * http://msdn.microsoft.com/en-us/library/ie/cc196988(v=vs.85).aspx - */ -msie = window.document.documentMode; - - -/** - * @private - * @param {*} obj - * @return {boolean} Returns true if `obj` is an array or array-like object (NodeList, Arguments, - * String ...) - */ -function isArrayLike(obj) { - - // `null`, `undefined` and `window` are not array-like - if (obj == null || isWindow(obj)) return false; - - // arrays, strings and jQuery/jqLite objects are array like - // * jqLite is either the jQuery or jqLite constructor function - // * we have to check the existence of jqLite first as this method is called - // via the forEach method when constructing the jqLite object in the first place - if (isArray(obj) || isString(obj) || (jqLite && obj instanceof jqLite)) return true; - - // Support: iOS 8.2 (not reproducible in simulator) - // "length" in obj used to prevent JIT error (gh-11508) - var length = 'length' in Object(obj) && obj.length; - - // NodeList objects (with `item` method) and - // other objects with suitable length characteristics are array-like - return isNumber(length) && (length >= 0 && (length - 1) in obj || typeof obj.item === 'function'); - -} - -/** - * @ngdoc function - * @name angular.forEach - * @module ng - * @kind function - * - * @description - * Invokes the `iterator` function once for each item in `obj` collection, which can be either an - * object or an array. The `iterator` function is invoked with `iterator(value, key, obj)`, where `value` - * is the value of an object property or an array element, `key` is the object property key or - * array element index and obj is the `obj` itself. Specifying a `context` for the function is optional. - * - * It is worth noting that `.forEach` does not iterate over inherited properties because it filters - * using the `hasOwnProperty` method. - * - * Unlike ES262's - * [Array.prototype.forEach](http://www.ecma-international.org/ecma-262/5.1/#sec-15.4.4.18), - * providing 'undefined' or 'null' values for `obj` will not throw a TypeError, but rather just - * return the value provided. - * - ```js - var values = {name: 'misko', gender: 'male'}; - var log = []; - angular.forEach(values, function(value, key) { - this.push(key + ': ' + value); - }, log); - expect(log).toEqual(['name: misko', 'gender: male']); - ``` - * - * @param {Object|Array} obj Object to iterate over. - * @param {Function} iterator Iterator function. - * @param {Object=} context Object to become context (`this`) for the iterator function. - * @returns {Object|Array} Reference to `obj`. - */ - -function forEach(obj, iterator, context) { - var key, length; - if (obj) { - if (isFunction(obj)) { - for (key in obj) { - if (key !== 'prototype' && key !== 'length' && key !== 'name' && obj.hasOwnProperty(key)) { - iterator.call(context, obj[key], key, obj); - } - } - } else if (isArray(obj) || isArrayLike(obj)) { - var isPrimitive = typeof obj !== 'object'; - for (key = 0, length = obj.length; key < length; key++) { - if (isPrimitive || key in obj) { - iterator.call(context, obj[key], key, obj); - } - } - } else if (obj.forEach && obj.forEach !== forEach) { - obj.forEach(iterator, context, obj); - } else if (isBlankObject(obj)) { - // createMap() fast path --- Safe to avoid hasOwnProperty check because prototype chain is empty - for (key in obj) { - iterator.call(context, obj[key], key, obj); - } - } else if (typeof obj.hasOwnProperty === 'function') { - // Slow path for objects inheriting Object.prototype, hasOwnProperty check needed - for (key in obj) { - if (obj.hasOwnProperty(key)) { - iterator.call(context, obj[key], key, obj); - } - } - } else { - // Slow path for objects which do not have a method `hasOwnProperty` - for (key in obj) { - if (hasOwnProperty.call(obj, key)) { - iterator.call(context, obj[key], key, obj); - } - } - } - } - return obj; -} - -function forEachSorted(obj, iterator, context) { - var keys = Object.keys(obj).sort(); - for (var i = 0; i < keys.length; i++) { - iterator.call(context, obj[keys[i]], keys[i]); - } - return keys; -} - - -/** - * when using forEach the params are value, key, but it is often useful to have key, value. - * @param {function(string, *)} iteratorFn - * @returns {function(*, string)} - */ -function reverseParams(iteratorFn) { - return function(value, key) {iteratorFn(key, value);}; -} - -/** - * A consistent way of creating unique IDs in angular. - * - * Using simple numbers allows us to generate 28.6 million unique ids per second for 10 years before - * we hit number precision issues in JavaScript. - * - * Math.pow(2,53) / 60 / 60 / 24 / 365 / 10 = 28.6M - * - * @returns {number} an unique alpha-numeric string - */ -function nextUid() { - return ++uid; -} - - -/** - * Set or clear the hashkey for an object. - * @param obj object - * @param h the hashkey (!truthy to delete the hashkey) - */ -function setHashKey(obj, h) { - if (h) { - obj.$$hashKey = h; - } else { - delete obj.$$hashKey; - } -} - - -function baseExtend(dst, objs, deep) { - var h = dst.$$hashKey; - - for (var i = 0, ii = objs.length; i < ii; ++i) { - var obj = objs[i]; - if (!isObject(obj) && !isFunction(obj)) continue; - var keys = Object.keys(obj); - for (var j = 0, jj = keys.length; j < jj; j++) { - var key = keys[j]; - var src = obj[key]; - - if (deep && isObject(src)) { - if (isDate(src)) { - dst[key] = new Date(src.valueOf()); - } else if (isRegExp(src)) { - dst[key] = new RegExp(src); - } else if (src.nodeName) { - dst[key] = src.cloneNode(true); - } else if (isElement(src)) { - dst[key] = src.clone(); - } else { - if (!isObject(dst[key])) dst[key] = isArray(src) ? [] : {}; - baseExtend(dst[key], [src], true); - } - } else { - dst[key] = src; - } - } - } - - setHashKey(dst, h); - return dst; -} - -/** - * @ngdoc function - * @name angular.extend - * @module ng - * @kind function - * - * @description - * Extends the destination object `dst` by copying own enumerable properties from the `src` object(s) - * to `dst`. You can specify multiple `src` objects. If you want to preserve original objects, you can do so - * by passing an empty object as the target: `var object = angular.extend({}, object1, object2)`. - * - * **Note:** Keep in mind that `angular.extend` does not support recursive merge (deep copy). Use - * {@link angular.merge} for this. - * - * @param {Object} dst Destination object. - * @param {...Object} src Source object(s). - * @returns {Object} Reference to `dst`. - */ -function extend(dst) { - return baseExtend(dst, slice.call(arguments, 1), false); -} - - -/** -* @ngdoc function -* @name angular.merge -* @module ng -* @kind function -* -* @description -* Deeply extends the destination object `dst` by copying own enumerable properties from the `src` object(s) -* to `dst`. You can specify multiple `src` objects. If you want to preserve original objects, you can do so -* by passing an empty object as the target: `var object = angular.merge({}, object1, object2)`. -* -* Unlike {@link angular.extend extend()}, `merge()` recursively descends into object properties of source -* objects, performing a deep copy. -* -* @deprecated -* sinceVersion="1.6.5" -* This function is deprecated, but will not be removed in the 1.x lifecycle. -* There are edge cases (see {@link angular.merge#known-issues known issues}) that are not -* supported by this function. We suggest using another, similar library for all-purpose merging, -* such as [lodash's merge()](https://lodash.com/docs/4.17.4#merge). -* -* @knownIssue -* This is a list of (known) object types that are not handled correctly by this function: -* - [`Blob`](https://developer.mozilla.org/docs/Web/API/Blob) -* - [`MediaStream`](https://developer.mozilla.org/docs/Web/API/MediaStream) -* - [`CanvasGradient`](https://developer.mozilla.org/docs/Web/API/CanvasGradient) -* - AngularJS {@link $rootScope.Scope scopes}; -* -* `angular.merge` also does not support merging objects with circular references. -* -* @param {Object} dst Destination object. -* @param {...Object} src Source object(s). -* @returns {Object} Reference to `dst`. -*/ -function merge(dst) { - return baseExtend(dst, slice.call(arguments, 1), true); -} - - - -function toInt(str) { - return parseInt(str, 10); -} - -var isNumberNaN = Number.isNaN || function isNumberNaN(num) { - // eslint-disable-next-line no-self-compare - return num !== num; -}; - - -function inherit(parent, extra) { - return extend(Object.create(parent), extra); -} - -/** - * @ngdoc function - * @name angular.noop - * @module ng - * @kind function - * - * @description - * A function that performs no operations. This function can be useful when writing code in the - * functional style. - ```js - function foo(callback) { - var result = calculateResult(); - (callback || angular.noop)(result); - } - ``` - */ -function noop() {} -noop.$inject = []; - - -/** - * @ngdoc function - * @name angular.identity - * @module ng - * @kind function - * - * @description - * A function that returns its first argument. This function is useful when writing code in the - * functional style. - * - ```js - function transformer(transformationFn, value) { - return (transformationFn || angular.identity)(value); - }; - - // E.g. - function getResult(fn, input) { - return (fn || angular.identity)(input); - }; - - getResult(function(n) { return n * 2; }, 21); // returns 42 - getResult(null, 21); // returns 21 - getResult(undefined, 21); // returns 21 - ``` - * - * @param {*} value to be returned. - * @returns {*} the value passed in. - */ -function identity($) {return $;} -identity.$inject = []; - - -function valueFn(value) {return function valueRef() {return value;};} - -function hasCustomToString(obj) { - return isFunction(obj.toString) && obj.toString !== toString; -} - - -/** - * @ngdoc function - * @name angular.isUndefined - * @module ng - * @kind function - * - * @description - * Determines if a reference is undefined. - * - * @param {*} value Reference to check. - * @returns {boolean} True if `value` is undefined. - */ -function isUndefined(value) {return typeof value === 'undefined';} - - -/** - * @ngdoc function - * @name angular.isDefined - * @module ng - * @kind function - * - * @description - * Determines if a reference is defined. - * - * @param {*} value Reference to check. - * @returns {boolean} True if `value` is defined. - */ -function isDefined(value) {return typeof value !== 'undefined';} - - -/** - * @ngdoc function - * @name angular.isObject - * @module ng - * @kind function - * - * @description - * Determines if a reference is an `Object`. Unlike `typeof` in JavaScript, `null`s are not - * considered to be objects. Note that JavaScript arrays are objects. - * - * @param {*} value Reference to check. - * @returns {boolean} True if `value` is an `Object` but not `null`. - */ -function isObject(value) { - // http://jsperf.com/isobject4 - return value !== null && typeof value === 'object'; -} - - -/** - * Determine if a value is an object with a null prototype - * - * @returns {boolean} True if `value` is an `Object` with a null prototype - */ -function isBlankObject(value) { - return value !== null && typeof value === 'object' && !getPrototypeOf(value); -} - - -/** - * @ngdoc function - * @name angular.isString - * @module ng - * @kind function - * - * @description - * Determines if a reference is a `String`. - * - * @param {*} value Reference to check. - * @returns {boolean} True if `value` is a `String`. - */ -function isString(value) {return typeof value === 'string';} - - -/** - * @ngdoc function - * @name angular.isNumber - * @module ng - * @kind function - * - * @description - * Determines if a reference is a `Number`. - * - * This includes the "special" numbers `NaN`, `+Infinity` and `-Infinity`. - * - * If you wish to exclude these then you can use the native - * [`isFinite'](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/isFinite) - * method. - * - * @param {*} value Reference to check. - * @returns {boolean} True if `value` is a `Number`. - */ -function isNumber(value) {return typeof value === 'number';} - - -/** - * @ngdoc function - * @name angular.isDate - * @module ng - * @kind function - * - * @description - * Determines if a value is a date. - * - * @param {*} value Reference to check. - * @returns {boolean} True if `value` is a `Date`. - */ -function isDate(value) { - return toString.call(value) === '[object Date]'; -} - - -/** - * @ngdoc function - * @name angular.isArray - * @module ng - * @kind function - * - * @description - * Determines if a reference is an `Array`. - * - * @param {*} value Reference to check. - * @returns {boolean} True if `value` is an `Array`. - */ -function isArray(arr) { - return Array.isArray(arr) || arr instanceof Array; -} - -/** - * @description - * Determines if a reference is an `Error`. - * Loosely based on https://www.npmjs.com/package/iserror - * - * @param {*} value Reference to check. - * @returns {boolean} True if `value` is an `Error`. - */ -function isError(value) { - var tag = toString.call(value); - switch (tag) { - case '[object Error]': return true; - case '[object Exception]': return true; - case '[object DOMException]': return true; - default: return value instanceof Error; - } -} - -/** - * @ngdoc function - * @name angular.isFunction - * @module ng - * @kind function - * - * @description - * Determines if a reference is a `Function`. - * - * @param {*} value Reference to check. - * @returns {boolean} True if `value` is a `Function`. - */ -function isFunction(value) {return typeof value === 'function';} - - -/** - * Determines if a value is a regular expression object. - * - * @private - * @param {*} value Reference to check. - * @returns {boolean} True if `value` is a `RegExp`. - */ -function isRegExp(value) { - return toString.call(value) === '[object RegExp]'; -} - - -/** - * Checks if `obj` is a window object. - * - * @private - * @param {*} obj Object to check - * @returns {boolean} True if `obj` is a window obj. - */ -function isWindow(obj) { - return obj && obj.window === obj; -} - - -function isScope(obj) { - return obj && obj.$evalAsync && obj.$watch; -} - - -function isFile(obj) { - return toString.call(obj) === '[object File]'; -} - - -function isFormData(obj) { - return toString.call(obj) === '[object FormData]'; -} - - -function isBlob(obj) { - return toString.call(obj) === '[object Blob]'; -} - - -function isBoolean(value) { - return typeof value === 'boolean'; -} - - -function isPromiseLike(obj) { - return obj && isFunction(obj.then); -} - - -var TYPED_ARRAY_REGEXP = /^\[object (?:Uint8|Uint8Clamped|Uint16|Uint32|Int8|Int16|Int32|Float32|Float64)Array]$/; -function isTypedArray(value) { - return value && isNumber(value.length) && TYPED_ARRAY_REGEXP.test(toString.call(value)); -} - -function isArrayBuffer(obj) { - return toString.call(obj) === '[object ArrayBuffer]'; -} - - -var trim = function(value) { - return isString(value) ? value.trim() : value; -}; - -// Copied from: -// http://docs.closure-library.googlecode.com/git/local_closure_goog_string_string.js.source.html#line1021 -// Prereq: s is a string. -var escapeForRegexp = function(s) { - return s - .replace(/([-()[\]{}+?*.$^|,:#= 0) { - array.splice(index, 1); - } - return index; -} - -/** - * @ngdoc function - * @name angular.copy - * @module ng - * @kind function - * - * @description - * Creates a deep copy of `source`, which should be an object or an array. This functions is used - * internally, mostly in the change-detection code. It is not intended as an all-purpose copy - * function, and has several limitations (see below). - * - * * If no destination is supplied, a copy of the object or array is created. - * * If a destination is provided, all of its elements (for arrays) or properties (for objects) - * are deleted and then all elements/properties from the source are copied to it. - * * If `source` is not an object or array (inc. `null` and `undefined`), `source` is returned. - * * If `source` is identical to `destination` an exception will be thrown. - * - *
    - * - *

    - * Only enumerable properties are taken into account. Non-enumerable properties (both on `source` - * and on `destination`) will be ignored. - *
    - * - *
    - * `angular.copy` does not check if destination and source are of the same type. It's the - * developer's responsibility to make sure they are compatible. - *
    - * - * @knownIssue - * This is a non-exhaustive list of object types / features that are not handled correctly by - * `angular.copy`. Note that since this functions is used by the change detection code, this - * means binding or watching objects of these types (or that include these types) might not work - * correctly. - * - [`File`](https://developer.mozilla.org/docs/Web/API/File) - * - [`Map`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Map) - * - [`ImageData`](https://developer.mozilla.org/docs/Web/API/ImageData) - * - [`MediaStream`](https://developer.mozilla.org/docs/Web/API/MediaStream) - * - [`Set`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Set) - * - [`WeakMap`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/WeakMap) - * - ['getter'](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get)/ - * [`setter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/set)` - * - * @param {*} source The source that will be used to make a copy. Can be any type, including - * primitives, `null`, and `undefined`. - * @param {(Object|Array)=} destination Destination into which the source is copied. If provided, - * must be of the same type as `source`. - * @returns {*} The copy or updated `destination`, if `destination` was specified. - * - * @example - - -
    -
    -
    -
    - Gender: -
    - - -
    -
    form = {{user | json}}
    -
    leader = {{leader | json}}
    -
    -
    - - // Module: copyExample - angular. - module('copyExample', []). - controller('ExampleController', ['$scope', function($scope) { - $scope.leader = {}; - - $scope.reset = function() { - // Example with 1 argument - $scope.user = angular.copy($scope.leader); - }; - - $scope.update = function(user) { - // Example with 2 arguments - angular.copy(user, $scope.leader); - }; - - $scope.reset(); - }]); - -
    - */ -function copy(source, destination, maxDepth) { - var stackSource = []; - var stackDest = []; - maxDepth = isValidObjectMaxDepth(maxDepth) ? maxDepth : NaN; - - if (destination) { - if (isTypedArray(destination) || isArrayBuffer(destination)) { - throw ngMinErr('cpta', 'Can\'t copy! TypedArray destination cannot be mutated.'); - } - if (source === destination) { - throw ngMinErr('cpi', 'Can\'t copy! Source and destination are identical.'); - } - - // Empty the destination object - if (isArray(destination)) { - destination.length = 0; - } else { - forEach(destination, function(value, key) { - if (key !== '$$hashKey') { - delete destination[key]; - } - }); - } - - stackSource.push(source); - stackDest.push(destination); - return copyRecurse(source, destination, maxDepth); - } - - return copyElement(source, maxDepth); - - function copyRecurse(source, destination, maxDepth) { - maxDepth--; - if (maxDepth < 0) { - return '...'; - } - var h = destination.$$hashKey; - var key; - if (isArray(source)) { - for (var i = 0, ii = source.length; i < ii; i++) { - destination.push(copyElement(source[i], maxDepth)); - } - } else if (isBlankObject(source)) { - // createMap() fast path --- Safe to avoid hasOwnProperty check because prototype chain is empty - for (key in source) { - destination[key] = copyElement(source[key], maxDepth); - } - } else if (source && typeof source.hasOwnProperty === 'function') { - // Slow path, which must rely on hasOwnProperty - for (key in source) { - if (source.hasOwnProperty(key)) { - destination[key] = copyElement(source[key], maxDepth); - } - } - } else { - // Slowest path --- hasOwnProperty can't be called as a method - for (key in source) { - if (hasOwnProperty.call(source, key)) { - destination[key] = copyElement(source[key], maxDepth); - } - } - } - setHashKey(destination, h); - return destination; - } - - function copyElement(source, maxDepth) { - // Simple values - if (!isObject(source)) { - return source; - } - - // Already copied values - var index = stackSource.indexOf(source); - if (index !== -1) { - return stackDest[index]; - } - - if (isWindow(source) || isScope(source)) { - throw ngMinErr('cpws', - 'Can\'t copy! Making copies of Window or Scope instances is not supported.'); - } - - var needsRecurse = false; - var destination = copyType(source); - - if (destination === undefined) { - destination = isArray(source) ? [] : Object.create(getPrototypeOf(source)); - needsRecurse = true; - } - - stackSource.push(source); - stackDest.push(destination); - - return needsRecurse - ? copyRecurse(source, destination, maxDepth) - : destination; - } - - function copyType(source) { - switch (toString.call(source)) { - case '[object Int8Array]': - case '[object Int16Array]': - case '[object Int32Array]': - case '[object Float32Array]': - case '[object Float64Array]': - case '[object Uint8Array]': - case '[object Uint8ClampedArray]': - case '[object Uint16Array]': - case '[object Uint32Array]': - return new source.constructor(copyElement(source.buffer), source.byteOffset, source.length); - - case '[object ArrayBuffer]': - // Support: IE10 - if (!source.slice) { - // If we're in this case we know the environment supports ArrayBuffer - /* eslint-disable no-undef */ - var copied = new ArrayBuffer(source.byteLength); - new Uint8Array(copied).set(new Uint8Array(source)); - /* eslint-enable */ - return copied; - } - return source.slice(0); - - case '[object Boolean]': - case '[object Number]': - case '[object String]': - case '[object Date]': - return new source.constructor(source.valueOf()); - - case '[object RegExp]': - var re = new RegExp(source.source, source.toString().match(/[^/]*$/)[0]); - re.lastIndex = source.lastIndex; - return re; - - case '[object Blob]': - return new source.constructor([source], {type: source.type}); - } - - if (isFunction(source.cloneNode)) { - return source.cloneNode(true); - } - } -} - - -// eslint-disable-next-line no-self-compare -function simpleCompare(a, b) { return a === b || (a !== a && b !== b); } - - -/** - * @ngdoc function - * @name angular.equals - * @module ng - * @kind function - * - * @description - * Determines if two objects or two values are equivalent. Supports value types, regular - * expressions, arrays and objects. - * - * Two objects or values are considered equivalent if at least one of the following is true: - * - * * Both objects or values pass `===` comparison. - * * Both objects or values are of the same type and all of their properties are equal by - * comparing them with `angular.equals`. - * * Both values are NaN. (In JavaScript, NaN == NaN => false. But we consider two NaN as equal) - * * Both values represent the same regular expression (In JavaScript, - * /abc/ == /abc/ => false. But we consider two regular expressions as equal when their textual - * representation matches). - * - * During a property comparison, properties of `function` type and properties with names - * that begin with `$` are ignored. - * - * Scope and DOMWindow objects are being compared only by identify (`===`). - * - * @param {*} o1 Object or value to compare. - * @param {*} o2 Object or value to compare. - * @returns {boolean} True if arguments are equal. - * - * @example - - -
    -
    -

    User 1

    - Name: - Age: - -

    User 2

    - Name: - Age: - -
    -
    - -
    - User 1:
    {{user1 | json}}
    - User 2:
    {{user2 | json}}
    - Equal:
    {{result}}
    -
    -
    -
    - - angular.module('equalsExample', []).controller('ExampleController', ['$scope', function($scope) { - $scope.user1 = {}; - $scope.user2 = {}; - $scope.compare = function() { - $scope.result = angular.equals($scope.user1, $scope.user2); - }; - }]); - -
    - */ -function equals(o1, o2) { - if (o1 === o2) return true; - if (o1 === null || o2 === null) return false; - // eslint-disable-next-line no-self-compare - if (o1 !== o1 && o2 !== o2) return true; // NaN === NaN - var t1 = typeof o1, t2 = typeof o2, length, key, keySet; - if (t1 === t2 && t1 === 'object') { - if (isArray(o1)) { - if (!isArray(o2)) return false; - if ((length = o1.length) === o2.length) { - for (key = 0; key < length; key++) { - if (!equals(o1[key], o2[key])) return false; - } - return true; - } - } else if (isDate(o1)) { - if (!isDate(o2)) return false; - return simpleCompare(o1.getTime(), o2.getTime()); - } else if (isRegExp(o1)) { - if (!isRegExp(o2)) return false; - return o1.toString() === o2.toString(); - } else { - if (isScope(o1) || isScope(o2) || isWindow(o1) || isWindow(o2) || - isArray(o2) || isDate(o2) || isRegExp(o2)) return false; - keySet = createMap(); - for (key in o1) { - if (key.charAt(0) === '$' || isFunction(o1[key])) continue; - if (!equals(o1[key], o2[key])) return false; - keySet[key] = true; - } - for (key in o2) { - if (!(key in keySet) && - key.charAt(0) !== '$' && - isDefined(o2[key]) && - !isFunction(o2[key])) return false; - } - return true; - } - } - return false; -} - -var csp = function() { - if (!isDefined(csp.rules)) { - - - var ngCspElement = (window.document.querySelector('[ng-csp]') || - window.document.querySelector('[data-ng-csp]')); - - if (ngCspElement) { - var ngCspAttribute = ngCspElement.getAttribute('ng-csp') || - ngCspElement.getAttribute('data-ng-csp'); - csp.rules = { - noUnsafeEval: !ngCspAttribute || (ngCspAttribute.indexOf('no-unsafe-eval') !== -1), - noInlineStyle: !ngCspAttribute || (ngCspAttribute.indexOf('no-inline-style') !== -1) - }; - } else { - csp.rules = { - noUnsafeEval: noUnsafeEval(), - noInlineStyle: false - }; - } - } - - return csp.rules; - - function noUnsafeEval() { - try { - // eslint-disable-next-line no-new, no-new-func - new Function(''); - return false; - } catch (e) { - return true; - } - } -}; - -/** - * @ngdoc directive - * @module ng - * @name ngJq - * - * @element ANY - * @param {string=} ngJq the name of the library available under `window` - * to be used for angular.element - * @description - * Use this directive to force the angular.element library. This should be - * used to force either jqLite by leaving ng-jq blank or setting the name of - * the jquery variable under window (eg. jQuery). - * - * Since AngularJS looks for this directive when it is loaded (doesn't wait for the - * DOMContentLoaded event), it must be placed on an element that comes before the script - * which loads angular. Also, only the first instance of `ng-jq` will be used and all - * others ignored. - * - * @example - * This example shows how to force jqLite using the `ngJq` directive to the `html` tag. - ```html - - - ... - ... - - ``` - * @example - * This example shows how to use a jQuery based library of a different name. - * The library name must be available at the top most 'window'. - ```html - - - ... - ... - - ``` - */ -var jq = function() { - if (isDefined(jq.name_)) return jq.name_; - var el; - var i, ii = ngAttrPrefixes.length, prefix, name; - for (i = 0; i < ii; ++i) { - prefix = ngAttrPrefixes[i]; - el = window.document.querySelector('[' + prefix.replace(':', '\\:') + 'jq]'); - if (el) { - name = el.getAttribute(prefix + 'jq'); - break; - } - } - - return (jq.name_ = name); -}; - -function concat(array1, array2, index) { - return array1.concat(slice.call(array2, index)); -} - -function sliceArgs(args, startIndex) { - return slice.call(args, startIndex || 0); -} - - -/** - * @ngdoc function - * @name angular.bind - * @module ng - * @kind function - * - * @description - * Returns a function which calls function `fn` bound to `self` (`self` becomes the `this` for - * `fn`). You can supply optional `args` that are prebound to the function. This feature is also - * known as [partial application](http://en.wikipedia.org/wiki/Partial_application), as - * distinguished from [function currying](http://en.wikipedia.org/wiki/Currying#Contrast_with_partial_function_application). - * - * @param {Object} self Context which `fn` should be evaluated in. - * @param {function()} fn Function to be bound. - * @param {...*} args Optional arguments to be prebound to the `fn` function call. - * @returns {function()} Function that wraps the `fn` with all the specified bindings. - */ -function bind(self, fn) { - var curryArgs = arguments.length > 2 ? sliceArgs(arguments, 2) : []; - if (isFunction(fn) && !(fn instanceof RegExp)) { - return curryArgs.length - ? function() { - return arguments.length - ? fn.apply(self, concat(curryArgs, arguments, 0)) - : fn.apply(self, curryArgs); - } - : function() { - return arguments.length - ? fn.apply(self, arguments) - : fn.call(self); - }; - } else { - // In IE, native methods are not functions so they cannot be bound (note: they don't need to be). - return fn; - } -} - - -function toJsonReplacer(key, value) { - var val = value; - - if (typeof key === 'string' && key.charAt(0) === '$' && key.charAt(1) === '$') { - val = undefined; - } else if (isWindow(value)) { - val = '$WINDOW'; - } else if (value && window.document === value) { - val = '$DOCUMENT'; - } else if (isScope(value)) { - val = '$SCOPE'; - } - - return val; -} - - -/** - * @ngdoc function - * @name angular.toJson - * @module ng - * @kind function - * - * @description - * Serializes input into a JSON-formatted string. Properties with leading $$ characters will be - * stripped since AngularJS uses this notation internally. - * - * @param {Object|Array|Date|string|number|boolean} obj Input to be serialized into JSON. - * @param {boolean|number} [pretty=2] If set to true, the JSON output will contain newlines and whitespace. - * If set to an integer, the JSON output will contain that many spaces per indentation. - * @returns {string|undefined} JSON-ified string representing `obj`. - * @knownIssue - * - * The Safari browser throws a `RangeError` instead of returning `null` when it tries to stringify a `Date` - * object with an invalid date value. The only reliable way to prevent this is to monkeypatch the - * `Date.prototype.toJSON` method as follows: - * - * ``` - * var _DatetoJSON = Date.prototype.toJSON; - * Date.prototype.toJSON = function() { - * try { - * return _DatetoJSON.call(this); - * } catch(e) { - * if (e instanceof RangeError) { - * return null; - * } - * throw e; - * } - * }; - * ``` - * - * See https://github.com/angular/angular.js/pull/14221 for more information. - */ -function toJson(obj, pretty) { - if (isUndefined(obj)) return undefined; - if (!isNumber(pretty)) { - pretty = pretty ? 2 : null; - } - return JSON.stringify(obj, toJsonReplacer, pretty); -} - - -/** - * @ngdoc function - * @name angular.fromJson - * @module ng - * @kind function - * - * @description - * Deserializes a JSON string. - * - * @param {string} json JSON string to deserialize. - * @returns {Object|Array|string|number} Deserialized JSON string. - */ -function fromJson(json) { - return isString(json) - ? JSON.parse(json) - : json; -} - - -var ALL_COLONS = /:/g; -function timezoneToOffset(timezone, fallback) { - // Support: IE 9-11 only, Edge 13-15+ - // IE/Edge do not "understand" colon (`:`) in timezone - timezone = timezone.replace(ALL_COLONS, ''); - var requestedTimezoneOffset = Date.parse('Jan 01, 1970 00:00:00 ' + timezone) / 60000; - return isNumberNaN(requestedTimezoneOffset) ? fallback : requestedTimezoneOffset; -} - - -function addDateMinutes(date, minutes) { - date = new Date(date.getTime()); - date.setMinutes(date.getMinutes() + minutes); - return date; -} - - -function convertTimezoneToLocal(date, timezone, reverse) { - reverse = reverse ? -1 : 1; - var dateTimezoneOffset = date.getTimezoneOffset(); - var timezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset); - return addDateMinutes(date, reverse * (timezoneOffset - dateTimezoneOffset)); -} - - -/** - * @returns {string} Returns the string representation of the element. - */ -function startingTag(element) { - element = jqLite(element).clone().empty(); - var elemHtml = jqLite('
    ').append(element).html(); - try { - return element[0].nodeType === NODE_TYPE_TEXT ? lowercase(elemHtml) : - elemHtml. - match(/^(<[^>]+>)/)[1]. - replace(/^<([\w-]+)/, function(match, nodeName) {return '<' + lowercase(nodeName);}); - } catch (e) { - return lowercase(elemHtml); - } - -} - - -///////////////////////////////////////////////// - -/** - * Tries to decode the URI component without throwing an exception. - * - * @private - * @param str value potential URI component to check. - * @returns {boolean} True if `value` can be decoded - * with the decodeURIComponent function. - */ -function tryDecodeURIComponent(value) { - try { - return decodeURIComponent(value); - } catch (e) { - // Ignore any invalid uri component. - } -} - - -/** - * Parses an escaped url query string into key-value pairs. - * @returns {Object.} - */ -function parseKeyValue(/**string*/keyValue) { - var obj = {}; - forEach((keyValue || '').split('&'), function(keyValue) { - var splitPoint, key, val; - if (keyValue) { - key = keyValue = keyValue.replace(/\+/g,'%20'); - splitPoint = keyValue.indexOf('='); - if (splitPoint !== -1) { - key = keyValue.substring(0, splitPoint); - val = keyValue.substring(splitPoint + 1); - } - key = tryDecodeURIComponent(key); - if (isDefined(key)) { - val = isDefined(val) ? tryDecodeURIComponent(val) : true; - if (!hasOwnProperty.call(obj, key)) { - obj[key] = val; - } else if (isArray(obj[key])) { - obj[key].push(val); - } else { - obj[key] = [obj[key],val]; - } - } - } - }); - return obj; -} - -function toKeyValue(obj) { - var parts = []; - forEach(obj, function(value, key) { - if (isArray(value)) { - forEach(value, function(arrayValue) { - parts.push(encodeUriQuery(key, true) + - (arrayValue === true ? '' : '=' + encodeUriQuery(arrayValue, true))); - }); - } else { - parts.push(encodeUriQuery(key, true) + - (value === true ? '' : '=' + encodeUriQuery(value, true))); - } - }); - return parts.length ? parts.join('&') : ''; -} - - -/** - * We need our custom method because encodeURIComponent is too aggressive and doesn't follow - * http://www.ietf.org/rfc/rfc3986.txt with regards to the character set (pchar) allowed in path - * segments: - * segment = *pchar - * pchar = unreserved / pct-encoded / sub-delims / ":" / "@" - * pct-encoded = "%" HEXDIG HEXDIG - * unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" - * sub-delims = "!" / "$" / "&" / "'" / "(" / ")" - * / "*" / "+" / "," / ";" / "=" - */ -function encodeUriSegment(val) { - return encodeUriQuery(val, true). - replace(/%26/gi, '&'). - replace(/%3D/gi, '='). - replace(/%2B/gi, '+'); -} - - -/** - * This method is intended for encoding *key* or *value* parts of query component. We need a custom - * method because encodeURIComponent is too aggressive and encodes stuff that doesn't have to be - * encoded per http://tools.ietf.org/html/rfc3986: - * query = *( pchar / "/" / "?" ) - * pchar = unreserved / pct-encoded / sub-delims / ":" / "@" - * unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" - * pct-encoded = "%" HEXDIG HEXDIG - * sub-delims = "!" / "$" / "&" / "'" / "(" / ")" - * / "*" / "+" / "," / ";" / "=" - */ -function encodeUriQuery(val, pctEncodeSpaces) { - return encodeURIComponent(val). - replace(/%40/gi, '@'). - replace(/%3A/gi, ':'). - replace(/%24/g, '$'). - replace(/%2C/gi, ','). - replace(/%3B/gi, ';'). - replace(/%20/g, (pctEncodeSpaces ? '%20' : '+')); -} - -var ngAttrPrefixes = ['ng-', 'data-ng-', 'ng:', 'x-ng-']; - -function getNgAttribute(element, ngAttr) { - var attr, i, ii = ngAttrPrefixes.length; - for (i = 0; i < ii; ++i) { - attr = ngAttrPrefixes[i] + ngAttr; - if (isString(attr = element.getAttribute(attr))) { - return attr; - } - } - return null; -} - -function allowAutoBootstrap(document) { - var script = document.currentScript; - - if (!script) { - // Support: IE 9-11 only - // IE does not have `document.currentScript` - return true; - } - - // If the `currentScript` property has been clobbered just return false, since this indicates a probable attack - if (!(script instanceof window.HTMLScriptElement || script instanceof window.SVGScriptElement)) { - return false; - } - - var attributes = script.attributes; - var srcs = [attributes.getNamedItem('src'), attributes.getNamedItem('href'), attributes.getNamedItem('xlink:href')]; - - return srcs.every(function(src) { - if (!src) { - return true; - } - if (!src.value) { - return false; - } - - var link = document.createElement('a'); - link.href = src.value; - - if (document.location.origin === link.origin) { - // Same-origin resources are always allowed, even for non-whitelisted schemes. - return true; - } - // Disabled bootstrapping unless angular.js was loaded from a known scheme used on the web. - // This is to prevent angular.js bundled with browser extensions from being used to bypass the - // content security policy in web pages and other browser extensions. - switch (link.protocol) { - case 'http:': - case 'https:': - case 'ftp:': - case 'blob:': - case 'file:': - case 'data:': - return true; - default: - return false; - } - }); -} - -// Cached as it has to run during loading so that document.currentScript is available. -var isAutoBootstrapAllowed = allowAutoBootstrap(window.document); - -/** - * @ngdoc directive - * @name ngApp - * @module ng - * - * @element ANY - * @param {angular.Module} ngApp an optional application - * {@link angular.module module} name to load. - * @param {boolean=} ngStrictDi if this attribute is present on the app element, the injector will be - * created in "strict-di" mode. This means that the application will fail to invoke functions which - * do not use explicit function annotation (and are thus unsuitable for minification), as described - * in {@link guide/di the Dependency Injection guide}, and useful debugging info will assist in - * tracking down the root of these bugs. - * - * @description - * - * Use this directive to **auto-bootstrap** an AngularJS application. The `ngApp` directive - * designates the **root element** of the application and is typically placed near the root element - * of the page - e.g. on the `` or `` tags. - * - * There are a few things to keep in mind when using `ngApp`: - * - only one AngularJS application can be auto-bootstrapped per HTML document. The first `ngApp` - * found in the document will be used to define the root element to auto-bootstrap as an - * application. To run multiple applications in an HTML document you must manually bootstrap them using - * {@link angular.bootstrap} instead. - * - AngularJS applications cannot be nested within each other. - * - Do not use a directive that uses {@link ng.$compile#transclusion transclusion} on the same element as `ngApp`. - * This includes directives such as {@link ng.ngIf `ngIf`}, {@link ng.ngInclude `ngInclude`} and - * {@link ngRoute.ngView `ngView`}. - * Doing this misplaces the app {@link ng.$rootElement `$rootElement`} and the app's {@link auto.$injector injector}, - * causing animations to stop working and making the injector inaccessible from outside the app. - * - * You can specify an **AngularJS module** to be used as the root module for the application. This - * module will be loaded into the {@link auto.$injector} when the application is bootstrapped. It - * should contain the application code needed or have dependencies on other modules that will - * contain the code. See {@link angular.module} for more information. - * - * In the example below if the `ngApp` directive were not placed on the `html` element then the - * document would not be compiled, the `AppController` would not be instantiated and the `{{ a+b }}` - * would not be resolved to `3`. - * - * @example - * - * ### Simple Usage - * - * `ngApp` is the easiest, and most common way to bootstrap an application. - * - - -
    - I can add: {{a}} + {{b}} = {{ a+b }} -
    -
    - - angular.module('ngAppDemo', []).controller('ngAppDemoController', function($scope) { - $scope.a = 1; - $scope.b = 2; - }); - -
    - * - * @example - * - * ### With `ngStrictDi` - * - * Using `ngStrictDi`, you would see something like this: - * - - -
    -
    - I can add: {{a}} + {{b}} = {{ a+b }} - -

    This renders because the controller does not fail to - instantiate, by using explicit annotation style (see - script.js for details) -

    -
    - -
    - Name:
    - Hello, {{name}}! - -

    This renders because the controller does not fail to - instantiate, by using explicit annotation style - (see script.js for details) -

    -
    - -
    - I can add: {{a}} + {{b}} = {{ a+b }} - -

    The controller could not be instantiated, due to relying - on automatic function annotations (which are disabled in - strict mode). As such, the content of this section is not - interpolated, and there should be an error in your web console. -

    -
    -
    -
    - - angular.module('ngAppStrictDemo', []) - // BadController will fail to instantiate, due to relying on automatic function annotation, - // rather than an explicit annotation - .controller('BadController', function($scope) { - $scope.a = 1; - $scope.b = 2; - }) - // Unlike BadController, GoodController1 and GoodController2 will not fail to be instantiated, - // due to using explicit annotations using the array style and $inject property, respectively. - .controller('GoodController1', ['$scope', function($scope) { - $scope.a = 1; - $scope.b = 2; - }]) - .controller('GoodController2', GoodController2); - function GoodController2($scope) { - $scope.name = 'World'; - } - GoodController2.$inject = ['$scope']; - - - div[ng-controller] { - margin-bottom: 1em; - -webkit-border-radius: 4px; - border-radius: 4px; - border: 1px solid; - padding: .5em; - } - div[ng-controller^=Good] { - border-color: #d6e9c6; - background-color: #dff0d8; - color: #3c763d; - } - div[ng-controller^=Bad] { - border-color: #ebccd1; - background-color: #f2dede; - color: #a94442; - margin-bottom: 0; - } - -
    - */ -function angularInit(element, bootstrap) { - var appElement, - module, - config = {}; - - // The element `element` has priority over any other element. - forEach(ngAttrPrefixes, function(prefix) { - var name = prefix + 'app'; - - if (!appElement && element.hasAttribute && element.hasAttribute(name)) { - appElement = element; - module = element.getAttribute(name); - } - }); - forEach(ngAttrPrefixes, function(prefix) { - var name = prefix + 'app'; - var candidate; - - if (!appElement && (candidate = element.querySelector('[' + name.replace(':', '\\:') + ']'))) { - appElement = candidate; - module = candidate.getAttribute(name); - } - }); - if (appElement) { - if (!isAutoBootstrapAllowed) { - window.console.error('AngularJS: disabling automatic bootstrap. - * - * - * - * ``` - * - * @param {DOMElement} element DOM element which is the root of AngularJS application. - * @param {Array=} modules an array of modules to load into the application. - * Each item in the array should be the name of a predefined module or a (DI annotated) - * function that will be invoked by the injector as a `config` block. - * See: {@link angular.module modules} - * @param {Object=} config an object for defining configuration options for the application. The - * following keys are supported: - * - * * `strictDi` - disable automatic function annotation for the application. This is meant to - * assist in finding bugs which break minified code. Defaults to `false`. - * - * @returns {auto.$injector} Returns the newly created injector for this app. - */ -function bootstrap(element, modules, config) { - if (!isObject(config)) config = {}; - var defaultConfig = { - strictDi: false - }; - config = extend(defaultConfig, config); - var doBootstrap = function() { - element = jqLite(element); - - if (element.injector()) { - var tag = (element[0] === window.document) ? 'document' : startingTag(element); - // Encode angle brackets to prevent input from being sanitized to empty string #8683. - throw ngMinErr( - 'btstrpd', - 'App already bootstrapped with this element \'{0}\'', - tag.replace(//,'>')); - } - - modules = modules || []; - modules.unshift(['$provide', function($provide) { - $provide.value('$rootElement', element); - }]); - - if (config.debugInfoEnabled) { - // Pushing so that this overrides `debugInfoEnabled` setting defined in user's `modules`. - modules.push(['$compileProvider', function($compileProvider) { - $compileProvider.debugInfoEnabled(true); - }]); - } - - modules.unshift('ng'); - var injector = createInjector(modules, config.strictDi); - injector.invoke(['$rootScope', '$rootElement', '$compile', '$injector', - function bootstrapApply(scope, element, compile, injector) { - scope.$apply(function() { - element.data('$injector', injector); - compile(element)(scope); - }); - }] - ); - return injector; - }; - - var NG_ENABLE_DEBUG_INFO = /^NG_ENABLE_DEBUG_INFO!/; - var NG_DEFER_BOOTSTRAP = /^NG_DEFER_BOOTSTRAP!/; - - if (window && NG_ENABLE_DEBUG_INFO.test(window.name)) { - config.debugInfoEnabled = true; - window.name = window.name.replace(NG_ENABLE_DEBUG_INFO, ''); - } - - if (window && !NG_DEFER_BOOTSTRAP.test(window.name)) { - return doBootstrap(); - } - - window.name = window.name.replace(NG_DEFER_BOOTSTRAP, ''); - angular.resumeBootstrap = function(extraModules) { - forEach(extraModules, function(module) { - modules.push(module); - }); - return doBootstrap(); - }; - - if (isFunction(angular.resumeDeferredBootstrap)) { - angular.resumeDeferredBootstrap(); - } -} - -/** - * @ngdoc function - * @name angular.reloadWithDebugInfo - * @module ng - * @description - * Use this function to reload the current application with debug information turned on. - * This takes precedence over a call to `$compileProvider.debugInfoEnabled(false)`. - * - * See {@link ng.$compileProvider#debugInfoEnabled} for more. - */ -function reloadWithDebugInfo() { - window.name = 'NG_ENABLE_DEBUG_INFO!' + window.name; - window.location.reload(); -} - -/** - * @name angular.getTestability - * @module ng - * @description - * Get the testability service for the instance of AngularJS on the given - * element. - * @param {DOMElement} element DOM element which is the root of AngularJS application. - */ -function getTestability(rootElement) { - var injector = angular.element(rootElement).injector(); - if (!injector) { - throw ngMinErr('test', - 'no injector found for element argument to getTestability'); - } - return injector.get('$$testability'); -} - -var SNAKE_CASE_REGEXP = /[A-Z]/g; -function snake_case(name, separator) { - separator = separator || '_'; - return name.replace(SNAKE_CASE_REGEXP, function(letter, pos) { - return (pos ? separator : '') + letter.toLowerCase(); - }); -} - -var bindJQueryFired = false; -function bindJQuery() { - var originalCleanData; - - if (bindJQueryFired) { - return; - } - - // bind to jQuery if present; - var jqName = jq(); - jQuery = isUndefined(jqName) ? window.jQuery : // use jQuery (if present) - !jqName ? undefined : // use jqLite - window[jqName]; // use jQuery specified by `ngJq` - - // Use jQuery if it exists with proper functionality, otherwise default to us. - // AngularJS 1.2+ requires jQuery 1.7+ for on()/off() support. - // AngularJS 1.3+ technically requires at least jQuery 2.1+ but it may work with older - // versions. It will not work for sure with jQuery <1.7, though. - if (jQuery && jQuery.fn.on) { - jqLite = jQuery; - extend(jQuery.fn, { - scope: JQLitePrototype.scope, - isolateScope: JQLitePrototype.isolateScope, - controller: /** @type {?} */ (JQLitePrototype).controller, - injector: JQLitePrototype.injector, - inheritedData: JQLitePrototype.inheritedData - }); - } else { - jqLite = JQLite; - } - - // All nodes removed from the DOM via various jqLite/jQuery APIs like .remove() - // are passed through jqLite/jQuery.cleanData. Monkey-patch this method to fire - // the $destroy event on all removed nodes. - originalCleanData = jqLite.cleanData; - jqLite.cleanData = function(elems) { - var events; - for (var i = 0, elem; (elem = elems[i]) != null; i++) { - events = (jqLite._data(elem) || {}).events; - if (events && events.$destroy) { - jqLite(elem).triggerHandler('$destroy'); - } - } - originalCleanData(elems); - }; - - angular.element = jqLite; - - // Prevent double-proxying. - bindJQueryFired = true; -} - -/** - * throw error if the argument is falsy. - */ -function assertArg(arg, name, reason) { - if (!arg) { - throw ngMinErr('areq', 'Argument \'{0}\' is {1}', (name || '?'), (reason || 'required')); - } - return arg; -} - -function assertArgFn(arg, name, acceptArrayAnnotation) { - if (acceptArrayAnnotation && isArray(arg)) { - arg = arg[arg.length - 1]; - } - - assertArg(isFunction(arg), name, 'not a function, got ' + - (arg && typeof arg === 'object' ? arg.constructor.name || 'Object' : typeof arg)); - return arg; -} - -/** - * throw error if the name given is hasOwnProperty - * @param {String} name the name to test - * @param {String} context the context in which the name is used, such as module or directive - */ -function assertNotHasOwnProperty(name, context) { - if (name === 'hasOwnProperty') { - throw ngMinErr('badname', 'hasOwnProperty is not a valid {0} name', context); - } -} - -/** - * Return the value accessible from the object by path. Any undefined traversals are ignored - * @param {Object} obj starting object - * @param {String} path path to traverse - * @param {boolean} [bindFnToScope=true] - * @returns {Object} value as accessible by path - */ -//TODO(misko): this function needs to be removed -function getter(obj, path, bindFnToScope) { - if (!path) return obj; - var keys = path.split('.'); - var key; - var lastInstance = obj; - var len = keys.length; - - for (var i = 0; i < len; i++) { - key = keys[i]; - if (obj) { - obj = (lastInstance = obj)[key]; - } - } - if (!bindFnToScope && isFunction(obj)) { - return bind(lastInstance, obj); - } - return obj; -} - -/** - * Return the DOM siblings between the first and last node in the given array. - * @param {Array} array like object - * @returns {Array} the inputted object or a jqLite collection containing the nodes - */ -function getBlockNodes(nodes) { - // TODO(perf): update `nodes` instead of creating a new object? - var node = nodes[0]; - var endNode = nodes[nodes.length - 1]; - var blockNodes; - - for (var i = 1; node !== endNode && (node = node.nextSibling); i++) { - if (blockNodes || nodes[i] !== node) { - if (!blockNodes) { - blockNodes = jqLite(slice.call(nodes, 0, i)); - } - blockNodes.push(node); - } - } - - return blockNodes || nodes; -} - - -/** - * Creates a new object without a prototype. This object is useful for lookup without having to - * guard against prototypically inherited properties via hasOwnProperty. - * - * Related micro-benchmarks: - * - http://jsperf.com/object-create2 - * - http://jsperf.com/proto-map-lookup/2 - * - http://jsperf.com/for-in-vs-object-keys2 - * - * @returns {Object} - */ -function createMap() { - return Object.create(null); -} - -function stringify(value) { - if (value == null) { // null || undefined - return ''; - } - switch (typeof value) { - case 'string': - break; - case 'number': - value = '' + value; - break; - default: - if (hasCustomToString(value) && !isArray(value) && !isDate(value)) { - value = value.toString(); - } else { - value = toJson(value); - } - } - - return value; -} - -var NODE_TYPE_ELEMENT = 1; -var NODE_TYPE_ATTRIBUTE = 2; -var NODE_TYPE_TEXT = 3; -var NODE_TYPE_COMMENT = 8; -var NODE_TYPE_DOCUMENT = 9; -var NODE_TYPE_DOCUMENT_FRAGMENT = 11; - -/** - * @ngdoc type - * @name angular.Module - * @module ng - * @description - * - * Interface for configuring AngularJS {@link angular.module modules}. - */ - -function setupModuleLoader(window) { - - var $injectorMinErr = minErr('$injector'); - var ngMinErr = minErr('ng'); - - function ensure(obj, name, factory) { - return obj[name] || (obj[name] = factory()); - } - - var angular = ensure(window, 'angular', Object); - - // We need to expose `angular.$$minErr` to modules such as `ngResource` that reference it during bootstrap - angular.$$minErr = angular.$$minErr || minErr; - - return ensure(angular, 'module', function() { - /** @type {Object.} */ - var modules = {}; - - /** - * @ngdoc function - * @name angular.module - * @module ng - * @description - * - * The `angular.module` is a global place for creating, registering and retrieving AngularJS - * modules. - * All modules (AngularJS core or 3rd party) that should be available to an application must be - * registered using this mechanism. - * - * Passing one argument retrieves an existing {@link angular.Module}, - * whereas passing more than one argument creates a new {@link angular.Module} - * - * - * # Module - * - * A module is a collection of services, directives, controllers, filters, and configuration information. - * `angular.module` is used to configure the {@link auto.$injector $injector}. - * - * ```js - * // Create a new module - * var myModule = angular.module('myModule', []); - * - * // register a new service - * myModule.value('appName', 'MyCoolApp'); - * - * // configure existing services inside initialization blocks. - * myModule.config(['$locationProvider', function($locationProvider) { - * // Configure existing providers - * $locationProvider.hashPrefix('!'); - * }]); - * ``` - * - * Then you can create an injector and load your modules like this: - * - * ```js - * var injector = angular.injector(['ng', 'myModule']) - * ``` - * - * However it's more likely that you'll just use - * {@link ng.directive:ngApp ngApp} or - * {@link angular.bootstrap} to simplify this process for you. - * - * @param {!string} name The name of the module to create or retrieve. - * @param {!Array.=} requires If specified then new module is being created. If - * unspecified then the module is being retrieved for further configuration. - * @param {Function=} configFn Optional configuration function for the module. Same as - * {@link angular.Module#config Module#config()}. - * @returns {angular.Module} new module with the {@link angular.Module} api. - */ - return function module(name, requires, configFn) { - - var info = {}; - - var assertNotHasOwnProperty = function(name, context) { - if (name === 'hasOwnProperty') { - throw ngMinErr('badname', 'hasOwnProperty is not a valid {0} name', context); - } - }; - - assertNotHasOwnProperty(name, 'module'); - if (requires && modules.hasOwnProperty(name)) { - modules[name] = null; - } - return ensure(modules, name, function() { - if (!requires) { - throw $injectorMinErr('nomod', 'Module \'{0}\' is not available! You either misspelled ' + - 'the module name or forgot to load it. If registering a module ensure that you ' + - 'specify the dependencies as the second argument.', name); - } - - /** @type {!Array.>} */ - var invokeQueue = []; - - /** @type {!Array.} */ - var configBlocks = []; - - /** @type {!Array.} */ - var runBlocks = []; - - var config = invokeLater('$injector', 'invoke', 'push', configBlocks); - - /** @type {angular.Module} */ - var moduleInstance = { - // Private state - _invokeQueue: invokeQueue, - _configBlocks: configBlocks, - _runBlocks: runBlocks, - - /** - * @ngdoc method - * @name angular.Module#info - * @module ng - * - * @param {Object=} info Information about the module - * @returns {Object|Module} The current info object for this module if called as a getter, - * or `this` if called as a setter. - * - * @description - * Read and write custom information about this module. - * For example you could put the version of the module in here. - * - * ```js - * angular.module('myModule', []).info({ version: '1.0.0' }); - * ``` - * - * The version could then be read back out by accessing the module elsewhere: - * - * ``` - * var version = angular.module('myModule').info().version; - * ``` - * - * You can also retrieve this information during runtime via the - * {@link $injector#modules `$injector.modules`} property: - * - * ```js - * var version = $injector.modules['myModule'].info().version; - * ``` - */ - info: function(value) { - if (isDefined(value)) { - if (!isObject(value)) throw ngMinErr('aobj', 'Argument \'{0}\' must be an object', 'value'); - info = value; - return this; - } - return info; - }, - - /** - * @ngdoc property - * @name angular.Module#requires - * @module ng - * - * @description - * Holds the list of modules which the injector will load before the current module is - * loaded. - */ - requires: requires, - - /** - * @ngdoc property - * @name angular.Module#name - * @module ng - * - * @description - * Name of the module. - */ - name: name, - - - /** - * @ngdoc method - * @name angular.Module#provider - * @module ng - * @param {string} name service name - * @param {Function} providerType Construction function for creating new instance of the - * service. - * @description - * See {@link auto.$provide#provider $provide.provider()}. - */ - provider: invokeLaterAndSetModuleName('$provide', 'provider'), - - /** - * @ngdoc method - * @name angular.Module#factory - * @module ng - * @param {string} name service name - * @param {Function} providerFunction Function for creating new instance of the service. - * @description - * See {@link auto.$provide#factory $provide.factory()}. - */ - factory: invokeLaterAndSetModuleName('$provide', 'factory'), - - /** - * @ngdoc method - * @name angular.Module#service - * @module ng - * @param {string} name service name - * @param {Function} constructor A constructor function that will be instantiated. - * @description - * See {@link auto.$provide#service $provide.service()}. - */ - service: invokeLaterAndSetModuleName('$provide', 'service'), - - /** - * @ngdoc method - * @name angular.Module#value - * @module ng - * @param {string} name service name - * @param {*} object Service instance object. - * @description - * See {@link auto.$provide#value $provide.value()}. - */ - value: invokeLater('$provide', 'value'), - - /** - * @ngdoc method - * @name angular.Module#constant - * @module ng - * @param {string} name constant name - * @param {*} object Constant value. - * @description - * Because the constants are fixed, they get applied before other provide methods. - * See {@link auto.$provide#constant $provide.constant()}. - */ - constant: invokeLater('$provide', 'constant', 'unshift'), - - /** - * @ngdoc method - * @name angular.Module#decorator - * @module ng - * @param {string} name The name of the service to decorate. - * @param {Function} decorFn This function will be invoked when the service needs to be - * instantiated and should return the decorated service instance. - * @description - * See {@link auto.$provide#decorator $provide.decorator()}. - */ - decorator: invokeLaterAndSetModuleName('$provide', 'decorator', configBlocks), - - /** - * @ngdoc method - * @name angular.Module#animation - * @module ng - * @param {string} name animation name - * @param {Function} animationFactory Factory function for creating new instance of an - * animation. - * @description - * - * **NOTE**: animations take effect only if the **ngAnimate** module is loaded. - * - * - * Defines an animation hook that can be later used with - * {@link $animate $animate} service and directives that use this service. - * - * ```js - * module.animation('.animation-name', function($inject1, $inject2) { - * return { - * eventName : function(element, done) { - * //code to run the animation - * //once complete, then run done() - * return function cancellationFunction(element) { - * //code to cancel the animation - * } - * } - * } - * }) - * ``` - * - * See {@link ng.$animateProvider#register $animateProvider.register()} and - * {@link ngAnimate ngAnimate module} for more information. - */ - animation: invokeLaterAndSetModuleName('$animateProvider', 'register'), - - /** - * @ngdoc method - * @name angular.Module#filter - * @module ng - * @param {string} name Filter name - this must be a valid AngularJS expression identifier - * @param {Function} filterFactory Factory function for creating new instance of filter. - * @description - * See {@link ng.$filterProvider#register $filterProvider.register()}. - * - *
    - * **Note:** Filter names must be valid AngularJS {@link expression} identifiers, such as `uppercase` or `orderBy`. - * Names with special characters, such as hyphens and dots, are not allowed. If you wish to namespace - * your filters, then you can use capitalization (`myappSubsectionFilterx`) or underscores - * (`myapp_subsection_filterx`). - *
    - */ - filter: invokeLaterAndSetModuleName('$filterProvider', 'register'), - - /** - * @ngdoc method - * @name angular.Module#controller - * @module ng - * @param {string|Object} name Controller name, or an object map of controllers where the - * keys are the names and the values are the constructors. - * @param {Function} constructor Controller constructor function. - * @description - * See {@link ng.$controllerProvider#register $controllerProvider.register()}. - */ - controller: invokeLaterAndSetModuleName('$controllerProvider', 'register'), - - /** - * @ngdoc method - * @name angular.Module#directive - * @module ng - * @param {string|Object} name Directive name, or an object map of directives where the - * keys are the names and the values are the factories. - * @param {Function} directiveFactory Factory function for creating new instance of - * directives. - * @description - * See {@link ng.$compileProvider#directive $compileProvider.directive()}. - */ - directive: invokeLaterAndSetModuleName('$compileProvider', 'directive'), - - /** - * @ngdoc method - * @name angular.Module#component - * @module ng - * @param {string|Object} name Name of the component in camelCase (i.e. `myComp` which will match ``), - * or an object map of components where the keys are the names and the values are the component definition objects. - * @param {Object} options Component definition object (a simplified - * {@link ng.$compile#directive-definition-object directive definition object}) - * - * @description - * See {@link ng.$compileProvider#component $compileProvider.component()}. - */ - component: invokeLaterAndSetModuleName('$compileProvider', 'component'), - - /** - * @ngdoc method - * @name angular.Module#config - * @module ng - * @param {Function} configFn Execute this function on module load. Useful for service - * configuration. - * @description - * Use this method to configure services by injecting their - * {@link angular.Module#provider `providers`}, e.g. for adding routes to the - * {@link ngRoute.$routeProvider $routeProvider}. - * - * Note that you can only inject {@link angular.Module#provider `providers`} and - * {@link angular.Module#constant `constants`} into this function. - * - * For more about how to configure services, see - * {@link providers#provider-recipe Provider Recipe}. - */ - config: config, - - /** - * @ngdoc method - * @name angular.Module#run - * @module ng - * @param {Function} initializationFn Execute this function after injector creation. - * Useful for application initialization. - * @description - * Use this method to register work which should be performed when the injector is done - * loading all modules. - */ - run: function(block) { - runBlocks.push(block); - return this; - } - }; - - if (configFn) { - config(configFn); - } - - return moduleInstance; - - /** - * @param {string} provider - * @param {string} method - * @param {String=} insertMethod - * @returns {angular.Module} - */ - function invokeLater(provider, method, insertMethod, queue) { - if (!queue) queue = invokeQueue; - return function() { - queue[insertMethod || 'push']([provider, method, arguments]); - return moduleInstance; - }; - } - - /** - * @param {string} provider - * @param {string} method - * @returns {angular.Module} - */ - function invokeLaterAndSetModuleName(provider, method, queue) { - if (!queue) queue = invokeQueue; - return function(recipeName, factoryFunction) { - if (factoryFunction && isFunction(factoryFunction)) factoryFunction.$$moduleName = name; - queue.push([provider, method, arguments]); - return moduleInstance; - }; - } - }); - }; - }); - -} - -/* global shallowCopy: true */ - -/** - * Creates a shallow copy of an object, an array or a primitive. - * - * Assumes that there are no proto properties for objects. - */ -function shallowCopy(src, dst) { - if (isArray(src)) { - dst = dst || []; - - for (var i = 0, ii = src.length; i < ii; i++) { - dst[i] = src[i]; - } - } else if (isObject(src)) { - dst = dst || {}; - - for (var key in src) { - if (!(key.charAt(0) === '$' && key.charAt(1) === '$')) { - dst[key] = src[key]; - } - } - } - - return dst || src; -} - -/* exported toDebugString */ - -function serializeObject(obj, maxDepth) { - var seen = []; - - // There is no direct way to stringify object until reaching a specific depth - // and a very deep object can cause a performance issue, so we copy the object - // based on this specific depth and then stringify it. - if (isValidObjectMaxDepth(maxDepth)) { - // This file is also included in `angular-loader`, so `copy()` might not always be available in - // the closure. Therefore, it is lazily retrieved as `angular.copy()` when needed. - obj = angular.copy(obj, null, maxDepth); - } - return JSON.stringify(obj, function(key, val) { - val = toJsonReplacer(key, val); - if (isObject(val)) { - - if (seen.indexOf(val) >= 0) return '...'; - - seen.push(val); - } - return val; - }); -} - -function toDebugString(obj, maxDepth) { - if (typeof obj === 'function') { - return obj.toString().replace(/ \{[\s\S]*$/, ''); - } else if (isUndefined(obj)) { - return 'undefined'; - } else if (typeof obj !== 'string') { - return serializeObject(obj, maxDepth); - } - return obj; -} - -/* global angularModule: true, - version: true, - - $CompileProvider, - - htmlAnchorDirective, - inputDirective, - hiddenInputBrowserCacheDirective, - formDirective, - scriptDirective, - selectDirective, - optionDirective, - ngBindDirective, - ngBindHtmlDirective, - ngBindTemplateDirective, - ngClassDirective, - ngClassEvenDirective, - ngClassOddDirective, - ngCloakDirective, - ngControllerDirective, - ngFormDirective, - ngHideDirective, - ngIfDirective, - ngIncludeDirective, - ngIncludeFillContentDirective, - ngInitDirective, - ngNonBindableDirective, - ngPluralizeDirective, - ngRefDirective, - ngRepeatDirective, - ngShowDirective, - ngStyleDirective, - ngSwitchDirective, - ngSwitchWhenDirective, - ngSwitchDefaultDirective, - ngOptionsDirective, - ngTranscludeDirective, - ngModelDirective, - ngListDirective, - ngChangeDirective, - patternDirective, - patternDirective, - requiredDirective, - requiredDirective, - minlengthDirective, - minlengthDirective, - maxlengthDirective, - maxlengthDirective, - ngValueDirective, - ngModelOptionsDirective, - ngAttributeAliasDirectives, - ngEventDirectives, - - $AnchorScrollProvider, - $AnimateProvider, - $CoreAnimateCssProvider, - $$CoreAnimateJsProvider, - $$CoreAnimateQueueProvider, - $$AnimateRunnerFactoryProvider, - $$AnimateAsyncRunFactoryProvider, - $BrowserProvider, - $CacheFactoryProvider, - $ControllerProvider, - $DateProvider, - $DocumentProvider, - $$IsDocumentHiddenProvider, - $ExceptionHandlerProvider, - $FilterProvider, - $$ForceReflowProvider, - $InterpolateProvider, - $$IntervalFactoryProvider, - $IntervalProvider, - $HttpProvider, - $HttpParamSerializerProvider, - $HttpParamSerializerJQLikeProvider, - $HttpBackendProvider, - $xhrFactoryProvider, - $jsonpCallbacksProvider, - $LocationProvider, - $LogProvider, - $$MapProvider, - $ParseProvider, - $RootScopeProvider, - $QProvider, - $$QProvider, - $$SanitizeUriProvider, - $SceProvider, - $SceDelegateProvider, - $SnifferProvider, - $$TaskTrackerFactoryProvider, - $TemplateCacheProvider, - $TemplateRequestProvider, - $$TestabilityProvider, - $TimeoutProvider, - $$RAFProvider, - $WindowProvider, - $$jqLiteProvider, - $$CookieReaderProvider -*/ - - -/** - * @ngdoc object - * @name angular.version - * @module ng - * @description - * An object that contains information about the current AngularJS version. - * - * This object has the following properties: - * - * - `full` – `{string}` – Full version string, such as "0.9.18". - * - `major` – `{number}` – Major version number, such as "0". - * - `minor` – `{number}` – Minor version number, such as "9". - * - `dot` – `{number}` – Dot version number, such as "18". - * - `codeName` – `{string}` – Code name of the release, such as "jiggling-armfat". - */ -var version = { - // These placeholder strings will be replaced by grunt's `build` task. - // They need to be double- or single-quoted. - full: '1.7.7', - major: 1, - minor: 7, - dot: 7, - codeName: 'kingly-exiting' -}; - - -function publishExternalAPI(angular) { - extend(angular, { - 'errorHandlingConfig': errorHandlingConfig, - 'bootstrap': bootstrap, - 'copy': copy, - 'extend': extend, - 'merge': merge, - 'equals': equals, - 'element': jqLite, - 'forEach': forEach, - 'injector': createInjector, - 'noop': noop, - 'bind': bind, - 'toJson': toJson, - 'fromJson': fromJson, - 'identity': identity, - 'isUndefined': isUndefined, - 'isDefined': isDefined, - 'isString': isString, - 'isFunction': isFunction, - 'isObject': isObject, - 'isNumber': isNumber, - 'isElement': isElement, - 'isArray': isArray, - 'version': version, - 'isDate': isDate, - 'callbacks': {$$counter: 0}, - 'getTestability': getTestability, - 'reloadWithDebugInfo': reloadWithDebugInfo, - '$$minErr': minErr, - '$$csp': csp, - '$$encodeUriSegment': encodeUriSegment, - '$$encodeUriQuery': encodeUriQuery, - '$$lowercase': lowercase, - '$$stringify': stringify, - '$$uppercase': uppercase - }); - - angularModule = setupModuleLoader(window); - - angularModule('ng', ['ngLocale'], ['$provide', - function ngModule($provide) { - // $$sanitizeUriProvider needs to be before $compileProvider as it is used by it. - $provide.provider({ - $$sanitizeUri: $$SanitizeUriProvider - }); - $provide.provider('$compile', $CompileProvider). - directive({ - a: htmlAnchorDirective, - input: inputDirective, - textarea: inputDirective, - form: formDirective, - script: scriptDirective, - select: selectDirective, - option: optionDirective, - ngBind: ngBindDirective, - ngBindHtml: ngBindHtmlDirective, - ngBindTemplate: ngBindTemplateDirective, - ngClass: ngClassDirective, - ngClassEven: ngClassEvenDirective, - ngClassOdd: ngClassOddDirective, - ngCloak: ngCloakDirective, - ngController: ngControllerDirective, - ngForm: ngFormDirective, - ngHide: ngHideDirective, - ngIf: ngIfDirective, - ngInclude: ngIncludeDirective, - ngInit: ngInitDirective, - ngNonBindable: ngNonBindableDirective, - ngPluralize: ngPluralizeDirective, - ngRef: ngRefDirective, - ngRepeat: ngRepeatDirective, - ngShow: ngShowDirective, - ngStyle: ngStyleDirective, - ngSwitch: ngSwitchDirective, - ngSwitchWhen: ngSwitchWhenDirective, - ngSwitchDefault: ngSwitchDefaultDirective, - ngOptions: ngOptionsDirective, - ngTransclude: ngTranscludeDirective, - ngModel: ngModelDirective, - ngList: ngListDirective, - ngChange: ngChangeDirective, - pattern: patternDirective, - ngPattern: patternDirective, - required: requiredDirective, - ngRequired: requiredDirective, - minlength: minlengthDirective, - ngMinlength: minlengthDirective, - maxlength: maxlengthDirective, - ngMaxlength: maxlengthDirective, - ngValue: ngValueDirective, - ngModelOptions: ngModelOptionsDirective - }). - directive({ - ngInclude: ngIncludeFillContentDirective, - input: hiddenInputBrowserCacheDirective - }). - directive(ngAttributeAliasDirectives). - directive(ngEventDirectives); - $provide.provider({ - $anchorScroll: $AnchorScrollProvider, - $animate: $AnimateProvider, - $animateCss: $CoreAnimateCssProvider, - $$animateJs: $$CoreAnimateJsProvider, - $$animateQueue: $$CoreAnimateQueueProvider, - $$AnimateRunner: $$AnimateRunnerFactoryProvider, - $$animateAsyncRun: $$AnimateAsyncRunFactoryProvider, - $browser: $BrowserProvider, - $cacheFactory: $CacheFactoryProvider, - $controller: $ControllerProvider, - $document: $DocumentProvider, - $$isDocumentHidden: $$IsDocumentHiddenProvider, - $exceptionHandler: $ExceptionHandlerProvider, - $filter: $FilterProvider, - $$forceReflow: $$ForceReflowProvider, - $interpolate: $InterpolateProvider, - $interval: $IntervalProvider, - $$intervalFactory: $$IntervalFactoryProvider, - $http: $HttpProvider, - $httpParamSerializer: $HttpParamSerializerProvider, - $httpParamSerializerJQLike: $HttpParamSerializerJQLikeProvider, - $httpBackend: $HttpBackendProvider, - $xhrFactory: $xhrFactoryProvider, - $jsonpCallbacks: $jsonpCallbacksProvider, - $location: $LocationProvider, - $log: $LogProvider, - $parse: $ParseProvider, - $rootScope: $RootScopeProvider, - $q: $QProvider, - $$q: $$QProvider, - $sce: $SceProvider, - $sceDelegate: $SceDelegateProvider, - $sniffer: $SnifferProvider, - $$taskTrackerFactory: $$TaskTrackerFactoryProvider, - $templateCache: $TemplateCacheProvider, - $templateRequest: $TemplateRequestProvider, - $$testability: $$TestabilityProvider, - $timeout: $TimeoutProvider, - $window: $WindowProvider, - $$rAF: $$RAFProvider, - $$jqLite: $$jqLiteProvider, - $$Map: $$MapProvider, - $$cookieReader: $$CookieReaderProvider - }); - } - ]) - .info({ angularVersion: '1.7.7' }); -} - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Any commits to this file should be reviewed with security in mind. * - * Changes to this file can potentially create security vulnerabilities. * - * An approval from 2 Core members with history of modifying * - * this file is required. * - * * - * Does the change somehow allow for arbitrary javascript to be executed? * - * Or allows for someone to change the prototype of built-in objects? * - * Or gives undesired access to variables likes document or window? * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* global - JQLitePrototype: true, - BOOLEAN_ATTR: true, - ALIASED_ATTR: true -*/ - -////////////////////////////////// -//JQLite -////////////////////////////////// - -/** - * @ngdoc function - * @name angular.element - * @module ng - * @kind function - * - * @description - * Wraps a raw DOM element or HTML string as a [jQuery](http://jquery.com) element. - * - * If jQuery is available, `angular.element` is an alias for the - * [jQuery](http://api.jquery.com/jQuery/) function. If jQuery is not available, `angular.element` - * delegates to AngularJS's built-in subset of jQuery, called "jQuery lite" or **jqLite**. - * - * jqLite is a tiny, API-compatible subset of jQuery that allows - * AngularJS to manipulate the DOM in a cross-browser compatible way. jqLite implements only the most - * commonly needed functionality with the goal of having a very small footprint. - * - * To use `jQuery`, simply ensure it is loaded before the `angular.js` file. You can also use the - * {@link ngJq `ngJq`} directive to specify that jqlite should be used over jQuery, or to use a - * specific version of jQuery if multiple versions exist on the page. - * - *
    **Note:** All element references in AngularJS are always wrapped with jQuery or - * jqLite (such as the element argument in a directive's compile / link function). They are never raw DOM references.
    - * - *
    **Note:** Keep in mind that this function will not find elements - * by tag name / CSS selector. For lookups by tag name, try instead `angular.element(document).find(...)` - * or `$document.find()`, or use the standard DOM APIs, e.g. `document.querySelectorAll()`.
    - * - * ## AngularJS's jqLite - * jqLite provides only the following jQuery methods: - * - * - [`addClass()`](http://api.jquery.com/addClass/) - Does not support a function as first argument - * - [`after()`](http://api.jquery.com/after/) - * - [`append()`](http://api.jquery.com/append/) - Contrary to jQuery, this doesn't clone elements - * so will not work correctly when invoked on a jqLite object containing more than one DOM node - * - [`attr()`](http://api.jquery.com/attr/) - Does not support functions as parameters - * - [`bind()`](http://api.jquery.com/bind/) (_deprecated_, use [`on()`](http://api.jquery.com/on/)) - Does not support namespaces, selectors or eventData - * - [`children()`](http://api.jquery.com/children/) - Does not support selectors - * - [`clone()`](http://api.jquery.com/clone/) - * - [`contents()`](http://api.jquery.com/contents/) - * - [`css()`](http://api.jquery.com/css/) - Only retrieves inline-styles, does not call `getComputedStyle()`. - * As a setter, does not convert numbers to strings or append 'px', and also does not have automatic property prefixing. - * - [`data()`](http://api.jquery.com/data/) - * - [`detach()`](http://api.jquery.com/detach/) - * - [`empty()`](http://api.jquery.com/empty/) - * - [`eq()`](http://api.jquery.com/eq/) - * - [`find()`](http://api.jquery.com/find/) - Limited to lookups by tag name - * - [`hasClass()`](http://api.jquery.com/hasClass/) - * - [`html()`](http://api.jquery.com/html/) - * - [`next()`](http://api.jquery.com/next/) - Does not support selectors - * - [`on()`](http://api.jquery.com/on/) - Does not support namespaces, selectors or eventData - * - [`off()`](http://api.jquery.com/off/) - Does not support namespaces, selectors or event object as parameter - * - [`one()`](http://api.jquery.com/one/) - Does not support namespaces or selectors - * - [`parent()`](http://api.jquery.com/parent/) - Does not support selectors - * - [`prepend()`](http://api.jquery.com/prepend/) - * - [`prop()`](http://api.jquery.com/prop/) - * - [`ready()`](http://api.jquery.com/ready/) (_deprecated_, use `angular.element(callback)` instead of `angular.element(document).ready(callback)`) - * - [`remove()`](http://api.jquery.com/remove/) - * - [`removeAttr()`](http://api.jquery.com/removeAttr/) - Does not support multiple attributes - * - [`removeClass()`](http://api.jquery.com/removeClass/) - Does not support a function as first argument - * - [`removeData()`](http://api.jquery.com/removeData/) - * - [`replaceWith()`](http://api.jquery.com/replaceWith/) - * - [`text()`](http://api.jquery.com/text/) - * - [`toggleClass()`](http://api.jquery.com/toggleClass/) - Does not support a function as first argument - * - [`triggerHandler()`](http://api.jquery.com/triggerHandler/) - Passes a dummy event object to handlers - * - [`unbind()`](http://api.jquery.com/unbind/) (_deprecated_, use [`off()`](http://api.jquery.com/off/)) - Does not support namespaces or event object as parameter - * - [`val()`](http://api.jquery.com/val/) - * - [`wrap()`](http://api.jquery.com/wrap/) - * - * ## jQuery/jqLite Extras - * AngularJS also provides the following additional methods and events to both jQuery and jqLite: - * - * ### Events - * - `$destroy` - AngularJS intercepts all jqLite/jQuery's DOM destruction apis and fires this event - * on all DOM nodes being removed. This can be used to clean up any 3rd party bindings to the DOM - * element before it is removed. - * - * ### Methods - * - `controller(name)` - retrieves the controller of the current element or its parent. By default - * retrieves controller associated with the `ngController` directive. If `name` is provided as - * camelCase directive name, then the controller for this directive will be retrieved (e.g. - * `'ngModel'`). - * - `injector()` - retrieves the injector of the current element or its parent. - * - `scope()` - retrieves the {@link ng.$rootScope.Scope scope} of the current - * element or its parent. Requires {@link guide/production#disabling-debug-data Debug Data} to - * be enabled. - * - `isolateScope()` - retrieves an isolate {@link ng.$rootScope.Scope scope} if one is attached directly to the - * current element. This getter should be used only on elements that contain a directive which starts a new isolate - * scope. Calling `scope()` on this element always returns the original non-isolate scope. - * Requires {@link guide/production#disabling-debug-data Debug Data} to be enabled. - * - `inheritedData()` - same as `data()`, but walks up the DOM until a value is found or the top - * parent element is reached. - * - * @knownIssue You cannot spy on `angular.element` if you are using Jasmine version 1.x. See - * https://github.com/angular/angular.js/issues/14251 for more information. - * - * @param {string|DOMElement} element HTML string or DOMElement to be wrapped into jQuery. - * @returns {Object} jQuery object. - */ - -JQLite.expando = 'ng339'; - -var jqCache = JQLite.cache = {}, - jqId = 1; - -/* - * !!! This is an undocumented "private" function !!! - */ -JQLite._data = function(node) { - //jQuery always returns an object on cache miss - return this.cache[node[this.expando]] || {}; -}; - -function jqNextId() { return ++jqId; } - - -var DASH_LOWERCASE_REGEXP = /-([a-z])/g; -var MS_HACK_REGEXP = /^-ms-/; -var MOUSE_EVENT_MAP = { mouseleave: 'mouseout', mouseenter: 'mouseover' }; -var jqLiteMinErr = minErr('jqLite'); - -/** - * Converts kebab-case to camelCase. - * There is also a special case for the ms prefix starting with a lowercase letter. - * @param name Name to normalize - */ -function cssKebabToCamel(name) { - return kebabToCamel(name.replace(MS_HACK_REGEXP, 'ms-')); -} - -function fnCamelCaseReplace(all, letter) { - return letter.toUpperCase(); -} - -/** - * Converts kebab-case to camelCase. - * @param name Name to normalize - */ -function kebabToCamel(name) { - return name - .replace(DASH_LOWERCASE_REGEXP, fnCamelCaseReplace); -} - -var SINGLE_TAG_REGEXP = /^<([\w-]+)\s*\/?>(?:<\/\1>|)$/; -var HTML_REGEXP = /<|&#?\w+;/; -var TAG_NAME_REGEXP = /<([\w:-]+)/; -var XHTML_TAG_REGEXP = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi; - -var wrapMap = { - 'option': [1, ''], - - 'thead': [1, '', '
    '], - 'col': [2, '', '
    '], - 'tr': [2, '', '
    '], - 'td': [3, '', '
    '], - '_default': [0, '', ''] -}; - -wrapMap.optgroup = wrapMap.option; -wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; -wrapMap.th = wrapMap.td; - - -function jqLiteIsTextNode(html) { - return !HTML_REGEXP.test(html); -} - -function jqLiteAcceptsData(node) { - // The window object can accept data but has no nodeType - // Otherwise we are only interested in elements (1) and documents (9) - var nodeType = node.nodeType; - return nodeType === NODE_TYPE_ELEMENT || !nodeType || nodeType === NODE_TYPE_DOCUMENT; -} - -function jqLiteHasData(node) { - for (var key in jqCache[node.ng339]) { - return true; - } - return false; -} - -function jqLiteBuildFragment(html, context) { - var tmp, tag, wrap, - fragment = context.createDocumentFragment(), - nodes = [], i; - - if (jqLiteIsTextNode(html)) { - // Convert non-html into a text node - nodes.push(context.createTextNode(html)); - } else { - // Convert html into DOM nodes - tmp = fragment.appendChild(context.createElement('div')); - tag = (TAG_NAME_REGEXP.exec(html) || ['', ''])[1].toLowerCase(); - wrap = wrapMap[tag] || wrapMap._default; - tmp.innerHTML = wrap[1] + html.replace(XHTML_TAG_REGEXP, '<$1>') + wrap[2]; - - // Descend through wrappers to the right content - i = wrap[0]; - while (i--) { - tmp = tmp.lastChild; - } - - nodes = concat(nodes, tmp.childNodes); - - tmp = fragment.firstChild; - tmp.textContent = ''; - } - - // Remove wrapper from fragment - fragment.textContent = ''; - fragment.innerHTML = ''; // Clear inner HTML - forEach(nodes, function(node) { - fragment.appendChild(node); - }); - - return fragment; -} - -function jqLiteParseHTML(html, context) { - context = context || window.document; - var parsed; - - if ((parsed = SINGLE_TAG_REGEXP.exec(html))) { - return [context.createElement(parsed[1])]; - } - - if ((parsed = jqLiteBuildFragment(html, context))) { - return parsed.childNodes; - } - - return []; -} - -function jqLiteWrapNode(node, wrapper) { - var parent = node.parentNode; - - if (parent) { - parent.replaceChild(wrapper, node); - } - - wrapper.appendChild(node); -} - - -// IE9-11 has no method "contains" in SVG element and in Node.prototype. Bug #10259. -var jqLiteContains = window.Node.prototype.contains || /** @this */ function(arg) { - // eslint-disable-next-line no-bitwise - return !!(this.compareDocumentPosition(arg) & 16); -}; - -///////////////////////////////////////////// -function JQLite(element) { - if (element instanceof JQLite) { - return element; - } - - var argIsString; - - if (isString(element)) { - element = trim(element); - argIsString = true; - } - if (!(this instanceof JQLite)) { - if (argIsString && element.charAt(0) !== '<') { - throw jqLiteMinErr('nosel', 'Looking up elements via selectors is not supported by jqLite! See: http://docs.angularjs.org/api/angular.element'); - } - return new JQLite(element); - } - - if (argIsString) { - jqLiteAddNodes(this, jqLiteParseHTML(element)); - } else if (isFunction(element)) { - jqLiteReady(element); - } else { - jqLiteAddNodes(this, element); - } -} - -function jqLiteClone(element) { - return element.cloneNode(true); -} - -function jqLiteDealoc(element, onlyDescendants) { - if (!onlyDescendants && jqLiteAcceptsData(element)) jqLite.cleanData([element]); - - if (element.querySelectorAll) { - jqLite.cleanData(element.querySelectorAll('*')); - } -} - -function isEmptyObject(obj) { - var name; - - for (name in obj) { - return false; - } - return true; -} - -function removeIfEmptyData(element) { - var expandoId = element.ng339; - var expandoStore = expandoId && jqCache[expandoId]; - - var events = expandoStore && expandoStore.events; - var data = expandoStore && expandoStore.data; - - if ((!data || isEmptyObject(data)) && (!events || isEmptyObject(events))) { - delete jqCache[expandoId]; - element.ng339 = undefined; // don't delete DOM expandos. IE and Chrome don't like it - } -} - -function jqLiteOff(element, type, fn, unsupported) { - if (isDefined(unsupported)) throw jqLiteMinErr('offargs', 'jqLite#off() does not support the `selector` argument'); - - var expandoStore = jqLiteExpandoStore(element); - var events = expandoStore && expandoStore.events; - var handle = expandoStore && expandoStore.handle; - - if (!handle) return; //no listeners registered - - if (!type) { - for (type in events) { - if (type !== '$destroy') { - element.removeEventListener(type, handle); - } - delete events[type]; - } - } else { - - var removeHandler = function(type) { - var listenerFns = events[type]; - if (isDefined(fn)) { - arrayRemove(listenerFns || [], fn); - } - if (!(isDefined(fn) && listenerFns && listenerFns.length > 0)) { - element.removeEventListener(type, handle); - delete events[type]; - } - }; - - forEach(type.split(' '), function(type) { - removeHandler(type); - if (MOUSE_EVENT_MAP[type]) { - removeHandler(MOUSE_EVENT_MAP[type]); - } - }); - } - - removeIfEmptyData(element); -} - -function jqLiteRemoveData(element, name) { - var expandoId = element.ng339; - var expandoStore = expandoId && jqCache[expandoId]; - - if (expandoStore) { - if (name) { - delete expandoStore.data[name]; - } else { - expandoStore.data = {}; - } - - removeIfEmptyData(element); - } -} - - -function jqLiteExpandoStore(element, createIfNecessary) { - var expandoId = element.ng339, - expandoStore = expandoId && jqCache[expandoId]; - - if (createIfNecessary && !expandoStore) { - element.ng339 = expandoId = jqNextId(); - expandoStore = jqCache[expandoId] = {events: {}, data: {}, handle: undefined}; - } - - return expandoStore; -} - - -function jqLiteData(element, key, value) { - if (jqLiteAcceptsData(element)) { - var prop; - - var isSimpleSetter = isDefined(value); - var isSimpleGetter = !isSimpleSetter && key && !isObject(key); - var massGetter = !key; - var expandoStore = jqLiteExpandoStore(element, !isSimpleGetter); - var data = expandoStore && expandoStore.data; - - if (isSimpleSetter) { // data('key', value) - data[kebabToCamel(key)] = value; - } else { - if (massGetter) { // data() - return data; - } else { - if (isSimpleGetter) { // data('key') - // don't force creation of expandoStore if it doesn't exist yet - return data && data[kebabToCamel(key)]; - } else { // mass-setter: data({key1: val1, key2: val2}) - for (prop in key) { - data[kebabToCamel(prop)] = key[prop]; - } - } - } - } - } -} - -function jqLiteHasClass(element, selector) { - if (!element.getAttribute) return false; - return ((' ' + (element.getAttribute('class') || '') + ' ').replace(/[\n\t]/g, ' '). - indexOf(' ' + selector + ' ') > -1); -} - -function jqLiteRemoveClass(element, cssClasses) { - if (cssClasses && element.setAttribute) { - var existingClasses = (' ' + (element.getAttribute('class') || '') + ' ') - .replace(/[\n\t]/g, ' '); - var newClasses = existingClasses; - - forEach(cssClasses.split(' '), function(cssClass) { - cssClass = trim(cssClass); - newClasses = newClasses.replace(' ' + cssClass + ' ', ' '); - }); - - if (newClasses !== existingClasses) { - element.setAttribute('class', trim(newClasses)); - } - } -} - -function jqLiteAddClass(element, cssClasses) { - if (cssClasses && element.setAttribute) { - var existingClasses = (' ' + (element.getAttribute('class') || '') + ' ') - .replace(/[\n\t]/g, ' '); - var newClasses = existingClasses; - - forEach(cssClasses.split(' '), function(cssClass) { - cssClass = trim(cssClass); - if (newClasses.indexOf(' ' + cssClass + ' ') === -1) { - newClasses += cssClass + ' '; - } - }); - - if (newClasses !== existingClasses) { - element.setAttribute('class', trim(newClasses)); - } - } -} - - -function jqLiteAddNodes(root, elements) { - // THIS CODE IS VERY HOT. Don't make changes without benchmarking. - - if (elements) { - - // if a Node (the most common case) - if (elements.nodeType) { - root[root.length++] = elements; - } else { - var length = elements.length; - - // if an Array or NodeList and not a Window - if (typeof length === 'number' && elements.window !== elements) { - if (length) { - for (var i = 0; i < length; i++) { - root[root.length++] = elements[i]; - } - } - } else { - root[root.length++] = elements; - } - } - } -} - - -function jqLiteController(element, name) { - return jqLiteInheritedData(element, '$' + (name || 'ngController') + 'Controller'); -} - -function jqLiteInheritedData(element, name, value) { - // if element is the document object work with the html element instead - // this makes $(document).scope() possible - if (element.nodeType === NODE_TYPE_DOCUMENT) { - element = element.documentElement; - } - var names = isArray(name) ? name : [name]; - - while (element) { - for (var i = 0, ii = names.length; i < ii; i++) { - if (isDefined(value = jqLite.data(element, names[i]))) return value; - } - - // If dealing with a document fragment node with a host element, and no parent, use the host - // element as the parent. This enables directives within a Shadow DOM or polyfilled Shadow DOM - // to lookup parent controllers. - element = element.parentNode || (element.nodeType === NODE_TYPE_DOCUMENT_FRAGMENT && element.host); - } -} - -function jqLiteEmpty(element) { - jqLiteDealoc(element, true); - while (element.firstChild) { - element.removeChild(element.firstChild); - } -} - -function jqLiteRemove(element, keepData) { - if (!keepData) jqLiteDealoc(element); - var parent = element.parentNode; - if (parent) parent.removeChild(element); -} - - -function jqLiteDocumentLoaded(action, win) { - win = win || window; - if (win.document.readyState === 'complete') { - // Force the action to be run async for consistent behavior - // from the action's point of view - // i.e. it will definitely not be in a $apply - win.setTimeout(action); - } else { - // No need to unbind this handler as load is only ever called once - jqLite(win).on('load', action); - } -} - -function jqLiteReady(fn) { - function trigger() { - window.document.removeEventListener('DOMContentLoaded', trigger); - window.removeEventListener('load', trigger); - fn(); - } - - // check if document is already loaded - if (window.document.readyState === 'complete') { - window.setTimeout(fn); - } else { - // We can not use jqLite since we are not done loading and jQuery could be loaded later. - - // Works for modern browsers and IE9 - window.document.addEventListener('DOMContentLoaded', trigger); - - // Fallback to window.onload for others - window.addEventListener('load', trigger); - } -} - -////////////////////////////////////////// -// Functions which are declared directly. -////////////////////////////////////////// -var JQLitePrototype = JQLite.prototype = { - ready: jqLiteReady, - toString: function() { - var value = []; - forEach(this, function(e) { value.push('' + e);}); - return '[' + value.join(', ') + ']'; - }, - - eq: function(index) { - return (index >= 0) ? jqLite(this[index]) : jqLite(this[this.length + index]); - }, - - length: 0, - push: push, - sort: [].sort, - splice: [].splice -}; - -////////////////////////////////////////// -// Functions iterating getter/setters. -// these functions return self on setter and -// value on get. -////////////////////////////////////////// -var BOOLEAN_ATTR = {}; -forEach('multiple,selected,checked,disabled,readOnly,required,open'.split(','), function(value) { - BOOLEAN_ATTR[lowercase(value)] = value; -}); -var BOOLEAN_ELEMENTS = {}; -forEach('input,select,option,textarea,button,form,details'.split(','), function(value) { - BOOLEAN_ELEMENTS[value] = true; -}); -var ALIASED_ATTR = { - 'ngMinlength': 'minlength', - 'ngMaxlength': 'maxlength', - 'ngMin': 'min', - 'ngMax': 'max', - 'ngPattern': 'pattern', - 'ngStep': 'step' -}; - -function getBooleanAttrName(element, name) { - // check dom last since we will most likely fail on name - var booleanAttr = BOOLEAN_ATTR[name.toLowerCase()]; - - // booleanAttr is here twice to minimize DOM access - return booleanAttr && BOOLEAN_ELEMENTS[nodeName_(element)] && booleanAttr; -} - -function getAliasedAttrName(name) { - return ALIASED_ATTR[name]; -} - -forEach({ - data: jqLiteData, - removeData: jqLiteRemoveData, - hasData: jqLiteHasData, - cleanData: function jqLiteCleanData(nodes) { - for (var i = 0, ii = nodes.length; i < ii; i++) { - jqLiteRemoveData(nodes[i]); - jqLiteOff(nodes[i]); - } - } -}, function(fn, name) { - JQLite[name] = fn; -}); - -forEach({ - data: jqLiteData, - inheritedData: jqLiteInheritedData, - - scope: function(element) { - // Can't use jqLiteData here directly so we stay compatible with jQuery! - return jqLite.data(element, '$scope') || jqLiteInheritedData(element.parentNode || element, ['$isolateScope', '$scope']); - }, - - isolateScope: function(element) { - // Can't use jqLiteData here directly so we stay compatible with jQuery! - return jqLite.data(element, '$isolateScope') || jqLite.data(element, '$isolateScopeNoTemplate'); - }, - - controller: jqLiteController, - - injector: function(element) { - return jqLiteInheritedData(element, '$injector'); - }, - - removeAttr: function(element, name) { - element.removeAttribute(name); - }, - - hasClass: jqLiteHasClass, - - css: function(element, name, value) { - name = cssKebabToCamel(name); - - if (isDefined(value)) { - element.style[name] = value; - } else { - return element.style[name]; - } - }, - - attr: function(element, name, value) { - var ret; - var nodeType = element.nodeType; - if (nodeType === NODE_TYPE_TEXT || nodeType === NODE_TYPE_ATTRIBUTE || nodeType === NODE_TYPE_COMMENT || - !element.getAttribute) { - return; - } - - var lowercasedName = lowercase(name); - var isBooleanAttr = BOOLEAN_ATTR[lowercasedName]; - - if (isDefined(value)) { - // setter - - if (value === null || (value === false && isBooleanAttr)) { - element.removeAttribute(name); - } else { - element.setAttribute(name, isBooleanAttr ? lowercasedName : value); - } - } else { - // getter - - ret = element.getAttribute(name); - - if (isBooleanAttr && ret !== null) { - ret = lowercasedName; - } - // Normalize non-existing attributes to undefined (as jQuery). - return ret === null ? undefined : ret; - } - }, - - prop: function(element, name, value) { - if (isDefined(value)) { - element[name] = value; - } else { - return element[name]; - } - }, - - text: (function() { - getText.$dv = ''; - return getText; - - function getText(element, value) { - if (isUndefined(value)) { - var nodeType = element.nodeType; - return (nodeType === NODE_TYPE_ELEMENT || nodeType === NODE_TYPE_TEXT) ? element.textContent : ''; - } - element.textContent = value; - } - })(), - - val: function(element, value) { - if (isUndefined(value)) { - if (element.multiple && nodeName_(element) === 'select') { - var result = []; - forEach(element.options, function(option) { - if (option.selected) { - result.push(option.value || option.text); - } - }); - return result; - } - return element.value; - } - element.value = value; - }, - - html: function(element, value) { - if (isUndefined(value)) { - return element.innerHTML; - } - jqLiteDealoc(element, true); - element.innerHTML = value; - }, - - empty: jqLiteEmpty -}, function(fn, name) { - /** - * Properties: writes return selection, reads return first value - */ - JQLite.prototype[name] = function(arg1, arg2) { - var i, key; - var nodeCount = this.length; - - // jqLiteHasClass has only two arguments, but is a getter-only fn, so we need to special-case it - // in a way that survives minification. - // jqLiteEmpty takes no arguments but is a setter. - if (fn !== jqLiteEmpty && - (isUndefined((fn.length === 2 && (fn !== jqLiteHasClass && fn !== jqLiteController)) ? arg1 : arg2))) { - if (isObject(arg1)) { - - // we are a write, but the object properties are the key/values - for (i = 0; i < nodeCount; i++) { - if (fn === jqLiteData) { - // data() takes the whole object in jQuery - fn(this[i], arg1); - } else { - for (key in arg1) { - fn(this[i], key, arg1[key]); - } - } - } - // return self for chaining - return this; - } else { - // we are a read, so read the first child. - // TODO: do we still need this? - var value = fn.$dv; - // Only if we have $dv do we iterate over all, otherwise it is just the first element. - var jj = (isUndefined(value)) ? Math.min(nodeCount, 1) : nodeCount; - for (var j = 0; j < jj; j++) { - var nodeValue = fn(this[j], arg1, arg2); - value = value ? value + nodeValue : nodeValue; - } - return value; - } - } else { - // we are a write, so apply to all children - for (i = 0; i < nodeCount; i++) { - fn(this[i], arg1, arg2); - } - // return self for chaining - return this; - } - }; -}); - -function createEventHandler(element, events) { - var eventHandler = function(event, type) { - // jQuery specific api - event.isDefaultPrevented = function() { - return event.defaultPrevented; - }; - - var eventFns = events[type || event.type]; - var eventFnsLength = eventFns ? eventFns.length : 0; - - if (!eventFnsLength) return; - - if (isUndefined(event.immediatePropagationStopped)) { - var originalStopImmediatePropagation = event.stopImmediatePropagation; - event.stopImmediatePropagation = function() { - event.immediatePropagationStopped = true; - - if (event.stopPropagation) { - event.stopPropagation(); - } - - if (originalStopImmediatePropagation) { - originalStopImmediatePropagation.call(event); - } - }; - } - - event.isImmediatePropagationStopped = function() { - return event.immediatePropagationStopped === true; - }; - - // Some events have special handlers that wrap the real handler - var handlerWrapper = eventFns.specialHandlerWrapper || defaultHandlerWrapper; - - // Copy event handlers in case event handlers array is modified during execution. - if ((eventFnsLength > 1)) { - eventFns = shallowCopy(eventFns); - } - - for (var i = 0; i < eventFnsLength; i++) { - if (!event.isImmediatePropagationStopped()) { - handlerWrapper(element, event, eventFns[i]); - } - } - }; - - // TODO: this is a hack for angularMocks/clearDataCache that makes it possible to deregister all - // events on `element` - eventHandler.elem = element; - return eventHandler; -} - -function defaultHandlerWrapper(element, event, handler) { - handler.call(element, event); -} - -function specialMouseHandlerWrapper(target, event, handler) { - // Refer to jQuery's implementation of mouseenter & mouseleave - // Read about mouseenter and mouseleave: - // http://www.quirksmode.org/js/events_mouse.html#link8 - var related = event.relatedTarget; - // For mousenter/leave call the handler if related is outside the target. - // NB: No relatedTarget if the mouse left/entered the browser window - if (!related || (related !== target && !jqLiteContains.call(target, related))) { - handler.call(target, event); - } -} - -////////////////////////////////////////// -// Functions iterating traversal. -// These functions chain results into a single -// selector. -////////////////////////////////////////// -forEach({ - removeData: jqLiteRemoveData, - - on: function jqLiteOn(element, type, fn, unsupported) { - if (isDefined(unsupported)) throw jqLiteMinErr('onargs', 'jqLite#on() does not support the `selector` or `eventData` parameters'); - - // Do not add event handlers to non-elements because they will not be cleaned up. - if (!jqLiteAcceptsData(element)) { - return; - } - - var expandoStore = jqLiteExpandoStore(element, true); - var events = expandoStore.events; - var handle = expandoStore.handle; - - if (!handle) { - handle = expandoStore.handle = createEventHandler(element, events); - } - - // http://jsperf.com/string-indexof-vs-split - var types = type.indexOf(' ') >= 0 ? type.split(' ') : [type]; - var i = types.length; - - var addHandler = function(type, specialHandlerWrapper, noEventListener) { - var eventFns = events[type]; - - if (!eventFns) { - eventFns = events[type] = []; - eventFns.specialHandlerWrapper = specialHandlerWrapper; - if (type !== '$destroy' && !noEventListener) { - element.addEventListener(type, handle); - } - } - - eventFns.push(fn); - }; - - while (i--) { - type = types[i]; - if (MOUSE_EVENT_MAP[type]) { - addHandler(MOUSE_EVENT_MAP[type], specialMouseHandlerWrapper); - addHandler(type, undefined, true); - } else { - addHandler(type); - } - } - }, - - off: jqLiteOff, - - one: function(element, type, fn) { - element = jqLite(element); - - //add the listener twice so that when it is called - //you can remove the original function and still be - //able to call element.off(ev, fn) normally - element.on(type, function onFn() { - element.off(type, fn); - element.off(type, onFn); - }); - element.on(type, fn); - }, - - replaceWith: function(element, replaceNode) { - var index, parent = element.parentNode; - jqLiteDealoc(element); - forEach(new JQLite(replaceNode), function(node) { - if (index) { - parent.insertBefore(node, index.nextSibling); - } else { - parent.replaceChild(node, element); - } - index = node; - }); - }, - - children: function(element) { - var children = []; - forEach(element.childNodes, function(element) { - if (element.nodeType === NODE_TYPE_ELEMENT) { - children.push(element); - } - }); - return children; - }, - - contents: function(element) { - return element.contentDocument || element.childNodes || []; - }, - - append: function(element, node) { - var nodeType = element.nodeType; - if (nodeType !== NODE_TYPE_ELEMENT && nodeType !== NODE_TYPE_DOCUMENT_FRAGMENT) return; - - node = new JQLite(node); - - for (var i = 0, ii = node.length; i < ii; i++) { - var child = node[i]; - element.appendChild(child); - } - }, - - prepend: function(element, node) { - if (element.nodeType === NODE_TYPE_ELEMENT) { - var index = element.firstChild; - forEach(new JQLite(node), function(child) { - element.insertBefore(child, index); - }); - } - }, - - wrap: function(element, wrapNode) { - jqLiteWrapNode(element, jqLite(wrapNode).eq(0).clone()[0]); - }, - - remove: jqLiteRemove, - - detach: function(element) { - jqLiteRemove(element, true); - }, - - after: function(element, newElement) { - var index = element, parent = element.parentNode; - - if (parent) { - newElement = new JQLite(newElement); - - for (var i = 0, ii = newElement.length; i < ii; i++) { - var node = newElement[i]; - parent.insertBefore(node, index.nextSibling); - index = node; - } - } - }, - - addClass: jqLiteAddClass, - removeClass: jqLiteRemoveClass, - - toggleClass: function(element, selector, condition) { - if (selector) { - forEach(selector.split(' '), function(className) { - var classCondition = condition; - if (isUndefined(classCondition)) { - classCondition = !jqLiteHasClass(element, className); - } - (classCondition ? jqLiteAddClass : jqLiteRemoveClass)(element, className); - }); - } - }, - - parent: function(element) { - var parent = element.parentNode; - return parent && parent.nodeType !== NODE_TYPE_DOCUMENT_FRAGMENT ? parent : null; - }, - - next: function(element) { - return element.nextElementSibling; - }, - - find: function(element, selector) { - if (element.getElementsByTagName) { - return element.getElementsByTagName(selector); - } else { - return []; - } - }, - - clone: jqLiteClone, - - triggerHandler: function(element, event, extraParameters) { - - var dummyEvent, eventFnsCopy, handlerArgs; - var eventName = event.type || event; - var expandoStore = jqLiteExpandoStore(element); - var events = expandoStore && expandoStore.events; - var eventFns = events && events[eventName]; - - if (eventFns) { - // Create a dummy event to pass to the handlers - dummyEvent = { - preventDefault: function() { this.defaultPrevented = true; }, - isDefaultPrevented: function() { return this.defaultPrevented === true; }, - stopImmediatePropagation: function() { this.immediatePropagationStopped = true; }, - isImmediatePropagationStopped: function() { return this.immediatePropagationStopped === true; }, - stopPropagation: noop, - type: eventName, - target: element - }; - - // If a custom event was provided then extend our dummy event with it - if (event.type) { - dummyEvent = extend(dummyEvent, event); - } - - // Copy event handlers in case event handlers array is modified during execution. - eventFnsCopy = shallowCopy(eventFns); - handlerArgs = extraParameters ? [dummyEvent].concat(extraParameters) : [dummyEvent]; - - forEach(eventFnsCopy, function(fn) { - if (!dummyEvent.isImmediatePropagationStopped()) { - fn.apply(element, handlerArgs); - } - }); - } - } -}, function(fn, name) { - /** - * chaining functions - */ - JQLite.prototype[name] = function(arg1, arg2, arg3) { - var value; - - for (var i = 0, ii = this.length; i < ii; i++) { - if (isUndefined(value)) { - value = fn(this[i], arg1, arg2, arg3); - if (isDefined(value)) { - // any function which returns a value needs to be wrapped - value = jqLite(value); - } - } else { - jqLiteAddNodes(value, fn(this[i], arg1, arg2, arg3)); - } - } - return isDefined(value) ? value : this; - }; -}); - -// bind legacy bind/unbind to on/off -JQLite.prototype.bind = JQLite.prototype.on; -JQLite.prototype.unbind = JQLite.prototype.off; - - -// Provider for private $$jqLite service -/** @this */ -function $$jqLiteProvider() { - this.$get = function $$jqLite() { - return extend(JQLite, { - hasClass: function(node, classes) { - if (node.attr) node = node[0]; - return jqLiteHasClass(node, classes); - }, - addClass: function(node, classes) { - if (node.attr) node = node[0]; - return jqLiteAddClass(node, classes); - }, - removeClass: function(node, classes) { - if (node.attr) node = node[0]; - return jqLiteRemoveClass(node, classes); - } - }); - }; -} - -/** - * Computes a hash of an 'obj'. - * Hash of a: - * string is string - * number is number as string - * object is either result of calling $$hashKey function on the object or uniquely generated id, - * that is also assigned to the $$hashKey property of the object. - * - * @param obj - * @returns {string} hash string such that the same input will have the same hash string. - * The resulting string key is in 'type:hashKey' format. - */ -function hashKey(obj, nextUidFn) { - var key = obj && obj.$$hashKey; - - if (key) { - if (typeof key === 'function') { - key = obj.$$hashKey(); - } - return key; - } - - var objType = typeof obj; - if (objType === 'function' || (objType === 'object' && obj !== null)) { - key = obj.$$hashKey = objType + ':' + (nextUidFn || nextUid)(); - } else { - key = objType + ':' + obj; - } - - return key; -} - -// A minimal ES2015 Map implementation. -// Should be bug/feature equivalent to the native implementations of supported browsers -// (for the features required in Angular). -// See https://kangax.github.io/compat-table/es6/#test-Map -var nanKey = Object.create(null); -function NgMapShim() { - this._keys = []; - this._values = []; - this._lastKey = NaN; - this._lastIndex = -1; -} -NgMapShim.prototype = { - _idx: function(key) { - if (key !== this._lastKey) { - this._lastKey = key; - this._lastIndex = this._keys.indexOf(key); - } - return this._lastIndex; - }, - _transformKey: function(key) { - return isNumberNaN(key) ? nanKey : key; - }, - get: function(key) { - key = this._transformKey(key); - var idx = this._idx(key); - if (idx !== -1) { - return this._values[idx]; - } - }, - has: function(key) { - key = this._transformKey(key); - var idx = this._idx(key); - return idx !== -1; - }, - set: function(key, value) { - key = this._transformKey(key); - var idx = this._idx(key); - if (idx === -1) { - idx = this._lastIndex = this._keys.length; - } - this._keys[idx] = key; - this._values[idx] = value; - - // Support: IE11 - // Do not `return this` to simulate the partial IE11 implementation - }, - delete: function(key) { - key = this._transformKey(key); - var idx = this._idx(key); - if (idx === -1) { - return false; - } - this._keys.splice(idx, 1); - this._values.splice(idx, 1); - this._lastKey = NaN; - this._lastIndex = -1; - return true; - } -}; - -// For now, always use `NgMapShim`, even if `window.Map` is available. Some native implementations -// are still buggy (often in subtle ways) and can cause hard-to-debug failures. When native `Map` -// implementations get more stable, we can reconsider switching to `window.Map` (when available). -var NgMap = NgMapShim; - -var $$MapProvider = [/** @this */function() { - this.$get = [function() { - return NgMap; - }]; -}]; - -/** - * @ngdoc function - * @module ng - * @name angular.injector - * @kind function - * - * @description - * Creates an injector object that can be used for retrieving services as well as for - * dependency injection (see {@link guide/di dependency injection}). - * - * @param {Array.} modules A list of module functions or their aliases. See - * {@link angular.module}. The `ng` module must be explicitly added. - * @param {boolean=} [strictDi=false] Whether the injector should be in strict mode, which - * disallows argument name annotation inference. - * @returns {injector} Injector object. See {@link auto.$injector $injector}. - * - * @example - * Typical usage - * ```js - * // create an injector - * var $injector = angular.injector(['ng']); - * - * // use the injector to kick off your application - * // use the type inference to auto inject arguments, or use implicit injection - * $injector.invoke(function($rootScope, $compile, $document) { - * $compile($document)($rootScope); - * $rootScope.$digest(); - * }); - * ``` - * - * Sometimes you want to get access to the injector of a currently running AngularJS app - * from outside AngularJS. Perhaps, you want to inject and compile some markup after the - * application has been bootstrapped. You can do this using the extra `injector()` added - * to JQuery/jqLite elements. See {@link angular.element}. - * - * *This is fairly rare but could be the case if a third party library is injecting the - * markup.* - * - * In the following example a new block of HTML containing a `ng-controller` - * directive is added to the end of the document body by JQuery. We then compile and link - * it into the current AngularJS scope. - * - * ```js - * var $div = $('
    {{content.label}}
    '); - * $(document.body).append($div); - * - * angular.element(document).injector().invoke(function($compile) { - * var scope = angular.element($div).scope(); - * $compile($div)(scope); - * }); - * ``` - */ - - -/** - * @ngdoc module - * @name auto - * @installation - * @description - * - * Implicit module which gets automatically added to each {@link auto.$injector $injector}. - */ - -var ARROW_ARG = /^([^(]+?)=>/; -var FN_ARGS = /^[^(]*\(\s*([^)]*)\)/m; -var FN_ARG_SPLIT = /,/; -var FN_ARG = /^\s*(_?)(\S+?)\1\s*$/; -var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg; -var $injectorMinErr = minErr('$injector'); - -function stringifyFn(fn) { - return Function.prototype.toString.call(fn); -} - -function extractArgs(fn) { - var fnText = stringifyFn(fn).replace(STRIP_COMMENTS, ''), - args = fnText.match(ARROW_ARG) || fnText.match(FN_ARGS); - return args; -} - -function anonFn(fn) { - // For anonymous functions, showing at the very least the function signature can help in - // debugging. - var args = extractArgs(fn); - if (args) { - return 'function(' + (args[1] || '').replace(/[\s\r\n]+/, ' ') + ')'; - } - return 'fn'; -} - -function annotate(fn, strictDi, name) { - var $inject, - argDecl, - last; - - if (typeof fn === 'function') { - if (!($inject = fn.$inject)) { - $inject = []; - if (fn.length) { - if (strictDi) { - if (!isString(name) || !name) { - name = fn.name || anonFn(fn); - } - throw $injectorMinErr('strictdi', - '{0} is not using explicit annotation and cannot be invoked in strict mode', name); - } - argDecl = extractArgs(fn); - forEach(argDecl[1].split(FN_ARG_SPLIT), function(arg) { - arg.replace(FN_ARG, function(all, underscore, name) { - $inject.push(name); - }); - }); - } - fn.$inject = $inject; - } - } else if (isArray(fn)) { - last = fn.length - 1; - assertArgFn(fn[last], 'fn'); - $inject = fn.slice(0, last); - } else { - assertArgFn(fn, 'fn', true); - } - return $inject; -} - -/////////////////////////////////////// - -/** - * @ngdoc service - * @name $injector - * - * @description - * - * `$injector` is used to retrieve object instances as defined by - * {@link auto.$provide provider}, instantiate types, invoke methods, - * and load modules. - * - * The following always holds true: - * - * ```js - * var $injector = angular.injector(); - * expect($injector.get('$injector')).toBe($injector); - * expect($injector.invoke(function($injector) { - * return $injector; - * })).toBe($injector); - * ``` - * - * ## Injection Function Annotation - * - * JavaScript does not have annotations, and annotations are needed for dependency injection. The - * following are all valid ways of annotating function with injection arguments and are equivalent. - * - * ```js - * // inferred (only works if code not minified/obfuscated) - * $injector.invoke(function(serviceA){}); - * - * // annotated - * function explicit(serviceA) {}; - * explicit.$inject = ['serviceA']; - * $injector.invoke(explicit); - * - * // inline - * $injector.invoke(['serviceA', function(serviceA){}]); - * ``` - * - * ### Inference - * - * In JavaScript calling `toString()` on a function returns the function definition. The definition - * can then be parsed and the function arguments can be extracted. This method of discovering - * annotations is disallowed when the injector is in strict mode. - * *NOTE:* This does not work with minification, and obfuscation tools since these tools change the - * argument names. - * - * ### `$inject` Annotation - * By adding an `$inject` property onto a function the injection parameters can be specified. - * - * ### Inline - * As an array of injection names, where the last item in the array is the function to call. - */ - -/** - * @ngdoc property - * @name $injector#modules - * @type {Object} - * @description - * A hash containing all the modules that have been loaded into the - * $injector. - * - * You can use this property to find out information about a module via the - * {@link angular.Module#info `myModule.info(...)`} method. - * - * For example: - * - * ``` - * var info = $injector.modules['ngAnimate'].info(); - * ``` - * - * **Do not use this property to attempt to modify the modules after the application - * has been bootstrapped.** - */ - - -/** - * @ngdoc method - * @name $injector#get - * - * @description - * Return an instance of the service. - * - * @param {string} name The name of the instance to retrieve. - * @param {string=} caller An optional string to provide the origin of the function call for error messages. - * @return {*} The instance. - */ - -/** - * @ngdoc method - * @name $injector#invoke - * - * @description - * Invoke the method and supply the method arguments from the `$injector`. - * - * @param {Function|Array.} fn The injectable function to invoke. Function parameters are - * injected according to the {@link guide/di $inject Annotation} rules. - * @param {Object=} self The `this` for the invoked method. - * @param {Object=} locals Optional object. If preset then any argument names are read from this - * object first, before the `$injector` is consulted. - * @returns {*} the value returned by the invoked `fn` function. - */ - -/** - * @ngdoc method - * @name $injector#has - * - * @description - * Allows the user to query if the particular service exists. - * - * @param {string} name Name of the service to query. - * @returns {boolean} `true` if injector has given service. - */ - -/** - * @ngdoc method - * @name $injector#instantiate - * @description - * Create a new instance of JS type. The method takes a constructor function, invokes the new - * operator, and supplies all of the arguments to the constructor function as specified by the - * constructor annotation. - * - * @param {Function} Type Annotated constructor function. - * @param {Object=} locals Optional object. If preset then any argument names are read from this - * object first, before the `$injector` is consulted. - * @returns {Object} new instance of `Type`. - */ - -/** - * @ngdoc method - * @name $injector#annotate - * - * @description - * Returns an array of service names which the function is requesting for injection. This API is - * used by the injector to determine which services need to be injected into the function when the - * function is invoked. There are three ways in which the function can be annotated with the needed - * dependencies. - * - * #### Argument names - * - * The simplest form is to extract the dependencies from the arguments of the function. This is done - * by converting the function into a string using `toString()` method and extracting the argument - * names. - * ```js - * // Given - * function MyController($scope, $route) { - * // ... - * } - * - * // Then - * expect(injector.annotate(MyController)).toEqual(['$scope', '$route']); - * ``` - * - * You can disallow this method by using strict injection mode. - * - * This method does not work with code minification / obfuscation. For this reason the following - * annotation strategies are supported. - * - * #### The `$inject` property - * - * If a function has an `$inject` property and its value is an array of strings, then the strings - * represent names of services to be injected into the function. - * ```js - * // Given - * var MyController = function(obfuscatedScope, obfuscatedRoute) { - * // ... - * } - * // Define function dependencies - * MyController['$inject'] = ['$scope', '$route']; - * - * // Then - * expect(injector.annotate(MyController)).toEqual(['$scope', '$route']); - * ``` - * - * #### The array notation - * - * It is often desirable to inline Injected functions and that's when setting the `$inject` property - * is very inconvenient. In these situations using the array notation to specify the dependencies in - * a way that survives minification is a better choice: - * - * ```js - * // We wish to write this (not minification / obfuscation safe) - * injector.invoke(function($compile, $rootScope) { - * // ... - * }); - * - * // We are forced to write break inlining - * var tmpFn = function(obfuscatedCompile, obfuscatedRootScope) { - * // ... - * }; - * tmpFn.$inject = ['$compile', '$rootScope']; - * injector.invoke(tmpFn); - * - * // To better support inline function the inline annotation is supported - * injector.invoke(['$compile', '$rootScope', function(obfCompile, obfRootScope) { - * // ... - * }]); - * - * // Therefore - * expect(injector.annotate( - * ['$compile', '$rootScope', function(obfus_$compile, obfus_$rootScope) {}]) - * ).toEqual(['$compile', '$rootScope']); - * ``` - * - * @param {Function|Array.} fn Function for which dependent service names need to - * be retrieved as described above. - * - * @param {boolean=} [strictDi=false] Disallow argument name annotation inference. - * - * @returns {Array.} The names of the services which the function requires. - */ -/** - * @ngdoc method - * @name $injector#loadNewModules - * - * @description - * - * **This is a dangerous API, which you use at your own risk!** - * - * Add the specified modules to the current injector. - * - * This method will add each of the injectables to the injector and execute all of the config and run - * blocks for each module passed to the method. - * - * If a module has already been loaded into the injector then it will not be loaded again. - * - * * The application developer is responsible for loading the code containing the modules; and for - * ensuring that lazy scripts are not downloaded and executed more often that desired. - * * Previously compiled HTML will not be affected by newly loaded directives, filters and components. - * * Modules cannot be unloaded. - * - * You can use {@link $injector#modules `$injector.modules`} to check whether a module has been loaded - * into the injector, which may indicate whether the script has been executed already. - * - * @example - * Here is an example of loading a bundle of modules, with a utility method called `getScript`: - * - * ```javascript - * app.factory('loadModule', function($injector) { - * return function loadModule(moduleName, bundleUrl) { - * return getScript(bundleUrl).then(function() { $injector.loadNewModules([moduleName]); }); - * }; - * }) - * ``` - * - * @param {Array=} mods an array of modules to load into the application. - * Each item in the array should be the name of a predefined module or a (DI annotated) - * function that will be invoked by the injector as a `config` block. - * See: {@link angular.module modules} - */ - - -/** - * @ngdoc service - * @name $provide - * - * @description - * - * The {@link auto.$provide $provide} service has a number of methods for registering components - * with the {@link auto.$injector $injector}. Many of these functions are also exposed on - * {@link angular.Module}. - * - * An AngularJS **service** is a singleton object created by a **service factory**. These **service - * factories** are functions which, in turn, are created by a **service provider**. - * The **service providers** are constructor functions. When instantiated they must contain a - * property called `$get`, which holds the **service factory** function. - * - * When you request a service, the {@link auto.$injector $injector} is responsible for finding the - * correct **service provider**, instantiating it and then calling its `$get` **service factory** - * function to get the instance of the **service**. - * - * Often services have no configuration options and there is no need to add methods to the service - * provider. The provider will be no more than a constructor function with a `$get` property. For - * these cases the {@link auto.$provide $provide} service has additional helper methods to register - * services without specifying a provider. - * - * * {@link auto.$provide#provider provider(name, provider)} - registers a **service provider** with the - * {@link auto.$injector $injector} - * * {@link auto.$provide#constant constant(name, obj)} - registers a value/object that can be accessed by - * providers and services. - * * {@link auto.$provide#value value(name, obj)} - registers a value/object that can only be accessed by - * services, not providers. - * * {@link auto.$provide#factory factory(name, fn)} - registers a service **factory function** - * that will be wrapped in a **service provider** object, whose `$get` property will contain the - * given factory function. - * * {@link auto.$provide#service service(name, Fn)} - registers a **constructor function** - * that will be wrapped in a **service provider** object, whose `$get` property will instantiate - * a new object using the given constructor function. - * * {@link auto.$provide#decorator decorator(name, decorFn)} - registers a **decorator function** that - * will be able to modify or replace the implementation of another service. - * - * See the individual methods for more information and examples. - */ - -/** - * @ngdoc method - * @name $provide#provider - * @description - * - * Register a **provider function** with the {@link auto.$injector $injector}. Provider functions - * are constructor functions, whose instances are responsible for "providing" a factory for a - * service. - * - * Service provider names start with the name of the service they provide followed by `Provider`. - * For example, the {@link ng.$log $log} service has a provider called - * {@link ng.$logProvider $logProvider}. - * - * Service provider objects can have additional methods which allow configuration of the provider - * and its service. Importantly, you can configure what kind of service is created by the `$get` - * method, or how that service will act. For example, the {@link ng.$logProvider $logProvider} has a - * method {@link ng.$logProvider#debugEnabled debugEnabled} - * which lets you specify whether the {@link ng.$log $log} service will log debug messages to the - * console or not. - * - * It is possible to inject other providers into the provider function, - * but the injected provider must have been defined before the one that requires it. - * - * @param {string} name The name of the instance. NOTE: the provider will be available under `name + - 'Provider'` key. - * @param {(Object|function())} provider If the provider is: - * - * - `Object`: then it should have a `$get` method. The `$get` method will be invoked using - * {@link auto.$injector#invoke $injector.invoke()} when an instance needs to be created. - * - `Constructor`: a new instance of the provider will be created using - * {@link auto.$injector#instantiate $injector.instantiate()}, then treated as `object`. - * - * @returns {Object} registered provider instance - - * @example - * - * The following example shows how to create a simple event tracking service and register it using - * {@link auto.$provide#provider $provide.provider()}. - * - * ```js - * // Define the eventTracker provider - * function EventTrackerProvider() { - * var trackingUrl = '/track'; - * - * // A provider method for configuring where the tracked events should been saved - * this.setTrackingUrl = function(url) { - * trackingUrl = url; - * }; - * - * // The service factory function - * this.$get = ['$http', function($http) { - * var trackedEvents = {}; - * return { - * // Call this to track an event - * event: function(event) { - * var count = trackedEvents[event] || 0; - * count += 1; - * trackedEvents[event] = count; - * return count; - * }, - * // Call this to save the tracked events to the trackingUrl - * save: function() { - * $http.post(trackingUrl, trackedEvents); - * } - * }; - * }]; - * } - * - * describe('eventTracker', function() { - * var postSpy; - * - * beforeEach(module(function($provide) { - * // Register the eventTracker provider - * $provide.provider('eventTracker', EventTrackerProvider); - * })); - * - * beforeEach(module(function(eventTrackerProvider) { - * // Configure eventTracker provider - * eventTrackerProvider.setTrackingUrl('/custom-track'); - * })); - * - * it('tracks events', inject(function(eventTracker) { - * expect(eventTracker.event('login')).toEqual(1); - * expect(eventTracker.event('login')).toEqual(2); - * })); - * - * it('saves to the tracking url', inject(function(eventTracker, $http) { - * postSpy = spyOn($http, 'post'); - * eventTracker.event('login'); - * eventTracker.save(); - * expect(postSpy).toHaveBeenCalled(); - * expect(postSpy.mostRecentCall.args[0]).not.toEqual('/track'); - * expect(postSpy.mostRecentCall.args[0]).toEqual('/custom-track'); - * expect(postSpy.mostRecentCall.args[1]).toEqual({ 'login': 1 }); - * })); - * }); - * ``` - */ - -/** - * @ngdoc method - * @name $provide#factory - * @description - * - * Register a **service factory**, which will be called to return the service instance. - * This is short for registering a service where its provider consists of only a `$get` property, - * which is the given service factory function. - * You should use {@link auto.$provide#factory $provide.factory(getFn)} if you do not need to - * configure your service in a provider. - * - * @param {string} name The name of the instance. - * @param {Function|Array.} $getFn The injectable $getFn for the instance creation. - * Internally this is a short hand for `$provide.provider(name, {$get: $getFn})`. - * @returns {Object} registered provider instance - * - * @example - * Here is an example of registering a service - * ```js - * $provide.factory('ping', ['$http', function($http) { - * return function ping() { - * return $http.send('/ping'); - * }; - * }]); - * ``` - * You would then inject and use this service like this: - * ```js - * someModule.controller('Ctrl', ['ping', function(ping) { - * ping(); - * }]); - * ``` - */ - - -/** - * @ngdoc method - * @name $provide#service - * @description - * - * Register a **service constructor**, which will be invoked with `new` to create the service - * instance. - * This is short for registering a service where its provider's `$get` property is a factory - * function that returns an instance instantiated by the injector from the service constructor - * function. - * - * Internally it looks a bit like this: - * - * ``` - * { - * $get: function() { - * return $injector.instantiate(constructor); - * } - * } - * ``` - * - * - * You should use {@link auto.$provide#service $provide.service(class)} if you define your service - * as a type/class. - * - * @param {string} name The name of the instance. - * @param {Function|Array.} constructor An injectable class (constructor function) - * that will be instantiated. - * @returns {Object} registered provider instance - * - * @example - * Here is an example of registering a service using - * {@link auto.$provide#service $provide.service(class)}. - * ```js - * var Ping = function($http) { - * this.$http = $http; - * }; - * - * Ping.$inject = ['$http']; - * - * Ping.prototype.send = function() { - * return this.$http.get('/ping'); - * }; - * $provide.service('ping', Ping); - * ``` - * You would then inject and use this service like this: - * ```js - * someModule.controller('Ctrl', ['ping', function(ping) { - * ping.send(); - * }]); - * ``` - */ - - -/** - * @ngdoc method - * @name $provide#value - * @description - * - * Register a **value service** with the {@link auto.$injector $injector}, such as a string, a - * number, an array, an object or a function. This is short for registering a service where its - * provider's `$get` property is a factory function that takes no arguments and returns the **value - * service**. That also means it is not possible to inject other services into a value service. - * - * Value services are similar to constant services, except that they cannot be injected into a - * module configuration function (see {@link angular.Module#config}) but they can be overridden by - * an AngularJS {@link auto.$provide#decorator decorator}. - * - * @param {string} name The name of the instance. - * @param {*} value The value. - * @returns {Object} registered provider instance - * - * @example - * Here are some examples of creating value services. - * ```js - * $provide.value('ADMIN_USER', 'admin'); - * - * $provide.value('RoleLookup', { admin: 0, writer: 1, reader: 2 }); - * - * $provide.value('halfOf', function(value) { - * return value / 2; - * }); - * ``` - */ - - -/** - * @ngdoc method - * @name $provide#constant - * @description - * - * Register a **constant service** with the {@link auto.$injector $injector}, such as a string, - * a number, an array, an object or a function. Like the {@link auto.$provide#value value}, it is not - * possible to inject other services into a constant. - * - * But unlike {@link auto.$provide#value value}, a constant can be - * injected into a module configuration function (see {@link angular.Module#config}) and it cannot - * be overridden by an AngularJS {@link auto.$provide#decorator decorator}. - * - * @param {string} name The name of the constant. - * @param {*} value The constant value. - * @returns {Object} registered instance - * - * @example - * Here a some examples of creating constants: - * ```js - * $provide.constant('SHARD_HEIGHT', 306); - * - * $provide.constant('MY_COLOURS', ['red', 'blue', 'grey']); - * - * $provide.constant('double', function(value) { - * return value * 2; - * }); - * ``` - */ - - -/** - * @ngdoc method - * @name $provide#decorator - * @description - * - * Register a **decorator function** with the {@link auto.$injector $injector}. A decorator function - * intercepts the creation of a service, allowing it to override or modify the behavior of the - * service. The return value of the decorator function may be the original service, or a new service - * that replaces (or wraps and delegates to) the original service. - * - * You can find out more about using decorators in the {@link guide/decorators} guide. - * - * @param {string} name The name of the service to decorate. - * @param {Function|Array.} decorator This function will be invoked when the service needs to be - * provided and should return the decorated service instance. The function is called using - * the {@link auto.$injector#invoke injector.invoke} method and is therefore fully injectable. - * Local injection arguments: - * - * * `$delegate` - The original service instance, which can be replaced, monkey patched, configured, - * decorated or delegated to. - * - * @example - * Here we decorate the {@link ng.$log $log} service to convert warnings to errors by intercepting - * calls to {@link ng.$log#error $log.warn()}. - * ```js - * $provide.decorator('$log', ['$delegate', function($delegate) { - * $delegate.warn = $delegate.error; - * return $delegate; - * }]); - * ``` - */ - - -function createInjector(modulesToLoad, strictDi) { - strictDi = (strictDi === true); - var INSTANTIATING = {}, - providerSuffix = 'Provider', - path = [], - loadedModules = new NgMap(), - providerCache = { - $provide: { - provider: supportObject(provider), - factory: supportObject(factory), - service: supportObject(service), - value: supportObject(value), - constant: supportObject(constant), - decorator: decorator - } - }, - providerInjector = (providerCache.$injector = - createInternalInjector(providerCache, function(serviceName, caller) { - if (angular.isString(caller)) { - path.push(caller); - } - throw $injectorMinErr('unpr', 'Unknown provider: {0}', path.join(' <- ')); - })), - instanceCache = {}, - protoInstanceInjector = - createInternalInjector(instanceCache, function(serviceName, caller) { - var provider = providerInjector.get(serviceName + providerSuffix, caller); - return instanceInjector.invoke( - provider.$get, provider, undefined, serviceName); - }), - instanceInjector = protoInstanceInjector; - - providerCache['$injector' + providerSuffix] = { $get: valueFn(protoInstanceInjector) }; - instanceInjector.modules = providerInjector.modules = createMap(); - var runBlocks = loadModules(modulesToLoad); - instanceInjector = protoInstanceInjector.get('$injector'); - instanceInjector.strictDi = strictDi; - forEach(runBlocks, function(fn) { if (fn) instanceInjector.invoke(fn); }); - - instanceInjector.loadNewModules = function(mods) { - forEach(loadModules(mods), function(fn) { if (fn) instanceInjector.invoke(fn); }); - }; - - - return instanceInjector; - - //////////////////////////////////// - // $provider - //////////////////////////////////// - - function supportObject(delegate) { - return function(key, value) { - if (isObject(key)) { - forEach(key, reverseParams(delegate)); - } else { - return delegate(key, value); - } - }; - } - - function provider(name, provider_) { - assertNotHasOwnProperty(name, 'service'); - if (isFunction(provider_) || isArray(provider_)) { - provider_ = providerInjector.instantiate(provider_); - } - if (!provider_.$get) { - throw $injectorMinErr('pget', 'Provider \'{0}\' must define $get factory method.', name); - } - return (providerCache[name + providerSuffix] = provider_); - } - - function enforceReturnValue(name, factory) { - return /** @this */ function enforcedReturnValue() { - var result = instanceInjector.invoke(factory, this); - if (isUndefined(result)) { - throw $injectorMinErr('undef', 'Provider \'{0}\' must return a value from $get factory method.', name); - } - return result; - }; - } - - function factory(name, factoryFn, enforce) { - return provider(name, { - $get: enforce !== false ? enforceReturnValue(name, factoryFn) : factoryFn - }); - } - - function service(name, constructor) { - return factory(name, ['$injector', function($injector) { - return $injector.instantiate(constructor); - }]); - } - - function value(name, val) { return factory(name, valueFn(val), false); } - - function constant(name, value) { - assertNotHasOwnProperty(name, 'constant'); - providerCache[name] = value; - instanceCache[name] = value; - } - - function decorator(serviceName, decorFn) { - var origProvider = providerInjector.get(serviceName + providerSuffix), - orig$get = origProvider.$get; - - origProvider.$get = function() { - var origInstance = instanceInjector.invoke(orig$get, origProvider); - return instanceInjector.invoke(decorFn, null, {$delegate: origInstance}); - }; - } - - //////////////////////////////////// - // Module Loading - //////////////////////////////////// - function loadModules(modulesToLoad) { - assertArg(isUndefined(modulesToLoad) || isArray(modulesToLoad), 'modulesToLoad', 'not an array'); - var runBlocks = [], moduleFn; - forEach(modulesToLoad, function(module) { - if (loadedModules.get(module)) return; - loadedModules.set(module, true); - - function runInvokeQueue(queue) { - var i, ii; - for (i = 0, ii = queue.length; i < ii; i++) { - var invokeArgs = queue[i], - provider = providerInjector.get(invokeArgs[0]); - - provider[invokeArgs[1]].apply(provider, invokeArgs[2]); - } - } - - try { - if (isString(module)) { - moduleFn = angularModule(module); - instanceInjector.modules[module] = moduleFn; - runBlocks = runBlocks.concat(loadModules(moduleFn.requires)).concat(moduleFn._runBlocks); - runInvokeQueue(moduleFn._invokeQueue); - runInvokeQueue(moduleFn._configBlocks); - } else if (isFunction(module)) { - runBlocks.push(providerInjector.invoke(module)); - } else if (isArray(module)) { - runBlocks.push(providerInjector.invoke(module)); - } else { - assertArgFn(module, 'module'); - } - } catch (e) { - if (isArray(module)) { - module = module[module.length - 1]; - } - if (e.message && e.stack && e.stack.indexOf(e.message) === -1) { - // Safari & FF's stack traces don't contain error.message content - // unlike those of Chrome and IE - // So if stack doesn't contain message, we create a new string that contains both. - // Since error.stack is read-only in Safari, I'm overriding e and not e.stack here. - // eslint-disable-next-line no-ex-assign - e = e.message + '\n' + e.stack; - } - throw $injectorMinErr('modulerr', 'Failed to instantiate module {0} due to:\n{1}', - module, e.stack || e.message || e); - } - }); - return runBlocks; - } - - //////////////////////////////////// - // internal Injector - //////////////////////////////////// - - function createInternalInjector(cache, factory) { - - function getService(serviceName, caller) { - if (cache.hasOwnProperty(serviceName)) { - if (cache[serviceName] === INSTANTIATING) { - throw $injectorMinErr('cdep', 'Circular dependency found: {0}', - serviceName + ' <- ' + path.join(' <- ')); - } - return cache[serviceName]; - } else { - try { - path.unshift(serviceName); - cache[serviceName] = INSTANTIATING; - cache[serviceName] = factory(serviceName, caller); - return cache[serviceName]; - } catch (err) { - if (cache[serviceName] === INSTANTIATING) { - delete cache[serviceName]; - } - throw err; - } finally { - path.shift(); - } - } - } - - - function injectionArgs(fn, locals, serviceName) { - var args = [], - $inject = createInjector.$$annotate(fn, strictDi, serviceName); - - for (var i = 0, length = $inject.length; i < length; i++) { - var key = $inject[i]; - if (typeof key !== 'string') { - throw $injectorMinErr('itkn', - 'Incorrect injection token! Expected service name as string, got {0}', key); - } - args.push(locals && locals.hasOwnProperty(key) ? locals[key] : - getService(key, serviceName)); - } - return args; - } - - function isClass(func) { - // Support: IE 9-11 only - // IE 9-11 do not support classes and IE9 leaks with the code below. - if (msie || typeof func !== 'function') { - return false; - } - var result = func.$$ngIsClass; - if (!isBoolean(result)) { - result = func.$$ngIsClass = /^class\b/.test(stringifyFn(func)); - } - return result; - } - - function invoke(fn, self, locals, serviceName) { - if (typeof locals === 'string') { - serviceName = locals; - locals = null; - } - - var args = injectionArgs(fn, locals, serviceName); - if (isArray(fn)) { - fn = fn[fn.length - 1]; - } - - if (!isClass(fn)) { - // http://jsperf.com/angularjs-invoke-apply-vs-switch - // #5388 - return fn.apply(self, args); - } else { - args.unshift(null); - return new (Function.prototype.bind.apply(fn, args))(); - } - } - - - function instantiate(Type, locals, serviceName) { - // Check if Type is annotated and use just the given function at n-1 as parameter - // e.g. someModule.factory('greeter', ['$window', function(renamed$window) {}]); - var ctor = (isArray(Type) ? Type[Type.length - 1] : Type); - var args = injectionArgs(Type, locals, serviceName); - // Empty object at position 0 is ignored for invocation with `new`, but required. - args.unshift(null); - return new (Function.prototype.bind.apply(ctor, args))(); - } - - - return { - invoke: invoke, - instantiate: instantiate, - get: getService, - annotate: createInjector.$$annotate, - has: function(name) { - return providerCache.hasOwnProperty(name + providerSuffix) || cache.hasOwnProperty(name); - } - }; - } -} - -createInjector.$$annotate = annotate; - -/** - * @ngdoc provider - * @name $anchorScrollProvider - * @this - * - * @description - * Use `$anchorScrollProvider` to disable automatic scrolling whenever - * {@link ng.$location#hash $location.hash()} changes. - */ -function $AnchorScrollProvider() { - - var autoScrollingEnabled = true; - - /** - * @ngdoc method - * @name $anchorScrollProvider#disableAutoScrolling - * - * @description - * By default, {@link ng.$anchorScroll $anchorScroll()} will automatically detect changes to - * {@link ng.$location#hash $location.hash()} and scroll to the element matching the new hash.
    - * Use this method to disable automatic scrolling. - * - * If automatic scrolling is disabled, one must explicitly call - * {@link ng.$anchorScroll $anchorScroll()} in order to scroll to the element related to the - * current hash. - */ - this.disableAutoScrolling = function() { - autoScrollingEnabled = false; - }; - - /** - * @ngdoc service - * @name $anchorScroll - * @kind function - * @requires $window - * @requires $location - * @requires $rootScope - * - * @description - * When called, it scrolls to the element related to the specified `hash` or (if omitted) to the - * current value of {@link ng.$location#hash $location.hash()}, according to the rules specified - * in the - * [HTML5 spec](http://www.w3.org/html/wg/drafts/html/master/browsers.html#an-indicated-part-of-the-document). - * - * It also watches the {@link ng.$location#hash $location.hash()} and automatically scrolls to - * match any anchor whenever it changes. This can be disabled by calling - * {@link ng.$anchorScrollProvider#disableAutoScrolling $anchorScrollProvider.disableAutoScrolling()}. - * - * Additionally, you can use its {@link ng.$anchorScroll#yOffset yOffset} property to specify a - * vertical scroll-offset (either fixed or dynamic). - * - * @param {string=} hash The hash specifying the element to scroll to. If omitted, the value of - * {@link ng.$location#hash $location.hash()} will be used. - * - * @property {(number|function|jqLite)} yOffset - * If set, specifies a vertical scroll-offset. This is often useful when there are fixed - * positioned elements at the top of the page, such as navbars, headers etc. - * - * `yOffset` can be specified in various ways: - * - **number**: A fixed number of pixels to be used as offset.

    - * - **function**: A getter function called everytime `$anchorScroll()` is executed. Must return - * a number representing the offset (in pixels).

    - * - **jqLite**: A jqLite/jQuery element to be used for specifying the offset. The distance from - * the top of the page to the element's bottom will be used as offset.
    - * **Note**: The element will be taken into account only as long as its `position` is set to - * `fixed`. This option is useful, when dealing with responsive navbars/headers that adjust - * their height and/or positioning according to the viewport's size. - * - *
    - *
    - * In order for `yOffset` to work properly, scrolling should take place on the document's root and - * not some child element. - *
    - * - * @example - - -
    - Go to bottom - You're at the bottom! -
    -
    - - angular.module('anchorScrollExample', []) - .controller('ScrollController', ['$scope', '$location', '$anchorScroll', - function($scope, $location, $anchorScroll) { - $scope.gotoBottom = function() { - // set the location.hash to the id of - // the element you wish to scroll to. - $location.hash('bottom'); - - // call $anchorScroll() - $anchorScroll(); - }; - }]); - - - #scrollArea { - height: 280px; - overflow: auto; - } - - #bottom { - display: block; - margin-top: 2000px; - } - -
    - * - *
    - * The example below illustrates the use of a vertical scroll-offset (specified as a fixed value). - * See {@link ng.$anchorScroll#yOffset $anchorScroll.yOffset} for more details. - * - * @example - - - -
    - Anchor {{x}} of 5 -
    -
    - - angular.module('anchorScrollOffsetExample', []) - .run(['$anchorScroll', function($anchorScroll) { - $anchorScroll.yOffset = 50; // always scroll by 50 extra pixels - }]) - .controller('headerCtrl', ['$anchorScroll', '$location', '$scope', - function($anchorScroll, $location, $scope) { - $scope.gotoAnchor = function(x) { - var newHash = 'anchor' + x; - if ($location.hash() !== newHash) { - // set the $location.hash to `newHash` and - // $anchorScroll will automatically scroll to it - $location.hash('anchor' + x); - } else { - // call $anchorScroll() explicitly, - // since $location.hash hasn't changed - $anchorScroll(); - } - }; - } - ]); - - - body { - padding-top: 50px; - } - - .anchor { - border: 2px dashed DarkOrchid; - padding: 10px 10px 200px 10px; - } - - .fixed-header { - background-color: rgba(0, 0, 0, 0.2); - height: 50px; - position: fixed; - top: 0; left: 0; right: 0; - } - - .fixed-header > a { - display: inline-block; - margin: 5px 15px; - } - -
    - */ - this.$get = ['$window', '$location', '$rootScope', function($window, $location, $rootScope) { - var document = $window.document; - - // Helper function to get first anchor from a NodeList - // (using `Array#some()` instead of `angular#forEach()` since it's more performant - // and working in all supported browsers.) - function getFirstAnchor(list) { - var result = null; - Array.prototype.some.call(list, function(element) { - if (nodeName_(element) === 'a') { - result = element; - return true; - } - }); - return result; - } - - function getYOffset() { - - var offset = scroll.yOffset; - - if (isFunction(offset)) { - offset = offset(); - } else if (isElement(offset)) { - var elem = offset[0]; - var style = $window.getComputedStyle(elem); - if (style.position !== 'fixed') { - offset = 0; - } else { - offset = elem.getBoundingClientRect().bottom; - } - } else if (!isNumber(offset)) { - offset = 0; - } - - return offset; - } - - function scrollTo(elem) { - if (elem) { - elem.scrollIntoView(); - - var offset = getYOffset(); - - if (offset) { - // `offset` is the number of pixels we should scroll UP in order to align `elem` properly. - // This is true ONLY if the call to `elem.scrollIntoView()` initially aligns `elem` at the - // top of the viewport. - // - // IF the number of pixels from the top of `elem` to the end of the page's content is less - // than the height of the viewport, then `elem.scrollIntoView()` will align the `elem` some - // way down the page. - // - // This is often the case for elements near the bottom of the page. - // - // In such cases we do not need to scroll the whole `offset` up, just the difference between - // the top of the element and the offset, which is enough to align the top of `elem` at the - // desired position. - var elemTop = elem.getBoundingClientRect().top; - $window.scrollBy(0, elemTop - offset); - } - } else { - $window.scrollTo(0, 0); - } - } - - function scroll(hash) { - // Allow numeric hashes - hash = isString(hash) ? hash : isNumber(hash) ? hash.toString() : $location.hash(); - var elm; - - // empty hash, scroll to the top of the page - if (!hash) scrollTo(null); - - // element with given id - else if ((elm = document.getElementById(hash))) scrollTo(elm); - - // first anchor with given name :-D - else if ((elm = getFirstAnchor(document.getElementsByName(hash)))) scrollTo(elm); - - // no element and hash === 'top', scroll to the top of the page - else if (hash === 'top') scrollTo(null); - } - - // does not scroll when user clicks on anchor link that is currently on - // (no url change, no $location.hash() change), browser native does scroll - if (autoScrollingEnabled) { - $rootScope.$watch(function autoScrollWatch() {return $location.hash();}, - function autoScrollWatchAction(newVal, oldVal) { - // skip the initial scroll if $location.hash is empty - if (newVal === oldVal && newVal === '') return; - - jqLiteDocumentLoaded(function() { - $rootScope.$evalAsync(scroll); - }); - }); - } - - return scroll; - }]; -} - -var $animateMinErr = minErr('$animate'); -var ELEMENT_NODE = 1; -var NG_ANIMATE_CLASSNAME = 'ng-animate'; - -function mergeClasses(a,b) { - if (!a && !b) return ''; - if (!a) return b; - if (!b) return a; - if (isArray(a)) a = a.join(' '); - if (isArray(b)) b = b.join(' '); - return a + ' ' + b; -} - -function extractElementNode(element) { - for (var i = 0; i < element.length; i++) { - var elm = element[i]; - if (elm.nodeType === ELEMENT_NODE) { - return elm; - } - } -} - -function splitClasses(classes) { - if (isString(classes)) { - classes = classes.split(' '); - } - - // Use createMap() to prevent class assumptions involving property names in - // Object.prototype - var obj = createMap(); - forEach(classes, function(klass) { - // sometimes the split leaves empty string values - // incase extra spaces were applied to the options - if (klass.length) { - obj[klass] = true; - } - }); - return obj; -} - -// if any other type of options value besides an Object value is -// passed into the $animate.method() animation then this helper code -// will be run which will ignore it. While this patch is not the -// greatest solution to this, a lot of existing plugins depend on -// $animate to either call the callback (< 1.2) or return a promise -// that can be changed. This helper function ensures that the options -// are wiped clean incase a callback function is provided. -function prepareAnimateOptions(options) { - return isObject(options) - ? options - : {}; -} - -var $$CoreAnimateJsProvider = /** @this */ function() { - this.$get = noop; -}; - -// this is prefixed with Core since it conflicts with -// the animateQueueProvider defined in ngAnimate/animateQueue.js -var $$CoreAnimateQueueProvider = /** @this */ function() { - var postDigestQueue = new NgMap(); - var postDigestElements = []; - - this.$get = ['$$AnimateRunner', '$rootScope', - function($$AnimateRunner, $rootScope) { - return { - enabled: noop, - on: noop, - off: noop, - pin: noop, - - push: function(element, event, options, domOperation) { - if (domOperation) { - domOperation(); - } - - options = options || {}; - if (options.from) { - element.css(options.from); - } - if (options.to) { - element.css(options.to); - } - - if (options.addClass || options.removeClass) { - addRemoveClassesPostDigest(element, options.addClass, options.removeClass); - } - - var runner = new $$AnimateRunner(); - - // since there are no animations to run the runner needs to be - // notified that the animation call is complete. - runner.complete(); - return runner; - } - }; - - - function updateData(data, classes, value) { - var changed = false; - if (classes) { - classes = isString(classes) ? classes.split(' ') : - isArray(classes) ? classes : []; - forEach(classes, function(className) { - if (className) { - changed = true; - data[className] = value; - } - }); - } - return changed; - } - - function handleCSSClassChanges() { - forEach(postDigestElements, function(element) { - var data = postDigestQueue.get(element); - if (data) { - var existing = splitClasses(element.attr('class')); - var toAdd = ''; - var toRemove = ''; - forEach(data, function(status, className) { - var hasClass = !!existing[className]; - if (status !== hasClass) { - if (status) { - toAdd += (toAdd.length ? ' ' : '') + className; - } else { - toRemove += (toRemove.length ? ' ' : '') + className; - } - } - }); - - forEach(element, function(elm) { - if (toAdd) { - jqLiteAddClass(elm, toAdd); - } - if (toRemove) { - jqLiteRemoveClass(elm, toRemove); - } - }); - postDigestQueue.delete(element); - } - }); - postDigestElements.length = 0; - } - - - function addRemoveClassesPostDigest(element, add, remove) { - var data = postDigestQueue.get(element) || {}; - - var classesAdded = updateData(data, add, true); - var classesRemoved = updateData(data, remove, false); - - if (classesAdded || classesRemoved) { - - postDigestQueue.set(element, data); - postDigestElements.push(element); - - if (postDigestElements.length === 1) { - $rootScope.$$postDigest(handleCSSClassChanges); - } - } - } - }]; -}; - -/** - * @ngdoc provider - * @name $animateProvider - * - * @description - * Default implementation of $animate that doesn't perform any animations, instead just - * synchronously performs DOM updates and resolves the returned runner promise. - * - * In order to enable animations the `ngAnimate` module has to be loaded. - * - * To see the functional implementation check out `src/ngAnimate/animate.js`. - */ -var $AnimateProvider = ['$provide', /** @this */ function($provide) { - var provider = this; - var classNameFilter = null; - var customFilter = null; - - this.$$registeredAnimations = Object.create(null); - - /** - * @ngdoc method - * @name $animateProvider#register - * - * @description - * Registers a new injectable animation factory function. The factory function produces the - * animation object which contains callback functions for each event that is expected to be - * animated. - * - * * `eventFn`: `function(element, ... , doneFunction, options)` - * The element to animate, the `doneFunction` and the options fed into the animation. Depending - * on the type of animation additional arguments will be injected into the animation function. The - * list below explains the function signatures for the different animation methods: - * - * - setClass: function(element, addedClasses, removedClasses, doneFunction, options) - * - addClass: function(element, addedClasses, doneFunction, options) - * - removeClass: function(element, removedClasses, doneFunction, options) - * - enter, leave, move: function(element, doneFunction, options) - * - animate: function(element, fromStyles, toStyles, doneFunction, options) - * - * Make sure to trigger the `doneFunction` once the animation is fully complete. - * - * ```js - * return { - * //enter, leave, move signature - * eventFn : function(element, done, options) { - * //code to run the animation - * //once complete, then run done() - * return function endFunction(wasCancelled) { - * //code to cancel the animation - * } - * } - * } - * ``` - * - * @param {string} name The name of the animation (this is what the class-based CSS value will be compared to). - * @param {Function} factory The factory function that will be executed to return the animation - * object. - */ - this.register = function(name, factory) { - if (name && name.charAt(0) !== '.') { - throw $animateMinErr('notcsel', 'Expecting class selector starting with \'.\' got \'{0}\'.', name); - } - - var key = name + '-animation'; - provider.$$registeredAnimations[name.substr(1)] = key; - $provide.factory(key, factory); - }; - - /** - * @ngdoc method - * @name $animateProvider#customFilter - * - * @description - * Sets and/or returns the custom filter function that is used to "filter" animations, i.e. - * determine if an animation is allowed or not. When no filter is specified (the default), no - * animation will be blocked. Setting the `customFilter` value will only allow animations for - * which the filter function's return value is truthy. - * - * This allows to easily create arbitrarily complex rules for filtering animations, such as - * allowing specific events only, or enabling animations on specific subtrees of the DOM, etc. - * Filtering animations can also boost performance for low-powered devices, as well as - * applications containing a lot of structural operations. - * - *
    - * **Best Practice:** - * Keep the filtering function as lean as possible, because it will be called for each DOM - * action (e.g. insertion, removal, class change) performed by "animation-aware" directives. - * See {@link guide/animations#which-directives-support-animations- here} for a list of built-in - * directives that support animations. - * Performing computationally expensive or time-consuming operations on each call of the - * filtering function can make your animations sluggish. - *
    - * - * **Note:** If present, `customFilter` will be checked before - * {@link $animateProvider#classNameFilter classNameFilter}. - * - * @param {Function=} filterFn - The filter function which will be used to filter all animations. - * If a falsy value is returned, no animation will be performed. The function will be called - * with the following arguments: - * - **node** `{DOMElement}` - The DOM element to be animated. - * - **event** `{String}` - The name of the animation event (e.g. `enter`, `leave`, `addClass` - * etc). - * - **options** `{Object}` - A collection of options/styles used for the animation. - * @return {Function} The current filter function or `null` if there is none set. - */ - this.customFilter = function(filterFn) { - if (arguments.length === 1) { - customFilter = isFunction(filterFn) ? filterFn : null; - } - - return customFilter; - }; - - /** - * @ngdoc method - * @name $animateProvider#classNameFilter - * - * @description - * Sets and/or returns the CSS class regular expression that is checked when performing - * an animation. Upon bootstrap the classNameFilter value is not set at all and will - * therefore enable $animate to attempt to perform an animation on any element that is triggered. - * When setting the `classNameFilter` value, animations will only be performed on elements - * that successfully match the filter expression. This in turn can boost performance - * for low-powered devices as well as applications containing a lot of structural operations. - * - * **Note:** If present, `classNameFilter` will be checked after - * {@link $animateProvider#customFilter customFilter}. If `customFilter` is present and returns - * false, `classNameFilter` will not be checked. - * - * @param {RegExp=} expression The className expression which will be checked against all animations - * @return {RegExp} The current CSS className expression value. If null then there is no expression value - */ - this.classNameFilter = function(expression) { - if (arguments.length === 1) { - classNameFilter = (expression instanceof RegExp) ? expression : null; - if (classNameFilter) { - var reservedRegex = new RegExp('[(\\s|\\/)]' + NG_ANIMATE_CLASSNAME + '[(\\s|\\/)]'); - if (reservedRegex.test(classNameFilter.toString())) { - classNameFilter = null; - throw $animateMinErr('nongcls', '$animateProvider.classNameFilter(regex) prohibits accepting a regex value which matches/contains the "{0}" CSS class.', NG_ANIMATE_CLASSNAME); - } - } - } - return classNameFilter; - }; - - this.$get = ['$$animateQueue', function($$animateQueue) { - function domInsert(element, parentElement, afterElement) { - // if for some reason the previous element was removed - // from the dom sometime before this code runs then let's - // just stick to using the parent element as the anchor - if (afterElement) { - var afterNode = extractElementNode(afterElement); - if (afterNode && !afterNode.parentNode && !afterNode.previousElementSibling) { - afterElement = null; - } - } - if (afterElement) { - afterElement.after(element); - } else { - parentElement.prepend(element); - } - } - - /** - * @ngdoc service - * @name $animate - * @description The $animate service exposes a series of DOM utility methods that provide support - * for animation hooks. The default behavior is the application of DOM operations, however, - * when an animation is detected (and animations are enabled), $animate will do the heavy lifting - * to ensure that animation runs with the triggered DOM operation. - * - * By default $animate doesn't trigger any animations. This is because the `ngAnimate` module isn't - * included and only when it is active then the animation hooks that `$animate` triggers will be - * functional. Once active then all structural `ng-` directives will trigger animations as they perform - * their DOM-related operations (enter, leave and move). Other directives such as `ngClass`, - * `ngShow`, `ngHide` and `ngMessages` also provide support for animations. - * - * It is recommended that the`$animate` service is always used when executing DOM-related procedures within directives. - * - * To learn more about enabling animation support, click here to visit the - * {@link ngAnimate ngAnimate module page}. - */ - return { - // we don't call it directly since non-existant arguments may - // be interpreted as null within the sub enabled function - - /** - * - * @ngdoc method - * @name $animate#on - * @kind function - * @description Sets up an event listener to fire whenever the animation event (enter, leave, move, etc...) - * has fired on the given element or among any of its children. Once the listener is fired, the provided callback - * is fired with the following params: - * - * ```js - * $animate.on('enter', container, - * function callback(element, phase) { - * // cool we detected an enter animation within the container - * } - * ); - * ``` - * - *
    - * **Note**: Generally, the events that are fired correspond 1:1 to `$animate` method names, - * e.g. {@link ng.$animate#addClass addClass()} will fire `addClass`, and {@link ng.ngClass} - * will fire `addClass` if classes are added, and `removeClass` if classes are removed. - * However, there are two exceptions: - * - *
      - *
    • if both an {@link ng.$animate#addClass addClass()} and a - * {@link ng.$animate#removeClass removeClass()} action are performed during the same - * animation, the event fired will be `setClass`. This is true even for `ngClass`.
    • - *
    • an {@link ng.$animate#animate animate()} call that adds and removes classes will fire - * the `setClass` event, but if it either removes or adds classes, - * it will fire `animate` instead.
    • - *
    - * - *
    - * - * @param {string} event the animation event that will be captured (e.g. enter, leave, move, addClass, removeClass, etc...) - * @param {DOMElement} container the container element that will capture each of the animation events that are fired on itself - * as well as among its children - * @param {Function} callback the callback function that will be fired when the listener is triggered. - * - * The arguments present in the callback function are: - * * `element` - The captured DOM element that the animation was fired on. - * * `phase` - The phase of the animation. The two possible phases are **start** (when the animation starts) and **close** (when it ends). - * * `data` - an object with these properties: - * * addClass - `{string|null}` - space-separated CSS classes to add to the element - * * removeClass - `{string|null}` - space-separated CSS classes to remove from the element - * * from - `{Object|null}` - CSS properties & values at the beginning of the animation - * * to - `{Object|null}` - CSS properties & values at the end of the animation - * - * Note that the callback does not trigger a scope digest. Wrap your call into a - * {@link $rootScope.Scope#$apply scope.$apply} to propagate changes to the scope. - */ - on: $$animateQueue.on, - - /** - * - * @ngdoc method - * @name $animate#off - * @kind function - * @description Deregisters an event listener based on the event which has been associated with the provided element. This method - * can be used in three different ways depending on the arguments: - * - * ```js - * // remove all the animation event listeners listening for `enter` - * $animate.off('enter'); - * - * // remove listeners for all animation events from the container element - * $animate.off(container); - * - * // remove all the animation event listeners listening for `enter` on the given element and its children - * $animate.off('enter', container); - * - * // remove the event listener function provided by `callback` that is set - * // to listen for `enter` on the given `container` as well as its children - * $animate.off('enter', container, callback); - * ``` - * - * @param {string|DOMElement} event|container the animation event (e.g. enter, leave, move, - * addClass, removeClass, etc...), or the container element. If it is the element, all other - * arguments are ignored. - * @param {DOMElement=} container the container element the event listener was placed on - * @param {Function=} callback the callback function that was registered as the listener - */ - off: $$animateQueue.off, - - /** - * @ngdoc method - * @name $animate#pin - * @kind function - * @description Associates the provided element with a host parent element to allow the element to be animated even if it exists - * outside of the DOM structure of the AngularJS application. By doing so, any animation triggered via `$animate` can be issued on the - * element despite being outside the realm of the application or within another application. Say for example if the application - * was bootstrapped on an element that is somewhere inside of the `` tag, but we wanted to allow for an element to be situated - * as a direct child of `document.body`, then this can be achieved by pinning the element via `$animate.pin(element)`. Keep in mind - * that calling `$animate.pin(element, parentElement)` will not actually insert into the DOM anywhere; it will just create the association. - * - * Note that this feature is only active when the `ngAnimate` module is used. - * - * @param {DOMElement} element the external element that will be pinned - * @param {DOMElement} parentElement the host parent element that will be associated with the external element - */ - pin: $$animateQueue.pin, - - /** - * - * @ngdoc method - * @name $animate#enabled - * @kind function - * @description Used to get and set whether animations are enabled or not on the entire application or on an element and its children. This - * function can be called in four ways: - * - * ```js - * // returns true or false - * $animate.enabled(); - * - * // changes the enabled state for all animations - * $animate.enabled(false); - * $animate.enabled(true); - * - * // returns true or false if animations are enabled for an element - * $animate.enabled(element); - * - * // changes the enabled state for an element and its children - * $animate.enabled(element, true); - * $animate.enabled(element, false); - * ``` - * - * @param {DOMElement=} element the element that will be considered for checking/setting the enabled state - * @param {boolean=} enabled whether or not the animations will be enabled for the element - * - * @return {boolean} whether or not animations are enabled - */ - enabled: $$animateQueue.enabled, - - /** - * @ngdoc method - * @name $animate#cancel - * @kind function - * @description Cancels the provided animation and applies the end state of the animation. - * Note that this does not cancel the underlying operation, e.g. the setting of classes or - * adding the element to the DOM. - * - * @param {animationRunner} animationRunner An animation runner returned by an $animate function. - * - * @example - - - angular.module('animationExample', ['ngAnimate']).component('cancelExample', { - templateUrl: 'template.html', - controller: function($element, $animate) { - this.runner = null; - - this.addClass = function() { - this.runner = $animate.addClass($element.find('div'), 'red'); - var ctrl = this; - this.runner.finally(function() { - ctrl.runner = null; - }); - }; - - this.removeClass = function() { - this.runner = $animate.removeClass($element.find('div'), 'red'); - var ctrl = this; - this.runner.finally(function() { - ctrl.runner = null; - }); - }; - - this.cancel = function() { - $animate.cancel(this.runner); - }; - } - }); - - -

    - - -
    - -
    -

    CSS-Animated Text
    -

    -
    - - - - - .red-add, .red-remove { - transition: all 4s cubic-bezier(0.250, 0.460, 0.450, 0.940); - } - - .red, - .red-add.red-add-active { - color: #FF0000; - font-size: 40px; - } - - .red-remove.red-remove-active { - font-size: 10px; - color: black; - } - - -
    - */ - cancel: function(runner) { - if (runner.cancel) { - runner.cancel(); - } - }, - - /** - * - * @ngdoc method - * @name $animate#enter - * @kind function - * @description Inserts the element into the DOM either after the `after` element (if provided) or - * as the first child within the `parent` element and then triggers an animation. - * A promise is returned that will be resolved during the next digest once the animation - * has completed. - * - * @param {DOMElement} element the element which will be inserted into the DOM - * @param {DOMElement} parent the parent element which will append the element as - * a child (so long as the after element is not present) - * @param {DOMElement=} after the sibling element after which the element will be appended - * @param {object=} options an optional collection of options/styles that will be applied to the element. - * The object can have the following properties: - * - * - **addClass** - `{string}` - space-separated CSS classes to add to element - * - **from** - `{Object}` - CSS properties & values at the beginning of animation. Must have matching `to` - * - **removeClass** - `{string}` - space-separated CSS classes to remove from element - * - **to** - `{Object}` - CSS properties & values at end of animation. Must have matching `from` - * - * @return {Runner} the animation runner - */ - enter: function(element, parent, after, options) { - parent = parent && jqLite(parent); - after = after && jqLite(after); - parent = parent || after.parent(); - domInsert(element, parent, after); - return $$animateQueue.push(element, 'enter', prepareAnimateOptions(options)); - }, - - /** - * - * @ngdoc method - * @name $animate#move - * @kind function - * @description Inserts (moves) the element into its new position in the DOM either after - * the `after` element (if provided) or as the first child within the `parent` element - * and then triggers an animation. A promise is returned that will be resolved - * during the next digest once the animation has completed. - * - * @param {DOMElement} element the element which will be moved into the new DOM position - * @param {DOMElement} parent the parent element which will append the element as - * a child (so long as the after element is not present) - * @param {DOMElement=} after the sibling element after which the element will be appended - * @param {object=} options an optional collection of options/styles that will be applied to the element. - * The object can have the following properties: - * - * - **addClass** - `{string}` - space-separated CSS classes to add to element - * - **from** - `{Object}` - CSS properties & values at the beginning of animation. Must have matching `to` - * - **removeClass** - `{string}` - space-separated CSS classes to remove from element - * - **to** - `{Object}` - CSS properties & values at end of animation. Must have matching `from` - * - * @return {Runner} the animation runner - */ - move: function(element, parent, after, options) { - parent = parent && jqLite(parent); - after = after && jqLite(after); - parent = parent || after.parent(); - domInsert(element, parent, after); - return $$animateQueue.push(element, 'move', prepareAnimateOptions(options)); - }, - - /** - * @ngdoc method - * @name $animate#leave - * @kind function - * @description Triggers an animation and then removes the element from the DOM. - * When the function is called a promise is returned that will be resolved during the next - * digest once the animation has completed. - * - * @param {DOMElement} element the element which will be removed from the DOM - * @param {object=} options an optional collection of options/styles that will be applied to the element. - * The object can have the following properties: - * - * - **addClass** - `{string}` - space-separated CSS classes to add to element - * - **from** - `{Object}` - CSS properties & values at the beginning of animation. Must have matching `to` - * - **removeClass** - `{string}` - space-separated CSS classes to remove from element - * - **to** - `{Object}` - CSS properties & values at end of animation. Must have matching `from` - * - * @return {Runner} the animation runner - */ - leave: function(element, options) { - return $$animateQueue.push(element, 'leave', prepareAnimateOptions(options), function() { - element.remove(); - }); - }, - - /** - * @ngdoc method - * @name $animate#addClass - * @kind function - * - * @description Triggers an addClass animation surrounding the addition of the provided CSS class(es). Upon - * execution, the addClass operation will only be handled after the next digest and it will not trigger an - * animation if element already contains the CSS class or if the class is removed at a later step. - * Note that class-based animations are treated differently compared to structural animations - * (like enter, move and leave) since the CSS classes may be added/removed at different points - * depending if CSS or JavaScript animations are used. - * - * @param {DOMElement} element the element which the CSS classes will be applied to - * @param {string} className the CSS class(es) that will be added (multiple classes are separated via spaces) - * @param {object=} options an optional collection of options/styles that will be applied to the element. - * The object can have the following properties: - * - * - **removeClass** - `{string}` - space-separated CSS classes to remove from element - * - **from** - `{Object}` - CSS properties & values at the beginning of animation. Must have matching `to` - * - **to** - `{Object}` - CSS properties & values at end of animation. Must have matching `from` - * - * @return {Runner} animationRunner the animation runner - */ - addClass: function(element, className, options) { - options = prepareAnimateOptions(options); - options.addClass = mergeClasses(options.addclass, className); - return $$animateQueue.push(element, 'addClass', options); - }, - - /** - * @ngdoc method - * @name $animate#removeClass - * @kind function - * - * @description Triggers a removeClass animation surrounding the removal of the provided CSS class(es). Upon - * execution, the removeClass operation will only be handled after the next digest and it will not trigger an - * animation if element does not contain the CSS class or if the class is added at a later step. - * Note that class-based animations are treated differently compared to structural animations - * (like enter, move and leave) since the CSS classes may be added/removed at different points - * depending if CSS or JavaScript animations are used. - * - * @param {DOMElement} element the element which the CSS classes will be applied to - * @param {string} className the CSS class(es) that will be removed (multiple classes are separated via spaces) - * @param {object=} options an optional collection of options/styles that will be applied to the element. - * The object can have the following properties: - * - * - **addClass** - `{string}` - space-separated CSS classes to add to element - * - **from** - `{Object}` - CSS properties & values at the beginning of animation. Must have matching `to` - * - **to** - `{Object}` - CSS properties & values at end of animation. Must have matching `from` - * - * @return {Runner} the animation runner - */ - removeClass: function(element, className, options) { - options = prepareAnimateOptions(options); - options.removeClass = mergeClasses(options.removeClass, className); - return $$animateQueue.push(element, 'removeClass', options); - }, - - /** - * @ngdoc method - * @name $animate#setClass - * @kind function - * - * @description Performs both the addition and removal of a CSS classes on an element and (during the process) - * triggers an animation surrounding the class addition/removal. Much like `$animate.addClass` and - * `$animate.removeClass`, `setClass` will only evaluate the classes being added/removed once a digest has - * passed. Note that class-based animations are treated differently compared to structural animations - * (like enter, move and leave) since the CSS classes may be added/removed at different points - * depending if CSS or JavaScript animations are used. - * - * @param {DOMElement} element the element which the CSS classes will be applied to - * @param {string} add the CSS class(es) that will be added (multiple classes are separated via spaces) - * @param {string} remove the CSS class(es) that will be removed (multiple classes are separated via spaces) - * @param {object=} options an optional collection of options/styles that will be applied to the element. - * The object can have the following properties: - * - * - **addClass** - `{string}` - space-separated CSS classes to add to element - * - **removeClass** - `{string}` - space-separated CSS classes to remove from element - * - **from** - `{Object}` - CSS properties & values at the beginning of animation. Must have matching `to` - * - **to** - `{Object}` - CSS properties & values at end of animation. Must have matching `from` - * - * @return {Runner} the animation runner - */ - setClass: function(element, add, remove, options) { - options = prepareAnimateOptions(options); - options.addClass = mergeClasses(options.addClass, add); - options.removeClass = mergeClasses(options.removeClass, remove); - return $$animateQueue.push(element, 'setClass', options); - }, - - /** - * @ngdoc method - * @name $animate#animate - * @kind function - * - * @description Performs an inline animation on the element which applies the provided to and from CSS styles to the element. - * If any detected CSS transition, keyframe or JavaScript matches the provided className value, then the animation will take - * on the provided styles. For example, if a transition animation is set for the given className, then the provided `from` and - * `to` styles will be applied alongside the given transition. If the CSS style provided in `from` does not have a corresponding - * style in `to`, the style in `from` is applied immediately, and no animation is run. - * If a JavaScript animation is detected then the provided styles will be given in as function parameters into the `animate` - * method (or as part of the `options` parameter): - * - * ```js - * ngModule.animation('.my-inline-animation', function() { - * return { - * animate : function(element, from, to, done, options) { - * //animation - * done(); - * } - * } - * }); - * ``` - * - * @param {DOMElement} element the element which the CSS styles will be applied to - * @param {object} from the from (starting) CSS styles that will be applied to the element and across the animation. - * @param {object} to the to (destination) CSS styles that will be applied to the element and across the animation. - * @param {string=} className an optional CSS class that will be applied to the element for the duration of the animation. If - * this value is left as empty then a CSS class of `ng-inline-animate` will be applied to the element. - * (Note that if no animation is detected then this value will not be applied to the element.) - * @param {object=} options an optional collection of options/styles that will be applied to the element. - * The object can have the following properties: - * - * - **addClass** - `{string}` - space-separated CSS classes to add to element - * - **from** - `{Object}` - CSS properties & values at the beginning of animation. Must have matching `to` - * - **removeClass** - `{string}` - space-separated CSS classes to remove from element - * - **to** - `{Object}` - CSS properties & values at end of animation. Must have matching `from` - * - * @return {Runner} the animation runner - */ - animate: function(element, from, to, className, options) { - options = prepareAnimateOptions(options); - options.from = options.from ? extend(options.from, from) : from; - options.to = options.to ? extend(options.to, to) : to; - - className = className || 'ng-inline-animate'; - options.tempClasses = mergeClasses(options.tempClasses, className); - return $$animateQueue.push(element, 'animate', options); - } - }; - }]; -}]; - -var $$AnimateAsyncRunFactoryProvider = /** @this */ function() { - this.$get = ['$$rAF', function($$rAF) { - var waitQueue = []; - - function waitForTick(fn) { - waitQueue.push(fn); - if (waitQueue.length > 1) return; - $$rAF(function() { - for (var i = 0; i < waitQueue.length; i++) { - waitQueue[i](); - } - waitQueue = []; - }); - } - - return function() { - var passed = false; - waitForTick(function() { - passed = true; - }); - return function(callback) { - if (passed) { - callback(); - } else { - waitForTick(callback); - } - }; - }; - }]; -}; - -var $$AnimateRunnerFactoryProvider = /** @this */ function() { - this.$get = ['$q', '$sniffer', '$$animateAsyncRun', '$$isDocumentHidden', '$timeout', - function($q, $sniffer, $$animateAsyncRun, $$isDocumentHidden, $timeout) { - - var INITIAL_STATE = 0; - var DONE_PENDING_STATE = 1; - var DONE_COMPLETE_STATE = 2; - - AnimateRunner.chain = function(chain, callback) { - var index = 0; - - next(); - function next() { - if (index === chain.length) { - callback(true); - return; - } - - chain[index](function(response) { - if (response === false) { - callback(false); - return; - } - index++; - next(); - }); - } - }; - - AnimateRunner.all = function(runners, callback) { - var count = 0; - var status = true; - forEach(runners, function(runner) { - runner.done(onProgress); - }); - - function onProgress(response) { - status = status && response; - if (++count === runners.length) { - callback(status); - } - } - }; - - function AnimateRunner(host) { - this.setHost(host); - - var rafTick = $$animateAsyncRun(); - var timeoutTick = function(fn) { - $timeout(fn, 0, false); - }; - - this._doneCallbacks = []; - this._tick = function(fn) { - if ($$isDocumentHidden()) { - timeoutTick(fn); - } else { - rafTick(fn); - } - }; - this._state = 0; - } - - AnimateRunner.prototype = { - setHost: function(host) { - this.host = host || {}; - }, - - done: function(fn) { - if (this._state === DONE_COMPLETE_STATE) { - fn(); - } else { - this._doneCallbacks.push(fn); - } - }, - - progress: noop, - - getPromise: function() { - if (!this.promise) { - var self = this; - this.promise = $q(function(resolve, reject) { - self.done(function(status) { - if (status === false) { - reject(); - } else { - resolve(); - } - }); - }); - } - return this.promise; - }, - - then: function(resolveHandler, rejectHandler) { - return this.getPromise().then(resolveHandler, rejectHandler); - }, - - 'catch': function(handler) { - return this.getPromise()['catch'](handler); - }, - - 'finally': function(handler) { - return this.getPromise()['finally'](handler); - }, - - pause: function() { - if (this.host.pause) { - this.host.pause(); - } - }, - - resume: function() { - if (this.host.resume) { - this.host.resume(); - } - }, - - end: function() { - if (this.host.end) { - this.host.end(); - } - this._resolve(true); - }, - - cancel: function() { - if (this.host.cancel) { - this.host.cancel(); - } - this._resolve(false); - }, - - complete: function(response) { - var self = this; - if (self._state === INITIAL_STATE) { - self._state = DONE_PENDING_STATE; - self._tick(function() { - self._resolve(response); - }); - } - }, - - _resolve: function(response) { - if (this._state !== DONE_COMPLETE_STATE) { - forEach(this._doneCallbacks, function(fn) { - fn(response); - }); - this._doneCallbacks.length = 0; - this._state = DONE_COMPLETE_STATE; - } - } - }; - - return AnimateRunner; - }]; -}; - -/* exported $CoreAnimateCssProvider */ - -/** - * @ngdoc service - * @name $animateCss - * @kind object - * @this - * - * @description - * This is the core version of `$animateCss`. By default, only when the `ngAnimate` is included, - * then the `$animateCss` service will actually perform animations. - * - * Click here {@link ngAnimate.$animateCss to read the documentation for $animateCss}. - */ -var $CoreAnimateCssProvider = function() { - this.$get = ['$$rAF', '$q', '$$AnimateRunner', function($$rAF, $q, $$AnimateRunner) { - - return function(element, initialOptions) { - // all of the animation functions should create - // a copy of the options data, however, if a - // parent service has already created a copy then - // we should stick to using that - var options = initialOptions || {}; - if (!options.$$prepared) { - options = copy(options); - } - - // there is no point in applying the styles since - // there is no animation that goes on at all in - // this version of $animateCss. - if (options.cleanupStyles) { - options.from = options.to = null; - } - - if (options.from) { - element.css(options.from); - options.from = null; - } - - var closed, runner = new $$AnimateRunner(); - return { - start: run, - end: run - }; - - function run() { - $$rAF(function() { - applyAnimationContents(); - if (!closed) { - runner.complete(); - } - closed = true; - }); - return runner; - } - - function applyAnimationContents() { - if (options.addClass) { - element.addClass(options.addClass); - options.addClass = null; - } - if (options.removeClass) { - element.removeClass(options.removeClass); - options.removeClass = null; - } - if (options.to) { - element.css(options.to); - options.to = null; - } - } - }; - }]; -}; - -/* global getHash: true, stripHash: false */ - -function getHash(url) { - var index = url.indexOf('#'); - return index === -1 ? '' : url.substr(index); -} - -function trimEmptyHash(url) { - return url.replace(/#$/, ''); -} - -/** - * ! This is a private undocumented service ! - * - * @name $browser - * @requires $log - * @description - * This object has two goals: - * - * - hide all the global state in the browser caused by the window object - * - abstract away all the browser specific features and inconsistencies - * - * For tests we provide {@link ngMock.$browser mock implementation} of the `$browser` - * service, which can be used for convenient testing of the application without the interaction with - * the real browser apis. - */ -/** - * @param {object} window The global window object. - * @param {object} document jQuery wrapped document. - * @param {object} $log window.console or an object with the same interface. - * @param {object} $sniffer $sniffer service - */ -function Browser(window, document, $log, $sniffer, $$taskTrackerFactory) { - var self = this, - location = window.location, - history = window.history, - setTimeout = window.setTimeout, - clearTimeout = window.clearTimeout, - pendingDeferIds = {}, - taskTracker = $$taskTrackerFactory($log); - - self.isMock = false; - - ////////////////////////////////////////////////////////////// - // Task-tracking API - ////////////////////////////////////////////////////////////// - - // TODO(vojta): remove this temporary api - self.$$completeOutstandingRequest = taskTracker.completeTask; - self.$$incOutstandingRequestCount = taskTracker.incTaskCount; - - // TODO(vojta): prefix this method with $$ ? - self.notifyWhenNoOutstandingRequests = taskTracker.notifyWhenNoPendingTasks; - - ////////////////////////////////////////////////////////////// - // URL API - ////////////////////////////////////////////////////////////// - - var cachedState, lastHistoryState, - lastBrowserUrl = location.href, - baseElement = document.find('base'), - pendingLocation = null, - getCurrentState = !$sniffer.history ? noop : function getCurrentState() { - try { - return history.state; - } catch (e) { - // MSIE can reportedly throw when there is no state (UNCONFIRMED). - } - }; - - cacheState(); - - /** - * @name $browser#url - * - * @description - * GETTER: - * Without any argument, this method just returns current value of `location.href` (with a - * trailing `#` stripped of if the hash is empty). - * - * SETTER: - * With at least one argument, this method sets url to new value. - * If html5 history api supported, `pushState`/`replaceState` is used, otherwise - * `location.href`/`location.replace` is used. - * Returns its own instance to allow chaining. - * - * NOTE: this api is intended for use only by the `$location` service. Please use the - * {@link ng.$location $location service} to change url. - * - * @param {string} url New url (when used as setter) - * @param {boolean=} replace Should new url replace current history record? - * @param {object=} state State object to use with `pushState`/`replaceState` - */ - self.url = function(url, replace, state) { - // In modern browsers `history.state` is `null` by default; treating it separately - // from `undefined` would cause `$browser.url('/foo')` to change `history.state` - // to undefined via `pushState`. Instead, let's change `undefined` to `null` here. - if (isUndefined(state)) { - state = null; - } - - // Android Browser BFCache causes location, history reference to become stale. - if (location !== window.location) location = window.location; - if (history !== window.history) history = window.history; - - // setter - if (url) { - var sameState = lastHistoryState === state; - - // Normalize the inputted URL - url = urlResolve(url).href; - - // Don't change anything if previous and current URLs and states match. This also prevents - // IE<10 from getting into redirect loop when in LocationHashbangInHtml5Url mode. - // See https://github.com/angular/angular.js/commit/ffb2701 - if (lastBrowserUrl === url && (!$sniffer.history || sameState)) { - return self; - } - var sameBase = lastBrowserUrl && stripHash(lastBrowserUrl) === stripHash(url); - lastBrowserUrl = url; - lastHistoryState = state; - // Don't use history API if only the hash changed - // due to a bug in IE10/IE11 which leads - // to not firing a `hashchange` nor `popstate` event - // in some cases (see #9143). - if ($sniffer.history && (!sameBase || !sameState)) { - history[replace ? 'replaceState' : 'pushState'](state, '', url); - cacheState(); - } else { - if (!sameBase) { - pendingLocation = url; - } - if (replace) { - location.replace(url); - } else if (!sameBase) { - location.href = url; - } else { - location.hash = getHash(url); - } - if (location.href !== url) { - pendingLocation = url; - } - } - if (pendingLocation) { - pendingLocation = url; - } - return self; - // getter - } else { - // - pendingLocation is needed as browsers don't allow to read out - // the new location.href if a reload happened or if there is a bug like in iOS 9 (see - // https://openradar.appspot.com/22186109). - return trimEmptyHash(pendingLocation || location.href); - } - }; - - /** - * @name $browser#state - * - * @description - * This method is a getter. - * - * Return history.state or null if history.state is undefined. - * - * @returns {object} state - */ - self.state = function() { - return cachedState; - }; - - var urlChangeListeners = [], - urlChangeInit = false; - - function cacheStateAndFireUrlChange() { - pendingLocation = null; - fireStateOrUrlChange(); - } - - // This variable should be used *only* inside the cacheState function. - var lastCachedState = null; - function cacheState() { - // This should be the only place in $browser where `history.state` is read. - cachedState = getCurrentState(); - cachedState = isUndefined(cachedState) ? null : cachedState; - - // Prevent callbacks fo fire twice if both hashchange & popstate were fired. - if (equals(cachedState, lastCachedState)) { - cachedState = lastCachedState; - } - - lastCachedState = cachedState; - lastHistoryState = cachedState; - } - - function fireStateOrUrlChange() { - var prevLastHistoryState = lastHistoryState; - cacheState(); - - if (lastBrowserUrl === self.url() && prevLastHistoryState === cachedState) { - return; - } - - lastBrowserUrl = self.url(); - lastHistoryState = cachedState; - forEach(urlChangeListeners, function(listener) { - listener(self.url(), cachedState); - }); - } - - /** - * @name $browser#onUrlChange - * - * @description - * Register callback function that will be called, when url changes. - * - * It's only called when the url is changed from outside of AngularJS: - * - user types different url into address bar - * - user clicks on history (forward/back) button - * - user clicks on a link - * - * It's not called when url is changed by $browser.url() method - * - * The listener gets called with new url as parameter. - * - * NOTE: this api is intended for use only by the $location service. Please use the - * {@link ng.$location $location service} to monitor url changes in AngularJS apps. - * - * @param {function(string)} listener Listener function to be called when url changes. - * @return {function(string)} Returns the registered listener fn - handy if the fn is anonymous. - */ - self.onUrlChange = function(callback) { - // TODO(vojta): refactor to use node's syntax for events - if (!urlChangeInit) { - // We listen on both (hashchange/popstate) when available, as some browsers don't - // fire popstate when user changes the address bar and don't fire hashchange when url - // changed by push/replaceState - - // html5 history api - popstate event - if ($sniffer.history) jqLite(window).on('popstate', cacheStateAndFireUrlChange); - // hashchange event - jqLite(window).on('hashchange', cacheStateAndFireUrlChange); - - urlChangeInit = true; - } - - urlChangeListeners.push(callback); - return callback; - }; - - /** - * @private - * Remove popstate and hashchange handler from window. - * - * NOTE: this api is intended for use only by $rootScope. - */ - self.$$applicationDestroyed = function() { - jqLite(window).off('hashchange popstate', cacheStateAndFireUrlChange); - }; - - /** - * Checks whether the url has changed outside of AngularJS. - * Needs to be exported to be able to check for changes that have been done in sync, - * as hashchange/popstate events fire in async. - */ - self.$$checkUrlChange = fireStateOrUrlChange; - - ////////////////////////////////////////////////////////////// - // Misc API - ////////////////////////////////////////////////////////////// - - /** - * @name $browser#baseHref - * - * @description - * Returns current - * (always relative - without domain) - * - * @returns {string} The current base href - */ - self.baseHref = function() { - var href = baseElement.attr('href'); - return href ? href.replace(/^(https?:)?\/\/[^/]*/, '') : ''; - }; - - /** - * @name $browser#defer - * @param {function()} fn A function, who's execution should be deferred. - * @param {number=} [delay=0] Number of milliseconds to defer the function execution. - * @param {string=} [taskType=DEFAULT_TASK_TYPE] The type of task that is deferred. - * @returns {*} DeferId that can be used to cancel the task via `$browser.defer.cancel()`. - * - * @description - * Executes a fn asynchronously via `setTimeout(fn, delay)`. - * - * Unlike when calling `setTimeout` directly, in test this function is mocked and instead of using - * `setTimeout` in tests, the fns are queued in an array, which can be programmatically flushed - * via `$browser.defer.flush()`. - * - */ - self.defer = function(fn, delay, taskType) { - var timeoutId; - - delay = delay || 0; - taskType = taskType || taskTracker.DEFAULT_TASK_TYPE; - - taskTracker.incTaskCount(taskType); - timeoutId = setTimeout(function() { - delete pendingDeferIds[timeoutId]; - taskTracker.completeTask(fn, taskType); - }, delay); - pendingDeferIds[timeoutId] = taskType; - - return timeoutId; - }; - - - /** - * @name $browser#defer.cancel - * - * @description - * Cancels a deferred task identified with `deferId`. - * - * @param {*} deferId Token returned by the `$browser.defer` function. - * @returns {boolean} Returns `true` if the task hasn't executed yet and was successfully - * canceled. - */ - self.defer.cancel = function(deferId) { - if (pendingDeferIds.hasOwnProperty(deferId)) { - var taskType = pendingDeferIds[deferId]; - delete pendingDeferIds[deferId]; - clearTimeout(deferId); - taskTracker.completeTask(noop, taskType); - return true; - } - return false; - }; - -} - -/** @this */ -function $BrowserProvider() { - this.$get = ['$window', '$log', '$sniffer', '$document', '$$taskTrackerFactory', - function($window, $log, $sniffer, $document, $$taskTrackerFactory) { - return new Browser($window, $document, $log, $sniffer, $$taskTrackerFactory); - }]; -} - -/** - * @ngdoc service - * @name $cacheFactory - * @this - * - * @description - * Factory that constructs {@link $cacheFactory.Cache Cache} objects and gives access to - * them. - * - * ```js - * - * var cache = $cacheFactory('cacheId'); - * expect($cacheFactory.get('cacheId')).toBe(cache); - * expect($cacheFactory.get('noSuchCacheId')).not.toBeDefined(); - * - * cache.put("key", "value"); - * cache.put("another key", "another value"); - * - * // We've specified no options on creation - * expect(cache.info()).toEqual({id: 'cacheId', size: 2}); - * - * ``` - * - * - * @param {string} cacheId Name or id of the newly created cache. - * @param {object=} options Options object that specifies the cache behavior. Properties: - * - * - `{number=}` `capacity` — turns the cache into LRU cache. - * - * @returns {object} Newly created cache object with the following set of methods: - * - * - `{object}` `info()` — Returns id, size, and options of cache. - * - `{{*}}` `put({string} key, {*} value)` — Puts a new key-value pair into the cache and returns - * it. - * - `{{*}}` `get({string} key)` — Returns cached value for `key` or undefined for cache miss. - * - `{void}` `remove({string} key)` — Removes a key-value pair from the cache. - * - `{void}` `removeAll()` — Removes all cached values. - * - `{void}` `destroy()` — Removes references to this cache from $cacheFactory. - * - * @example - - -
    - - - - -

    Cached Values

    -
    - - : - -
    - -

    Cache Info

    -
    - - : - -
    -
    -
    - - angular.module('cacheExampleApp', []). - controller('CacheController', ['$scope', '$cacheFactory', function($scope, $cacheFactory) { - $scope.keys = []; - $scope.cache = $cacheFactory('cacheId'); - $scope.put = function(key, value) { - if (angular.isUndefined($scope.cache.get(key))) { - $scope.keys.push(key); - } - $scope.cache.put(key, angular.isUndefined(value) ? null : value); - }; - }]); - - - p { - margin: 10px 0 3px; - } - -
    - */ -function $CacheFactoryProvider() { - - this.$get = function() { - var caches = {}; - - function cacheFactory(cacheId, options) { - if (cacheId in caches) { - throw minErr('$cacheFactory')('iid', 'CacheId \'{0}\' is already taken!', cacheId); - } - - var size = 0, - stats = extend({}, options, {id: cacheId}), - data = createMap(), - capacity = (options && options.capacity) || Number.MAX_VALUE, - lruHash = createMap(), - freshEnd = null, - staleEnd = null; - - /** - * @ngdoc type - * @name $cacheFactory.Cache - * - * @description - * A cache object used to store and retrieve data, primarily used by - * {@link $templateRequest $templateRequest} and the {@link ng.directive:script script} - * directive to cache templates and other data. - * - * ```js - * angular.module('superCache') - * .factory('superCache', ['$cacheFactory', function($cacheFactory) { - * return $cacheFactory('super-cache'); - * }]); - * ``` - * - * Example test: - * - * ```js - * it('should behave like a cache', inject(function(superCache) { - * superCache.put('key', 'value'); - * superCache.put('another key', 'another value'); - * - * expect(superCache.info()).toEqual({ - * id: 'super-cache', - * size: 2 - * }); - * - * superCache.remove('another key'); - * expect(superCache.get('another key')).toBeUndefined(); - * - * superCache.removeAll(); - * expect(superCache.info()).toEqual({ - * id: 'super-cache', - * size: 0 - * }); - * })); - * ``` - */ - return (caches[cacheId] = { - - /** - * @ngdoc method - * @name $cacheFactory.Cache#put - * @kind function - * - * @description - * Inserts a named entry into the {@link $cacheFactory.Cache Cache} object to be - * retrieved later, and incrementing the size of the cache if the key was not already - * present in the cache. If behaving like an LRU cache, it will also remove stale - * entries from the set. - * - * It will not insert undefined values into the cache. - * - * @param {string} key the key under which the cached data is stored. - * @param {*} value the value to store alongside the key. If it is undefined, the key - * will not be stored. - * @returns {*} the value stored. - */ - put: function(key, value) { - if (isUndefined(value)) return; - if (capacity < Number.MAX_VALUE) { - var lruEntry = lruHash[key] || (lruHash[key] = {key: key}); - - refresh(lruEntry); - } - - if (!(key in data)) size++; - data[key] = value; - - if (size > capacity) { - this.remove(staleEnd.key); - } - - return value; - }, - - /** - * @ngdoc method - * @name $cacheFactory.Cache#get - * @kind function - * - * @description - * Retrieves named data stored in the {@link $cacheFactory.Cache Cache} object. - * - * @param {string} key the key of the data to be retrieved - * @returns {*} the value stored. - */ - get: function(key) { - if (capacity < Number.MAX_VALUE) { - var lruEntry = lruHash[key]; - - if (!lruEntry) return; - - refresh(lruEntry); - } - - return data[key]; - }, - - - /** - * @ngdoc method - * @name $cacheFactory.Cache#remove - * @kind function - * - * @description - * Removes an entry from the {@link $cacheFactory.Cache Cache} object. - * - * @param {string} key the key of the entry to be removed - */ - remove: function(key) { - if (capacity < Number.MAX_VALUE) { - var lruEntry = lruHash[key]; - - if (!lruEntry) return; - - if (lruEntry === freshEnd) freshEnd = lruEntry.p; - if (lruEntry === staleEnd) staleEnd = lruEntry.n; - link(lruEntry.n,lruEntry.p); - - delete lruHash[key]; - } - - if (!(key in data)) return; - - delete data[key]; - size--; - }, - - - /** - * @ngdoc method - * @name $cacheFactory.Cache#removeAll - * @kind function - * - * @description - * Clears the cache object of any entries. - */ - removeAll: function() { - data = createMap(); - size = 0; - lruHash = createMap(); - freshEnd = staleEnd = null; - }, - - - /** - * @ngdoc method - * @name $cacheFactory.Cache#destroy - * @kind function - * - * @description - * Destroys the {@link $cacheFactory.Cache Cache} object entirely, - * removing it from the {@link $cacheFactory $cacheFactory} set. - */ - destroy: function() { - data = null; - stats = null; - lruHash = null; - delete caches[cacheId]; - }, - - - /** - * @ngdoc method - * @name $cacheFactory.Cache#info - * @kind function - * - * @description - * Retrieve information regarding a particular {@link $cacheFactory.Cache Cache}. - * - * @returns {object} an object with the following properties: - *
      - *
    • **id**: the id of the cache instance
    • - *
    • **size**: the number of entries kept in the cache instance
    • - *
    • **...**: any additional properties from the options object when creating the - * cache.
    • - *
    - */ - info: function() { - return extend({}, stats, {size: size}); - } - }); - - - /** - * makes the `entry` the freshEnd of the LRU linked list - */ - function refresh(entry) { - if (entry !== freshEnd) { - if (!staleEnd) { - staleEnd = entry; - } else if (staleEnd === entry) { - staleEnd = entry.n; - } - - link(entry.n, entry.p); - link(entry, freshEnd); - freshEnd = entry; - freshEnd.n = null; - } - } - - - /** - * bidirectionally links two entries of the LRU linked list - */ - function link(nextEntry, prevEntry) { - if (nextEntry !== prevEntry) { - if (nextEntry) nextEntry.p = prevEntry; //p stands for previous, 'prev' didn't minify - if (prevEntry) prevEntry.n = nextEntry; //n stands for next, 'next' didn't minify - } - } - } - - - /** - * @ngdoc method - * @name $cacheFactory#info - * - * @description - * Get information about all the caches that have been created - * - * @returns {Object} - key-value map of `cacheId` to the result of calling `cache#info` - */ - cacheFactory.info = function() { - var info = {}; - forEach(caches, function(cache, cacheId) { - info[cacheId] = cache.info(); - }); - return info; - }; - - - /** - * @ngdoc method - * @name $cacheFactory#get - * - * @description - * Get access to a cache object by the `cacheId` used when it was created. - * - * @param {string} cacheId Name or id of a cache to access. - * @returns {object} Cache object identified by the cacheId or undefined if no such cache. - */ - cacheFactory.get = function(cacheId) { - return caches[cacheId]; - }; - - - return cacheFactory; - }; -} - -/** - * @ngdoc service - * @name $templateCache - * @this - * - * @description - * `$templateCache` is a {@link $cacheFactory.Cache Cache object} created by the - * {@link ng.$cacheFactory $cacheFactory}. - * - * The first time a template is used, it is loaded in the template cache for quick retrieval. You - * can load templates directly into the cache in a `script` tag, by using {@link $templateRequest}, - * or by consuming the `$templateCache` service directly. - * - * Adding via the `script` tag: - * - * ```html - * - * ``` - * - * **Note:** the `script` tag containing the template does not need to be included in the `head` of - * the document, but it must be a descendent of the {@link ng.$rootElement $rootElement} (e.g. - * element with {@link ngApp} attribute), otherwise the template will be ignored. - * - * Adding via the `$templateCache` service: - * - * ```js - * var myApp = angular.module('myApp', []); - * myApp.run(function($templateCache) { - * $templateCache.put('templateId.html', 'This is the content of the template'); - * }); - * ``` - * - * To retrieve the template later, simply use it in your component: - * ```js - * myApp.component('myComponent', { - * templateUrl: 'templateId.html' - * }); - * ``` - * - * or get it via the `$templateCache` service: - * ```js - * $templateCache.get('templateId.html') - * ``` - * - */ -function $TemplateCacheProvider() { - this.$get = ['$cacheFactory', function($cacheFactory) { - return $cacheFactory('templates'); - }]; -} - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Any commits to this file should be reviewed with security in mind. * - * Changes to this file can potentially create security vulnerabilities. * - * An approval from 2 Core members with history of modifying * - * this file is required. * - * * - * Does the change somehow allow for arbitrary javascript to be executed? * - * Or allows for someone to change the prototype of built-in objects? * - * Or gives undesired access to variables like document or window? * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* ! VARIABLE/FUNCTION NAMING CONVENTIONS THAT APPLY TO THIS FILE! - * - * DOM-related variables: - * - * - "node" - DOM Node - * - "element" - DOM Element or Node - * - "$node" or "$element" - jqLite-wrapped node or element - * - * - * Compiler related stuff: - * - * - "linkFn" - linking fn of a single directive - * - "nodeLinkFn" - function that aggregates all linking fns for a particular node - * - "childLinkFn" - function that aggregates all linking fns for child nodes of a particular node - * - "compositeLinkFn" - function that aggregates all linking fns for a compilation root (nodeList) - */ - - -/** - * @ngdoc service - * @name $compile - * @kind function - * - * @description - * Compiles an HTML string or DOM into a template and produces a template function, which - * can then be used to link {@link ng.$rootScope.Scope `scope`} and the template together. - * - * The compilation is a process of walking the DOM tree and matching DOM elements to - * {@link ng.$compileProvider#directive directives}. - * - *
    - * **Note:** This document is an in-depth reference of all directive options. - * For a gentle introduction to directives with examples of common use cases, - * see the {@link guide/directive directive guide}. - *
    - * - * ## Comprehensive Directive API - * - * There are many different options for a directive. - * - * The difference resides in the return value of the factory function. - * You can either return a {@link $compile#directive-definition-object Directive Definition Object (see below)} - * that defines the directive properties, or just the `postLink` function (all other properties will have - * the default values). - * - *
    - * **Best Practice:** It's recommended to use the "directive definition object" form. - *
    - * - * Here's an example directive declared with a Directive Definition Object: - * - * ```js - * var myModule = angular.module(...); - * - * myModule.directive('directiveName', function factory(injectables) { - * var directiveDefinitionObject = { - * {@link $compile#-priority- priority}: 0, - * {@link $compile#-template- template}: '
    ', // or // function(tElement, tAttrs) { ... }, - * // or - * // {@link $compile#-templateurl- templateUrl}: 'directive.html', // or // function(tElement, tAttrs) { ... }, - * {@link $compile#-transclude- transclude}: false, - * {@link $compile#-restrict- restrict}: 'A', - * {@link $compile#-templatenamespace- templateNamespace}: 'html', - * {@link $compile#-scope- scope}: false, - * {@link $compile#-controller- controller}: function($scope, $element, $attrs, $transclude, otherInjectables) { ... }, - * {@link $compile#-controlleras- controllerAs}: 'stringIdentifier', - * {@link $compile#-bindtocontroller- bindToController}: false, - * {@link $compile#-require- require}: 'siblingDirectiveName', // or // ['^parentDirectiveName', '?optionalDirectiveName', '?^optionalParent'], - * {@link $compile#-multielement- multiElement}: false, - * {@link $compile#-compile- compile}: function compile(tElement, tAttrs, transclude) { - * return { - * {@link $compile#pre-linking-function pre}: function preLink(scope, iElement, iAttrs, controller) { ... }, - * {@link $compile#post-linking-function post}: function postLink(scope, iElement, iAttrs, controller) { ... } - * } - * // or - * // return function postLink( ... ) { ... } - * }, - * // or - * // {@link $compile#-link- link}: { - * // {@link $compile#pre-linking-function pre}: function preLink(scope, iElement, iAttrs, controller) { ... }, - * // {@link $compile#post-linking-function post}: function postLink(scope, iElement, iAttrs, controller) { ... } - * // } - * // or - * // {@link $compile#-link- link}: function postLink( ... ) { ... } - * }; - * return directiveDefinitionObject; - * }); - * ``` - * - *
    - * **Note:** Any unspecified options will use the default value. You can see the default values below. - *
    - * - * Therefore the above can be simplified as: - * - * ```js - * var myModule = angular.module(...); - * - * myModule.directive('directiveName', function factory(injectables) { - * var directiveDefinitionObject = { - * link: function postLink(scope, iElement, iAttrs) { ... } - * }; - * return directiveDefinitionObject; - * // or - * // return function postLink(scope, iElement, iAttrs) { ... } - * }); - * ``` - * - * ### Life-cycle hooks - * Directive controllers can provide the following methods that are called by AngularJS at points in the life-cycle of the - * directive: - * * `$onInit()` - Called on each controller after all the controllers on an element have been constructed and - * had their bindings initialized (and before the pre & post linking functions for the directives on - * this element). This is a good place to put initialization code for your controller. - * * `$onChanges(changesObj)` - Called whenever one-way (`<`) or interpolation (`@`) bindings are updated. The - * `changesObj` is a hash whose keys are the names of the bound properties that have changed, and the values are an - * object of the form `{ currentValue, previousValue, isFirstChange() }`. Use this hook to trigger updates within a - * component such as cloning the bound value to prevent accidental mutation of the outer value. Note that this will - * also be called when your bindings are initialized. - * * `$doCheck()` - Called on each turn of the digest cycle. Provides an opportunity to detect and act on - * changes. Any actions that you wish to take in response to the changes that you detect must be - * invoked from this hook; implementing this has no effect on when `$onChanges` is called. For example, this hook - * could be useful if you wish to perform a deep equality check, or to check a Date object, changes to which would not - * be detected by AngularJS's change detector and thus not trigger `$onChanges`. This hook is invoked with no arguments; - * if detecting changes, you must store the previous value(s) for comparison to the current values. - * * `$onDestroy()` - Called on a controller when its containing scope is destroyed. Use this hook for releasing - * external resources, watches and event handlers. Note that components have their `$onDestroy()` hooks called in - * the same order as the `$scope.$broadcast` events are triggered, which is top down. This means that parent - * components will have their `$onDestroy()` hook called before child components. - * * `$postLink()` - Called after this controller's element and its children have been linked. Similar to the post-link - * function this hook can be used to set up DOM event handlers and do direct DOM manipulation. - * Note that child elements that contain `templateUrl` directives will not have been compiled and linked since - * they are waiting for their template to load asynchronously and their own compilation and linking has been - * suspended until that occurs. - * - * #### Comparison with life-cycle hooks in the new Angular - * The new Angular also uses life-cycle hooks for its components. While the AngularJS life-cycle hooks are similar there are - * some differences that you should be aware of, especially when it comes to moving your code from AngularJS to Angular: - * - * * AngularJS hooks are prefixed with `$`, such as `$onInit`. Angular hooks are prefixed with `ng`, such as `ngOnInit`. - * * AngularJS hooks can be defined on the controller prototype or added to the controller inside its constructor. - * In Angular you can only define hooks on the prototype of the Component class. - * * Due to the differences in change-detection, you may get many more calls to `$doCheck` in AngularJS than you would to - * `ngDoCheck` in Angular. - * * Changes to the model inside `$doCheck` will trigger new turns of the digest loop, which will cause the changes to be - * propagated throughout the application. - * Angular does not allow the `ngDoCheck` hook to trigger a change outside of the component. It will either throw an - * error or do nothing depending upon the state of `enableProdMode()`. - * - * #### Life-cycle hook examples - * - * This example shows how you can check for mutations to a Date object even though the identity of the object - * has not changed. - * - * - * - * angular.module('do-check-module', []) - * .component('app', { - * template: - * 'Month: ' + - * 'Date: {{ $ctrl.date }}' + - * '', - * controller: function() { - * this.date = new Date(); - * this.month = this.date.getMonth(); - * this.updateDate = function() { - * this.date.setMonth(this.month); - * }; - * } - * }) - * .component('test', { - * bindings: { date: '<' }, - * template: - * '
    {{ $ctrl.log | json }}
    ', - * controller: function() { - * var previousValue; - * this.log = []; - * this.$doCheck = function() { - * var currentValue = this.date && this.date.valueOf(); - * if (previousValue !== currentValue) { - * this.log.push('doCheck: date mutated: ' + this.date); - * previousValue = currentValue; - * } - * }; - * } - * }); - *
    - * - * - * - *
    - * - * This example show how you might use `$doCheck` to trigger changes in your component's inputs even if the - * actual identity of the component doesn't change. (Be aware that cloning and deep equality checks on large - * arrays or objects can have a negative impact on your application performance) - * - * - * - *
    - * - * - *
    {{ items }}
    - * - *
    - *
    - * - * angular.module('do-check-module', []) - * .component('test', { - * bindings: { items: '<' }, - * template: - * '
    {{ $ctrl.log | json }}
    ', - * controller: function() { - * this.log = []; - * - * this.$doCheck = function() { - * if (this.items_ref !== this.items) { - * this.log.push('doCheck: items changed'); - * this.items_ref = this.items; - * } - * if (!angular.equals(this.items_clone, this.items)) { - * this.log.push('doCheck: items mutated'); - * this.items_clone = angular.copy(this.items); - * } - * }; - * } - * }); - *
    - *
    - * - * - * ### Directive Definition Object - * - * The directive definition object provides instructions to the {@link ng.$compile - * compiler}. The attributes are: - * - * #### `multiElement` - * When this property is set to true (default is `false`), the HTML compiler will collect DOM nodes between - * nodes with the attributes `directive-name-start` and `directive-name-end`, and group them - * together as the directive elements. It is recommended that this feature be used on directives - * which are not strictly behavioral (such as {@link ngClick}), and which - * do not manipulate or replace child nodes (such as {@link ngInclude}). - * - * #### `priority` - * When there are multiple directives defined on a single DOM element, sometimes it - * is necessary to specify the order in which the directives are applied. The `priority` is used - * to sort the directives before their `compile` functions get called. Priority is defined as a - * number. Directives with greater numerical `priority` are compiled first. Pre-link functions - * are also run in priority order, but post-link functions are run in reverse order. The order - * of directives with the same priority is undefined. The default priority is `0`. - * - * #### `terminal` - * If set to true then the current `priority` will be the last set of directives - * which will execute (any directives at the current priority will still execute - * as the order of execution on same `priority` is undefined). Note that expressions - * and other directives used in the directive's template will also be excluded from execution. - * - * #### `scope` - * The scope property can be `false`, `true`, or an object: - * - * * **`false` (default):** No scope will be created for the directive. The directive will use its - * parent's scope. - * - * * **`true`:** A new child scope that prototypically inherits from its parent will be created for - * the directive's element. If multiple directives on the same element request a new scope, - * only one new scope is created. - * - * * **`{...}` (an object hash):** A new "isolate" scope is created for the directive's template. - * The 'isolate' scope differs from normal scope in that it does not prototypically - * inherit from its parent scope. This is useful when creating reusable components, which should not - * accidentally read or modify data in the parent scope. Note that an isolate scope - * directive without a `template` or `templateUrl` will not apply the isolate scope - * to its children elements. - * - * The 'isolate' scope object hash defines a set of local scope properties derived from attributes on the - * directive's element. These local properties are useful for aliasing values for templates. The keys in - * the object hash map to the name of the property on the isolate scope; the values define how the property - * is bound to the parent scope, via matching attributes on the directive's element: - * - * * `@` or `@attr` - bind a local scope property to the value of DOM attribute. The result is - * always a string since DOM attributes are strings. If no `attr` name is specified then the - * attribute name is assumed to be the same as the local name. Given `` and the isolate scope definition `scope: { localName:'@myAttr' }`, - * the directive's scope property `localName` will reflect the interpolated value of `hello - * {{name}}`. As the `name` attribute changes so will the `localName` property on the directive's - * scope. The `name` is read from the parent scope (not the directive's scope). - * - * * `=` or `=attr` - set up a bidirectional binding between a local scope property and an expression - * passed via the attribute `attr`. The expression is evaluated in the context of the parent scope. - * If no `attr` name is specified then the attribute name is assumed to be the same as the local - * name. Given `` and the isolate scope definition `scope: { - * localModel: '=myAttr' }`, the property `localModel` on the directive's scope will reflect the - * value of `parentModel` on the parent scope. Changes to `parentModel` will be reflected in - * `localModel` and vice versa. If the binding expression is non-assignable, or if the attribute - * isn't optional and doesn't exist, an exception - * ({@link error/$compile/nonassign `$compile:nonassign`}) will be thrown upon discovering changes - * to the local value, since it will be impossible to sync them back to the parent scope. - * - * By default, the {@link ng.$rootScope.Scope#$watch `$watch`} - * method is used for tracking changes, and the equality check is based on object identity. - * However, if an object literal or an array literal is passed as the binding expression, the - * equality check is done by value (using the {@link angular.equals} function). It's also possible - * to watch the evaluated value shallowly with {@link ng.$rootScope.Scope#$watchCollection - * `$watchCollection`}: use `=*` or `=*attr` - * - * * `<` or `` and directive definition of - * `scope: { localModel:'` and the isolate scope definition `scope: { - * localFn:'&myAttr' }`, the isolate scope property `localFn` will point to a function wrapper for - * the `count = count + value` expression. Often it's desirable to pass data from the isolated scope - * via an expression to the parent scope. This can be done by passing a map of local variable names - * and values into the expression wrapper fn. For example, if the expression is `increment(amount)` - * then we can specify the amount value by calling the `localFn` as `localFn({amount: 22})`. - * - * All 4 kinds of bindings (`@`, `=`, `<`, and `&`) can be made optional by adding `?` to the expression. - * The marker must come after the mode and before the attribute name. - * See the {@link error/$compile/iscp Invalid Isolate Scope Definition error} for definition examples. - * This is useful to refine the interface directives provide. - * One subtle difference between optional and non-optional happens **when the binding attribute is not - * set**: - * - the binding is optional: the property will not be defined - * - the binding is not optional: the property is defined - * - * ```js - *app.directive('testDir', function() { - return { - scope: { - notoptional: '=', - optional: '=?', - }, - bindToController: true, - controller: function() { - this.$onInit = function() { - console.log(this.hasOwnProperty('notoptional')) // true - console.log(this.hasOwnProperty('optional')) // false - } - } - } - }) - *``` - * - * - * ##### Combining directives with different scope defintions - * - * In general it's possible to apply more than one directive to one element, but there might be limitations - * depending on the type of scope required by the directives. The following points will help explain these limitations. - * For simplicity only two directives are taken into account, but it is also applicable for several directives: - * - * * **no scope** + **no scope** => Two directives which don't require their own scope will use their parent's scope - * * **child scope** + **no scope** => Both directives will share one single child scope - * * **child scope** + **child scope** => Both directives will share one single child scope - * * **isolated scope** + **no scope** => The isolated directive will use it's own created isolated scope. The other directive will use - * its parent's scope - * * **isolated scope** + **child scope** => **Won't work!** Only one scope can be related to one element. Therefore these directives cannot - * be applied to the same element. - * * **isolated scope** + **isolated scope** => **Won't work!** Only one scope can be related to one element. Therefore these directives - * cannot be applied to the same element. - * - * - * #### `bindToController` - * This property is used to bind scope properties directly to the controller. It can be either - * `true` or an object hash with the same format as the `scope` property. - * - * When an isolate scope is used for a directive (see above), `bindToController: true` will - * allow a component to have its properties bound to the controller, rather than to scope. - * - * After the controller is instantiated, the initial values of the isolate scope bindings will be bound to the controller - * properties. You can access these bindings once they have been initialized by providing a controller method called - * `$onInit`, which is called after all the controllers on an element have been constructed and had their bindings - * initialized. - * - * It is also possible to set `bindToController` to an object hash with the same format as the `scope` property. - * This will set up the scope bindings to the controller directly. Note that `scope` can still be used - * to define which kind of scope is created. By default, no scope is created. Use `scope: {}` to create an isolate - * scope (useful for component directives). - * - * If both `bindToController` and `scope` are defined and have object hashes, `bindToController` overrides `scope`. - * - * - * #### `controller` - * Controller constructor function. The controller is instantiated before the - * pre-linking phase and can be accessed by other directives (see - * `require` attribute). This allows the directives to communicate with each other and augment - * each other's behavior. The controller is injectable (and supports bracket notation) with the following locals: - * - * * `$scope` - Current scope associated with the element - * * `$element` - Current element - * * `$attrs` - Current attributes object for the element - * * `$transclude` - A transclude linking function pre-bound to the correct transclusion scope: - * `function([scope], cloneLinkingFn, futureParentElement, slotName)`: - * * `scope`: (optional) override the scope. - * * `cloneLinkingFn`: (optional) argument to create clones of the original transcluded content. - * * `futureParentElement` (optional): - * * defines the parent to which the `cloneLinkingFn` will add the cloned elements. - * * default: `$element.parent()` resp. `$element` for `transclude:'element'` resp. `transclude:true`. - * * only needed for transcludes that are allowed to contain non html elements (e.g. SVG elements) - * and when the `cloneLinkingFn` is passed, - * as those elements need to created and cloned in a special way when they are defined outside their - * usual containers (e.g. like ``). - * * See also the `directive.templateNamespace` property. - * * `slotName`: (optional) the name of the slot to transclude. If falsy (e.g. `null`, `undefined` or `''`) - * then the default transclusion is provided. - * The `$transclude` function also has a method on it, `$transclude.isSlotFilled(slotName)`, which returns - * `true` if the specified slot contains content (i.e. one or more DOM nodes). - * - * #### `require` - * Require another directive and inject its controller as the fourth argument to the linking function. The - * `require` property can be a string, an array or an object: - * * a **string** containing the name of the directive to pass to the linking function - * * an **array** containing the names of directives to pass to the linking function. The argument passed to the - * linking function will be an array of controllers in the same order as the names in the `require` property - * * an **object** whose property values are the names of the directives to pass to the linking function. The argument - * passed to the linking function will also be an object with matching keys, whose values will hold the corresponding - * controllers. - * - * If the `require` property is an object and `bindToController` is truthy, then the required controllers are - * bound to the controller using the keys of the `require` property. This binding occurs after all the controllers - * have been constructed but before `$onInit` is called. - * If the name of the required controller is the same as the local name (the key), the name can be - * omitted. For example, `{parentDir: '^^'}` is equivalent to `{parentDir: '^^parentDir'}`. - * See the {@link $compileProvider#component} helper for an example of how this can be used. - * If no such required directive(s) can be found, or if the directive does not have a controller, then an error is - * raised (unless no link function is specified and the required controllers are not being bound to the directive - * controller, in which case error checking is skipped). The name can be prefixed with: - * - * * (no prefix) - Locate the required controller on the current element. Throw an error if not found. - * * `?` - Attempt to locate the required controller or pass `null` to the `link` fn if not found. - * * `^` - Locate the required controller by searching the element and its parents. Throw an error if not found. - * * `^^` - Locate the required controller by searching the element's parents. Throw an error if not found. - * * `?^` - Attempt to locate the required controller by searching the element and its parents or pass - * `null` to the `link` fn if not found. - * * `?^^` - Attempt to locate the required controller by searching the element's parents, or pass - * `null` to the `link` fn if not found. - * - * - * #### `controllerAs` - * Identifier name for a reference to the controller in the directive's scope. - * This allows the controller to be referenced from the directive template. This is especially - * useful when a directive is used as component, i.e. with an `isolate` scope. It's also possible - * to use it in a directive without an `isolate` / `new` scope, but you need to be aware that the - * `controllerAs` reference might overwrite a property that already exists on the parent scope. - * - * - * #### `restrict` - * String of subset of `EACM` which restricts the directive to a specific directive - * declaration style. If omitted, the defaults (elements and attributes) are used. - * - * * `E` - Element name (default): `` - * * `A` - Attribute (default): `
    ` - * * `C` - Class: `
    ` - * * `M` - Comment: `` - * - * - * #### `templateNamespace` - * String representing the document type used by the markup in the template. - * AngularJS needs this information as those elements need to be created and cloned - * in a special way when they are defined outside their usual containers like `` and ``. - * - * * `html` - All root nodes in the template are HTML. Root nodes may also be - * top-level elements such as `` or ``. - * * `svg` - The root nodes in the template are SVG elements (excluding ``). - * * `math` - The root nodes in the template are MathML elements (excluding ``). - * - * If no `templateNamespace` is specified, then the namespace is considered to be `html`. - * - * #### `template` - * HTML markup that may: - * * Replace the contents of the directive's element (default). - * * Replace the directive's element itself (if `replace` is true - DEPRECATED). - * * Wrap the contents of the directive's element (if `transclude` is true). - * - * Value may be: - * - * * A string. For example `
    {{delete_str}}
    `. - * * A function which takes two arguments `tElement` and `tAttrs` (described in the `compile` - * function api below) and returns a string value. - * - * - * #### `templateUrl` - * This is similar to `template` but the template is loaded from the specified URL, asynchronously. - * - * Because template loading is asynchronous the compiler will suspend compilation of directives on that element - * for later when the template has been resolved. In the meantime it will continue to compile and link - * sibling and parent elements as though this element had not contained any directives. - * - * The compiler does not suspend the entire compilation to wait for templates to be loaded because this - * would result in the whole app "stalling" until all templates are loaded asynchronously - even in the - * case when only one deeply nested directive has `templateUrl`. - * - * Template loading is asynchronous even if the template has been preloaded into the {@link $templateCache} - * - * You can specify `templateUrl` as a string representing the URL or as a function which takes two - * arguments `tElement` and `tAttrs` (described in the `compile` function api below) and returns - * a string value representing the url. In either case, the template URL is passed through {@link - * $sce#getTrustedResourceUrl $sce.getTrustedResourceUrl}. - * - * - * #### `replace` - *
    - * **Note:** `replace` is deprecated in AngularJS and has been removed in the new Angular (v2+). - *
    - * - * Specifies what the template should replace. Defaults to `false`. - * - * * `true` - the template will replace the directive's element. - * * `false` - the template will replace the contents of the directive's element. - * - * The replacement process migrates all of the attributes / classes from the old element to the new - * one. See the {@link guide/directive#template-expanding-directive - * Directives Guide} for an example. - * - * There are very few scenarios where element replacement is required for the application function, - * the main one being reusable custom components that are used within SVG contexts - * (because SVG doesn't work with custom elements in the DOM tree). - * - * #### `transclude` - * Extract the contents of the element where the directive appears and make it available to the directive. - * The contents are compiled and provided to the directive as a **transclusion function**. See the - * {@link $compile#transclusion Transclusion} section below. - * - * - * #### `compile` - * - * ```js - * function compile(tElement, tAttrs, transclude) { ... } - * ``` - * - * The compile function deals with transforming the template DOM. Since most directives do not do - * template transformation, it is not used often. The compile function takes the following arguments: - * - * * `tElement` - template element - The element where the directive has been declared. It is - * safe to do template transformation on the element and child elements only. - * - * * `tAttrs` - template attributes - Normalized list of attributes declared on this element shared - * between all directive compile functions. - * - * * `transclude` - [*DEPRECATED*!] A transclude linking function: `function(scope, cloneLinkingFn)` - * - *
    - * **Note:** The template instance and the link instance may be different objects if the template has - * been cloned. For this reason it is **not** safe to do anything other than DOM transformations that - * apply to all cloned DOM nodes within the compile function. Specifically, DOM listener registration - * should be done in a linking function rather than in a compile function. - *
    - - *
    - * **Note:** The compile function cannot handle directives that recursively use themselves in their - * own templates or compile functions. Compiling these directives results in an infinite loop and - * stack overflow errors. - * - * This can be avoided by manually using $compile in the postLink function to imperatively compile - * a directive's template instead of relying on automatic template compilation via `template` or - * `templateUrl` declaration or manual compilation inside the compile function. - *
    - * - *
    - * **Note:** The `transclude` function that is passed to the compile function is deprecated, as it - * e.g. does not know about the right outer scope. Please use the transclude function that is passed - * to the link function instead. - *
    - - * A compile function can have a return value which can be either a function or an object. - * - * * returning a (post-link) function - is equivalent to registering the linking function via the - * `link` property of the config object when the compile function is empty. - * - * * returning an object with function(s) registered via `pre` and `post` properties - allows you to - * control when a linking function should be called during the linking phase. See info about - * pre-linking and post-linking functions below. - * - * - * #### `link` - * This property is used only if the `compile` property is not defined. - * - * ```js - * function link(scope, iElement, iAttrs, controller, transcludeFn) { ... } - * ``` - * - * The link function is responsible for registering DOM listeners as well as updating the DOM. It is - * executed after the template has been cloned. This is where most of the directive logic will be - * put. - * - * * `scope` - {@link ng.$rootScope.Scope Scope} - The scope to be used by the - * directive for registering {@link ng.$rootScope.Scope#$watch watches}. - * - * * `iElement` - instance element - The element where the directive is to be used. It is safe to - * manipulate the children of the element only in `postLink` function since the children have - * already been linked. - * - * * `iAttrs` - instance attributes - Normalized list of attributes declared on this element shared - * between all directive linking functions. - * - * * `controller` - the directive's required controller instance(s) - Instances are shared - * among all directives, which allows the directives to use the controllers as a communication - * channel. The exact value depends on the directive's `require` property: - * * no controller(s) required: the directive's own controller, or `undefined` if it doesn't have one - * * `string`: the controller instance - * * `array`: array of controller instances - * - * If a required controller cannot be found, and it is optional, the instance is `null`, - * otherwise the {@link error:$compile:ctreq Missing Required Controller} error is thrown. - * - * Note that you can also require the directive's own controller - it will be made available like - * any other controller. - * - * * `transcludeFn` - A transclude linking function pre-bound to the correct transclusion scope. - * This is the same as the `$transclude` parameter of directive controllers, - * see {@link ng.$compile#-controller- the controller section for details}. - * `function([scope], cloneLinkingFn, futureParentElement)`. - * - * #### Pre-linking function - * - * Executed before the child elements are linked. Not safe to do DOM transformation since the - * compiler linking function will fail to locate the correct elements for linking. - * - * #### Post-linking function - * - * Executed after the child elements are linked. - * - * Note that child elements that contain `templateUrl` directives will not have been compiled - * and linked since they are waiting for their template to load asynchronously and their own - * compilation and linking has been suspended until that occurs. - * - * It is safe to do DOM transformation in the post-linking function on elements that are not waiting - * for their async templates to be resolved. - * - * - * ### Transclusion - * - * Transclusion is the process of extracting a collection of DOM elements from one part of the DOM and - * copying them to another part of the DOM, while maintaining their connection to the original AngularJS - * scope from where they were taken. - * - * Transclusion is used (often with {@link ngTransclude}) to insert the - * original contents of a directive's element into a specified place in the template of the directive. - * The benefit of transclusion, over simply moving the DOM elements manually, is that the transcluded - * content has access to the properties on the scope from which it was taken, even if the directive - * has isolated scope. - * See the {@link guide/directive#creating-a-directive-that-wraps-other-elements Directives Guide}. - * - * This makes it possible for the widget to have private state for its template, while the transcluded - * content has access to its originating scope. - * - *
    - * **Note:** When testing an element transclude directive you must not place the directive at the root of the - * DOM fragment that is being compiled. See {@link guide/unit-testing#testing-transclusion-directives - * Testing Transclusion Directives}. - *
    - * - * There are three kinds of transclusion depending upon whether you want to transclude just the contents of the - * directive's element, the entire element or multiple parts of the element contents: - * - * * `true` - transclude the content (i.e. the child nodes) of the directive's element. - * * `'element'` - transclude the whole of the directive's element including any directives on this - * element that defined at a lower priority than this directive. When used, the `template` - * property is ignored. - * * **`{...}` (an object hash):** - map elements of the content onto transclusion "slots" in the template. - * - * **Mult-slot transclusion** is declared by providing an object for the `transclude` property. - * - * This object is a map where the keys are the name of the slot to fill and the value is an element selector - * used to match the HTML to the slot. The element selector should be in normalized form (e.g. `myElement`) - * and will match the standard element variants (e.g. `my-element`, `my:element`, `data-my-element`, etc). - * - * For further information check out the guide on {@link guide/directive#matching-directives Matching Directives} - * - * If the element selector is prefixed with a `?` then that slot is optional. - * - * For example, the transclude object `{ slotA: '?myCustomElement' }` maps `` elements to - * the `slotA` slot, which can be accessed via the `$transclude` function or via the {@link ngTransclude} directive. - * - * Slots that are not marked as optional (`?`) will trigger a compile time error if there are no matching elements - * in the transclude content. If you wish to know if an optional slot was filled with content, then you can call - * `$transclude.isSlotFilled(slotName)` on the transclude function passed to the directive's link function and - * injectable into the directive's controller. - * - * - * #### Transclusion Functions - * - * When a directive requests transclusion, the compiler extracts its contents and provides a **transclusion - * function** to the directive's `link` function and `controller`. This transclusion function is a special - * **linking function** that will return the compiled contents linked to a new transclusion scope. - * - *
    - * If you are just using {@link ngTransclude} then you don't need to worry about this function, since - * ngTransclude will deal with it for us. - *
    - * - * If you want to manually control the insertion and removal of the transcluded content in your directive - * then you must use this transclude function. When you call a transclude function it returns a a jqLite/JQuery - * object that contains the compiled DOM, which is linked to the correct transclusion scope. - * - * When you call a transclusion function you can pass in a **clone attach function**. This function accepts - * two parameters, `function(clone, scope) { ... }`, where the `clone` is a fresh compiled copy of your transcluded - * content and the `scope` is the newly created transclusion scope, which the clone will be linked to. - * - *
    - * **Best Practice**: Always provide a `cloneFn` (clone attach function) when you call a transclude function - * since you then get a fresh clone of the original DOM and also have access to the new transclusion scope. - *
    - * - * It is normal practice to attach your transcluded content (`clone`) to the DOM inside your **clone - * attach function**: - * - * ```js - * var transcludedContent, transclusionScope; - * - * $transclude(function(clone, scope) { - * element.append(clone); - * transcludedContent = clone; - * transclusionScope = scope; - * }); - * ``` - * - * Later, if you want to remove the transcluded content from your DOM then you should also destroy the - * associated transclusion scope: - * - * ```js - * transcludedContent.remove(); - * transclusionScope.$destroy(); - * ``` - * - *
    - * **Best Practice**: if you intend to add and remove transcluded content manually in your directive - * (by calling the transclude function to get the DOM and calling `element.remove()` to remove it), - * then you are also responsible for calling `$destroy` on the transclusion scope. - *
    - * - * The built-in DOM manipulation directives, such as {@link ngIf}, {@link ngSwitch} and {@link ngRepeat} - * automatically destroy their transcluded clones as necessary so you do not need to worry about this if - * you are simply using {@link ngTransclude} to inject the transclusion into your directive. - * - * - * #### Transclusion Scopes - * - * When you call a transclude function it returns a DOM fragment that is pre-bound to a **transclusion - * scope**. This scope is special, in that it is a child of the directive's scope (and so gets destroyed - * when the directive's scope gets destroyed) but it inherits the properties of the scope from which it - * was taken. - * - * For example consider a directive that uses transclusion and isolated scope. The DOM hierarchy might look - * like this: - * - * ```html - *
    - *
    - *
    - *
    - *
    - *
    - * ``` - * - * The `$parent` scope hierarchy will look like this: - * - ``` - - $rootScope - - isolate - - transclusion - ``` - * - * but the scopes will inherit prototypically from different scopes to their `$parent`. - * - ``` - - $rootScope - - transclusion - - isolate - ``` - * - * - * ### Attributes - * - * The {@link ng.$compile.directive.Attributes Attributes} object - passed as a parameter in the - * `link()` or `compile()` functions. It has a variety of uses. - * - * * *Accessing normalized attribute names:* Directives like 'ngBind' can be expressed in many ways: - * 'ng:bind', `data-ng-bind`, or 'x-ng-bind'. The attributes object allows for normalized access - * to the attributes. - * - * * *Directive inter-communication:* All directives share the same instance of the attributes - * object which allows the directives to use the attributes object as inter directive - * communication. - * - * * *Supports interpolation:* Interpolation attributes are assigned to the attribute object - * allowing other directives to read the interpolated value. - * - * * *Observing interpolated attributes:* Use `$observe` to observe the value changes of attributes - * that contain interpolation (e.g. `src="{{bar}}"`). Not only is this very efficient but it's also - * the only way to easily get the actual value because during the linking phase the interpolation - * hasn't been evaluated yet and so the value is at this time set to `undefined`. - * - * ```js - * function linkingFn(scope, elm, attrs, ctrl) { - * // get the attribute value - * console.log(attrs.ngModel); - * - * // change the attribute - * attrs.$set('ngModel', 'new value'); - * - * // observe changes to interpolated attribute - * attrs.$observe('ngModel', function(value) { - * console.log('ngModel has changed value to ' + value); - * }); - * } - * ``` - * - * ## Example - * - *
    - * **Note**: Typically directives are registered with `module.directive`. The example below is - * to illustrate how `$compile` works. - *
    - * - - - -
    -
    -
    -
    -
    -
    - - it('should auto compile', function() { - var textarea = $('textarea'); - var output = $('div[compile]'); - // The initial state reads 'Hello AngularJS'. - expect(output.getText()).toBe('Hello AngularJS'); - textarea.clear(); - textarea.sendKeys('{{name}}!'); - expect(output.getText()).toBe('AngularJS!'); - }); - -
    - - * - * - * @param {string|DOMElement} element Element or HTML string to compile into a template function. - * @param {function(angular.Scope, cloneAttachFn=)} transclude function available to directives - DEPRECATED. - * - *
    - * **Note:** Passing a `transclude` function to the $compile function is deprecated, as it - * e.g. will not use the right outer scope. Please pass the transclude function as a - * `parentBoundTranscludeFn` to the link function instead. - *
    - * - * @param {number} maxPriority only apply directives lower than given priority (Only effects the - * root element(s), not their children) - * @returns {function(scope, cloneAttachFn=, options=)} a link function which is used to bind template - * (a DOM element/tree) to a scope. Where: - * - * * `scope` - A {@link ng.$rootScope.Scope Scope} to bind to. - * * `cloneAttachFn` - If `cloneAttachFn` is provided, then the link function will clone the - * `template` and call the `cloneAttachFn` function allowing the caller to attach the - * cloned elements to the DOM document at the appropriate place. The `cloneAttachFn` is - * called as:
    `cloneAttachFn(clonedElement, scope)` where: - * - * * `clonedElement` - is a clone of the original `element` passed into the compiler. - * * `scope` - is the current scope with which the linking function is working with. - * - * * `options` - An optional object hash with linking options. If `options` is provided, then the following - * keys may be used to control linking behavior: - * - * * `parentBoundTranscludeFn` - the transclude function made available to - * directives; if given, it will be passed through to the link functions of - * directives found in `element` during compilation. - * * `transcludeControllers` - an object hash with keys that map controller names - * to a hash with the key `instance`, which maps to the controller instance; - * if given, it will make the controllers available to directives on the compileNode: - * ``` - * { - * parent: { - * instance: parentControllerInstance - * } - * } - * ``` - * * `futureParentElement` - defines the parent to which the `cloneAttachFn` will add - * the cloned elements; only needed for transcludes that are allowed to contain non html - * elements (e.g. SVG elements). See also the directive.controller property. - * - * Calling the linking function returns the element of the template. It is either the original - * element passed in, or the clone of the element if the `cloneAttachFn` is provided. - * - * After linking the view is not updated until after a call to $digest which typically is done by - * AngularJS automatically. - * - * If you need access to the bound view, there are two ways to do it: - * - * - If you are not asking the linking function to clone the template, create the DOM element(s) - * before you send them to the compiler and keep this reference around. - * ```js - * var element = $compile('

    {{total}}

    ')(scope); - * ``` - * - * - if on the other hand, you need the element to be cloned, the view reference from the original - * example would not point to the clone, but rather to the original template that was cloned. In - * this case, you can access the clone via the cloneAttachFn: - * ```js - * var templateElement = angular.element('

    {{total}}

    '), - * scope = ....; - * - * var clonedElement = $compile(templateElement)(scope, function(clonedElement, scope) { - * //attach the clone to DOM document at the right place - * }); - * - * //now we have reference to the cloned DOM via `clonedElement` - * ``` - * - * - * For information on how the compiler works, see the - * {@link guide/compiler AngularJS HTML Compiler} section of the Developer Guide. - * - * @knownIssue - * - * ### Double Compilation - * - Double compilation occurs when an already compiled part of the DOM gets - compiled again. This is an undesired effect and can lead to misbehaving directives, performance issues, - and memory leaks. Refer to the Compiler Guide {@link guide/compiler#double-compilation-and-how-to-avoid-it - section on double compilation} for an in-depth explanation and ways to avoid it. - - * @knownIssue - - ### Issues with `replace: true` - * - *
    - * **Note**: {@link $compile#-replace- `replace: true`} is deprecated and not recommended to use, - * mainly due to the issues listed here. It has been completely removed in the new Angular. - *
    - * - * #### Attribute values are not merged - * - * When a `replace` directive encounters the same attribute on the original and the replace node, - * it will simply deduplicate the attribute and join the values with a space or with a `;` in case of - * the `style` attribute. - * ```html - * Original Node: - * Replace Template: - * Result: - * ``` - * - * That means attributes that contain AngularJS expressions will not be merged correctly, e.g. - * {@link ngShow} or {@link ngClass} will cause a {@link $parse} error: - * - * ```html - * Original Node: - * Replace Template: - * Result: - * ``` - * - * See issue [#5695](https://github.com/angular/angular.js/issues/5695). - * - * #### Directives are not deduplicated before compilation - * - * When the original node and the replace template declare the same directive(s), they will be - * {@link guide/compiler#double-compilation-and-how-to-avoid-it compiled twice} because the compiler - * does not deduplicate them. In many cases, this is not noticable, but e.g. {@link ngModel} will - * attach `$formatters` and `$parsers` twice. - * - * See issue [#2573](https://github.com/angular/angular.js/issues/2573). - * - * #### `transclude: element` in the replace template root can have unexpected effects - * - * When the replace template has a directive at the root node that uses - * {@link $compile#-transclude- `transclude: element`}, e.g. - * {@link ngIf} or {@link ngRepeat}, the DOM structure or scope inheritance can be incorrect. - * See the following issues: - * - * - Incorrect scope on replaced element: - * [#9837](https://github.com/angular/angular.js/issues/9837) - * - Different DOM between `template` and `templateUrl`: - * [#10612](https://github.com/angular/angular.js/issues/14326) - * - */ - -/** - * @ngdoc directive - * @name ngProp - * @restrict A - * @element ANY - * - * @usage - * - * ```html - * - * - * ``` - * - * or with uppercase letters in property (e.g. "propName"): - * - * - * ```html - * - * - * ``` - * - * - * @description - * The `ngProp` directive binds an expression to a DOM element property. - * `ngProp` allows writing to arbitrary properties by including - * the property name in the attribute, e.g. `ng-prop-value="'my value'"` binds 'my value' to - * the `value` property. - * - * Usually, it's not necessary to write to properties in AngularJS, as the built-in directives - * handle the most common use cases (instead of the above example, you would use {@link ngValue}). - * - * However, [custom elements](https://developer.mozilla.org/docs/Web/Web_Components/Using_custom_elements) - * often use custom properties to hold data, and `ngProp` can be used to provide input to these - * custom elements. - * - * ## Binding to camelCase properties - * - * Since HTML attributes are case-insensitive, camelCase properties like `innerHTML` must be escaped. - * AngularJS uses the underscore (_) in front of a character to indicate that it is uppercase, so - * `innerHTML` must be written as `ng-prop-inner_h_t_m_l="expression"` (Note that this is just an - * example, and for binding HTML {@link ngBindHtml} should be used. - * - * ## Security - * - * Binding expressions to arbitrary properties poses a security risk, as properties like `innerHTML` - * can insert potentially dangerous HTML into the application, e.g. script tags that execute - * malicious code. - * For this reason, `ngProp` applies Strict Contextual Escaping with the {@link ng.$sce $sce service}. - * This means vulnerable properties require their content to be "trusted", based on the - * context of the property. For example, the `innerHTML` is in the `HTML` context, and the - * `iframe.src` property is in the `RESOURCE_URL` context, which requires that values written to - * this property are trusted as a `RESOURCE_URL`. - * - * This can be set explicitly by calling $sce.trustAs(type, value) on the value that is - * trusted before passing it to the `ng-prop-*` directive. There are exist shorthand methods for - * each context type in the form of {@link ng.$sce#trustAsResourceUrl $sce.trustAsResourceUrl()} et al. - * - * In some cases you can also rely upon automatic sanitization of untrusted values - see below. - * - * Based on the context, other options may exist to mark a value as trusted / configure the behavior - * of {@link ng.$sce}. For example, to restrict the `RESOURCE_URL` context to specific origins, use - * the {@link $sceDelegateProvider#resourceUrlWhitelist resourceUrlWhitelist()} - * and {@link $sceDelegateProvider#resourceUrlBlacklist resourceUrlBlacklist()}. - * - * {@link ng.$sce#what-trusted-context-types-are-supported- Find out more about the different context types}. - * - * ### HTML Sanitization - * - * By default, `$sce` will throw an error if it detects untrusted HTML content, and will not bind the - * content. - * However, if you include the {@link ngSanitize ngSanitize module}, it will try to sanitize the - * potentially dangerous HTML, e.g. strip non-whitelisted tags and attributes when binding to - * `innerHTML`. - * - * @example - * ### Binding to different contexts - * - * - * - * angular.module('exampleNgProp', []) - * .component('main', { - * templateUrl: 'main.html', - * controller: function($sce) { - * this.safeContent = 'Safe content'; - * this.unsafeContent = ''; - * this.trustedUnsafeContent = $sce.trustAsHtml(this.unsafeContent); - * } - * }); - * - * - *
    - *
    - * Binding to a property without security context: - *
    - * innerText (safeContent) - *
    - * - *
    - * "Safe" content that requires a security context will throw because the contents could potentially be dangerous ... - *
    - * innerHTML (safeContent) - *
    - * - *
    - * ... so that actually dangerous content cannot be executed: - *
    - * innerHTML (unsafeContent) - *
    - * - *
    - * ... but unsafe Content that has been trusted explicitly works - only do this if you are 100% sure! - *
    - * innerHTML (trustedUnsafeContent) - *
    - *
    - *
    - * - *
    - *
    - * - * .prop-unit { - * margin-bottom: 10px; - * } - * - * .prop-binding { - * min-height: 30px; - * border: 1px solid blue; - * } - * - * .prop-note { - * font-family: Monospace; - * } - * - *
    - * - * - * @example - * ### Binding to innerHTML with ngSanitize - * - * - * - * angular.module('exampleNgProp', ['ngSanitize']) - * .component('main', { - * templateUrl: 'main.html', - * controller: function($sce) { - * this.safeContent = 'Safe content'; - * this.unsafeContent = ''; - * this.trustedUnsafeContent = $sce.trustAsHtml(this.unsafeContent); - * } - * }); - * - * - *
    - *
    - * "Safe" content will be sanitized ... - *
    - * innerHTML (safeContent) - *
    - * - *
    - * ... as will dangerous content: - *
    - * innerHTML (unsafeContent) - *
    - * - *
    - * ... and content that has been trusted explicitly works the same as without ngSanitize: - *
    - * innerHTML (trustedUnsafeContent) - *
    - *
    - *
    - * - *
    - *
    - * - * .prop-unit { - * margin-bottom: 10px; - * } - * - * .prop-binding { - * min-height: 30px; - * border: 1px solid blue; - * } - * - * .prop-note { - * font-family: Monospace; - * } - * - *
    - * - */ - -/** @ngdoc directive - * @name ngOn - * @restrict A - * @element ANY - * - * @usage - * - * ```html - * - * - * ``` - * - * or with uppercase letters in property (e.g. "eventName"): - * - * - * ```html - * - * - * ``` - * - * @description - * The `ngOn` directive adds an event listener to a DOM element via - * {@link angular.element angular.element().on()}, and evaluates an expression when the event is - * fired. - * `ngOn` allows adding listeners for arbitrary events by including - * the event name in the attribute, e.g. `ng-on-drop="onDrop()"` executes the 'onDrop()' expression - * when the `drop` event is fired. - * - * AngularJS provides specific directives for many events, such as {@link ngClick}, so in most - * cases it is not necessary to use `ngOn`. However, AngularJS does not support all events - * (e.g. the `drop` event in the example above), and new events might be introduced in later DOM - * standards. - * - * Another use-case for `ngOn` is listening to - * [custom events](https://developer.mozilla.org/docs/Web/Guide/Events/Creating_and_triggering_events) - * fired by - * [custom elements](https://developer.mozilla.org/docs/Web/Web_Components/Using_custom_elements). - * - * ## Binding to camelCase properties - * - * Since HTML attributes are case-insensitive, camelCase properties like `myEvent` must be escaped. - * AngularJS uses the underscore (_) in front of a character to indicate that it is uppercase, so - * `myEvent` must be written as `ng-on-my_event="expression"`. - * - * @example - * ### Bind to built-in DOM events - * - * - * - * angular.module('exampleNgOn', []) - * .component('main', { - * templateUrl: 'main.html', - * controller: function() { - * this.clickCount = 0; - * this.mouseoverCount = 0; - * - * this.loadingState = 0; - * } - * }); - * - * - *
    - * This is equivalent to `ngClick` and `ngMouseover`:
    - *
    - * clickCount: {{$ctrl.clickCount}}
    - * mouseover: {{$ctrl.mouseoverCount}} - * - *
    - * - * For the `error` and `load` event on images no built-in AngularJS directives exist:
    - *
    - *
    - * Image is loading - * Image load error - * Image loaded successfully - *
    - *
    - *
    - * - *
    - *
    - *
    - * - * - * @example - * ### Bind to custom DOM events - * - * - * - * angular.module('exampleNgOn', []) - * .component('main', { - * templateUrl: 'main.html', - * controller: function() { - * this.eventLog = ''; - * - * this.listener = function($event) { - * this.eventLog = 'Event with type "' + $event.type + '" fired at ' + $event.detail; - * }; - * } - * }) - * .component('childComponent', { - * templateUrl: 'child.html', - * controller: function($element) { - * this.fireEvent = function() { - * var event = new CustomEvent('customtype', { detail: new Date()}); - * - * $element[0].dispatchEvent(event); - * }; - * } - * }); - * - * - *
    - * Event log: {{$ctrl.eventLog}} - *
    - * - - * - * - *
    - *
    - *
    - */ - -var $compileMinErr = minErr('$compile'); - -function UNINITIALIZED_VALUE() {} -var _UNINITIALIZED_VALUE = new UNINITIALIZED_VALUE(); - -/** - * @ngdoc provider - * @name $compileProvider - * - * @description - */ -$CompileProvider.$inject = ['$provide', '$$sanitizeUriProvider']; -/** @this */ -function $CompileProvider($provide, $$sanitizeUriProvider) { - var hasDirectives = {}, - Suffix = 'Directive', - COMMENT_DIRECTIVE_REGEXP = /^\s*directive:\s*([\w-]+)\s+(.*)$/, - CLASS_DIRECTIVE_REGEXP = /(([\w-]+)(?::([^;]+))?;?)/, - ALL_OR_NOTHING_ATTRS = makeMap('ngSrc,ngSrcset,src,srcset'), - REQUIRE_PREFIX_REGEXP = /^(?:(\^\^?)?(\?)?(\^\^?)?)?/; - - // Ref: http://developers.whatwg.org/webappapis.html#event-handler-idl-attributes - // The assumption is that future DOM event attribute names will begin with - // 'on' and be composed of only English letters. - var EVENT_HANDLER_ATTR_REGEXP = /^(on[a-z]+|formaction)$/; - var bindingCache = createMap(); - - function parseIsolateBindings(scope, directiveName, isController) { - var LOCAL_REGEXP = /^([@&]|[=<](\*?))(\??)\s*([\w$]*)$/; - - var bindings = createMap(); - - forEach(scope, function(definition, scopeName) { - definition = definition.trim(); - - if (definition in bindingCache) { - bindings[scopeName] = bindingCache[definition]; - return; - } - var match = definition.match(LOCAL_REGEXP); - - if (!match) { - throw $compileMinErr('iscp', - 'Invalid {3} for directive \'{0}\'.' + - ' Definition: {... {1}: \'{2}\' ...}', - directiveName, scopeName, definition, - (isController ? 'controller bindings definition' : - 'isolate scope definition')); - } - - bindings[scopeName] = { - mode: match[1][0], - collection: match[2] === '*', - optional: match[3] === '?', - attrName: match[4] || scopeName - }; - if (match[4]) { - bindingCache[definition] = bindings[scopeName]; - } - }); - - return bindings; - } - - function parseDirectiveBindings(directive, directiveName) { - var bindings = { - isolateScope: null, - bindToController: null - }; - if (isObject(directive.scope)) { - if (directive.bindToController === true) { - bindings.bindToController = parseIsolateBindings(directive.scope, - directiveName, true); - bindings.isolateScope = {}; - } else { - bindings.isolateScope = parseIsolateBindings(directive.scope, - directiveName, false); - } - } - if (isObject(directive.bindToController)) { - bindings.bindToController = - parseIsolateBindings(directive.bindToController, directiveName, true); - } - if (bindings.bindToController && !directive.controller) { - // There is no controller - throw $compileMinErr('noctrl', - 'Cannot bind to controller without directive \'{0}\'s controller.', - directiveName); - } - return bindings; - } - - function assertValidDirectiveName(name) { - var letter = name.charAt(0); - if (!letter || letter !== lowercase(letter)) { - throw $compileMinErr('baddir', 'Directive/Component name \'{0}\' is invalid. The first character must be a lowercase letter', name); - } - if (name !== name.trim()) { - throw $compileMinErr('baddir', - 'Directive/Component name \'{0}\' is invalid. The name should not contain leading or trailing whitespaces', - name); - } - } - - function getDirectiveRequire(directive) { - var require = directive.require || (directive.controller && directive.name); - - if (!isArray(require) && isObject(require)) { - forEach(require, function(value, key) { - var match = value.match(REQUIRE_PREFIX_REGEXP); - var name = value.substring(match[0].length); - if (!name) require[key] = match[0] + key; - }); - } - - return require; - } - - function getDirectiveRestrict(restrict, name) { - if (restrict && !(isString(restrict) && /[EACM]/.test(restrict))) { - throw $compileMinErr('badrestrict', - 'Restrict property \'{0}\' of directive \'{1}\' is invalid', - restrict, - name); - } - - return restrict || 'EA'; - } - - /** - * @ngdoc method - * @name $compileProvider#directive - * @kind function - * - * @description - * Register a new directive with the compiler. - * - * @param {string|Object} name Name of the directive in camel-case (i.e. ngBind which - * will match as ng-bind), or an object map of directives where the keys are the - * names and the values are the factories. - * @param {Function|Array} directiveFactory An injectable directive factory function. See the - * {@link guide/directive directive guide} and the {@link $compile compile API} for more info. - * @returns {ng.$compileProvider} Self for chaining. - */ - this.directive = function registerDirective(name, directiveFactory) { - assertArg(name, 'name'); - assertNotHasOwnProperty(name, 'directive'); - if (isString(name)) { - assertValidDirectiveName(name); - assertArg(directiveFactory, 'directiveFactory'); - if (!hasDirectives.hasOwnProperty(name)) { - hasDirectives[name] = []; - $provide.factory(name + Suffix, ['$injector', '$exceptionHandler', - function($injector, $exceptionHandler) { - var directives = []; - forEach(hasDirectives[name], function(directiveFactory, index) { - try { - var directive = $injector.invoke(directiveFactory); - if (isFunction(directive)) { - directive = { compile: valueFn(directive) }; - } else if (!directive.compile && directive.link) { - directive.compile = valueFn(directive.link); - } - directive.priority = directive.priority || 0; - directive.index = index; - directive.name = directive.name || name; - directive.require = getDirectiveRequire(directive); - directive.restrict = getDirectiveRestrict(directive.restrict, name); - directive.$$moduleName = directiveFactory.$$moduleName; - directives.push(directive); - } catch (e) { - $exceptionHandler(e); - } - }); - return directives; - }]); - } - hasDirectives[name].push(directiveFactory); - } else { - forEach(name, reverseParams(registerDirective)); - } - return this; - }; - - /** - * @ngdoc method - * @name $compileProvider#component - * @module ng - * @param {string|Object} name Name of the component in camelCase (i.e. `myComp` which will match ``), - * or an object map of components where the keys are the names and the values are the component definition objects. - * @param {Object} options Component definition object (a simplified - * {@link ng.$compile#directive-definition-object directive definition object}), - * with the following properties (all optional): - * - * - `controller` – `{(string|function()=}` – controller constructor function that should be - * associated with newly created scope or the name of a {@link ng.$compile#-controller- - * registered controller} if passed as a string. An empty `noop` function by default. - * - `controllerAs` – `{string=}` – identifier name for to reference the controller in the component's scope. - * If present, the controller will be published to scope under the `controllerAs` name. - * If not present, this will default to be `$ctrl`. - * - `template` – `{string=|function()=}` – html template as a string or a function that - * returns an html template as a string which should be used as the contents of this component. - * Empty string by default. - * - * If `template` is a function, then it is {@link auto.$injector#invoke injected} with - * the following locals: - * - * - `$element` - Current element - * - `$attrs` - Current attributes object for the element - * - * - `templateUrl` – `{string=|function()=}` – path or function that returns a path to an html - * template that should be used as the contents of this component. - * - * If `templateUrl` is a function, then it is {@link auto.$injector#invoke injected} with - * the following locals: - * - * - `$element` - Current element - * - `$attrs` - Current attributes object for the element - * - * - `bindings` – `{object=}` – defines bindings between DOM attributes and component properties. - * Component properties are always bound to the component controller and not to the scope. - * See {@link ng.$compile#-bindtocontroller- `bindToController`}. - * - `transclude` – `{boolean=}` – whether {@link $compile#transclusion content transclusion} is enabled. - * Disabled by default. - * - `require` - `{Object=}` - requires the controllers of other directives and binds them to - * this component's controller. The object keys specify the property names under which the required - * controllers (object values) will be bound. See {@link ng.$compile#-require- `require`}. - * - `$...` – additional properties to attach to the directive factory function and the controller - * constructor function. (This is used by the component router to annotate) - * - * @returns {ng.$compileProvider} the compile provider itself, for chaining of function calls. - * @description - * Register a **component definition** with the compiler. This is a shorthand for registering a special - * type of directive, which represents a self-contained UI component in your application. Such components - * are always isolated (i.e. `scope: {}`) and are always restricted to elements (i.e. `restrict: 'E'`). - * - * Component definitions are very simple and do not require as much configuration as defining general - * directives. Component definitions usually consist only of a template and a controller backing it. - * - * In order to make the definition easier, components enforce best practices like use of `controllerAs`, - * `bindToController`. They always have **isolate scope** and are restricted to elements. - * - * Here are a few examples of how you would usually define components: - * - * ```js - * var myMod = angular.module(...); - * myMod.component('myComp', { - * template: '
    My name is {{$ctrl.name}}
    ', - * controller: function() { - * this.name = 'shahar'; - * } - * }); - * - * myMod.component('myComp', { - * template: '
    My name is {{$ctrl.name}}
    ', - * bindings: {name: '@'} - * }); - * - * myMod.component('myComp', { - * templateUrl: 'views/my-comp.html', - * controller: 'MyCtrl', - * controllerAs: 'ctrl', - * bindings: {name: '@'} - * }); - * - * ``` - * For more examples, and an in-depth guide, see the {@link guide/component component guide}. - * - *
    - * See also {@link ng.$compileProvider#directive $compileProvider.directive()}. - */ - this.component = function registerComponent(name, options) { - if (!isString(name)) { - forEach(name, reverseParams(bind(this, registerComponent))); - return this; - } - - var controller = options.controller || function() {}; - - function factory($injector) { - function makeInjectable(fn) { - if (isFunction(fn) || isArray(fn)) { - return /** @this */ function(tElement, tAttrs) { - return $injector.invoke(fn, this, {$element: tElement, $attrs: tAttrs}); - }; - } else { - return fn; - } - } - - var template = (!options.template && !options.templateUrl ? '' : options.template); - var ddo = { - controller: controller, - controllerAs: identifierForController(options.controller) || options.controllerAs || '$ctrl', - template: makeInjectable(template), - templateUrl: makeInjectable(options.templateUrl), - transclude: options.transclude, - scope: {}, - bindToController: options.bindings || {}, - restrict: 'E', - require: options.require - }; - - // Copy annotations (starting with $) over to the DDO - forEach(options, function(val, key) { - if (key.charAt(0) === '$') ddo[key] = val; - }); - - return ddo; - } - - // TODO(pete) remove the following `forEach` before we release 1.6.0 - // The component-router@0.2.0 looks for the annotations on the controller constructor - // Nothing in AngularJS looks for annotations on the factory function but we can't remove - // it from 1.5.x yet. - - // Copy any annotation properties (starting with $) over to the factory and controller constructor functions - // These could be used by libraries such as the new component router - forEach(options, function(val, key) { - if (key.charAt(0) === '$') { - factory[key] = val; - // Don't try to copy over annotations to named controller - if (isFunction(controller)) controller[key] = val; - } - }); - - factory.$inject = ['$injector']; - - return this.directive(name, factory); - }; - - - /** - * @ngdoc method - * @name $compileProvider#aHrefSanitizationWhitelist - * @kind function - * - * @description - * Retrieves or overrides the default regular expression that is used for whitelisting of safe - * urls during a[href] sanitization. - * - * The sanitization is a security measure aimed at preventing XSS attacks via html links. - * - * Any url about to be assigned to a[href] via data-binding is first normalized and turned into - * an absolute url. Afterwards, the url is matched against the `aHrefSanitizationWhitelist` - * regular expression. If a match is found, the original url is written into the dom. Otherwise, - * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM. - * - * @param {RegExp=} regexp New regexp to whitelist urls with. - * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for - * chaining otherwise. - */ - this.aHrefSanitizationWhitelist = function(regexp) { - if (isDefined(regexp)) { - $$sanitizeUriProvider.aHrefSanitizationWhitelist(regexp); - return this; - } else { - return $$sanitizeUriProvider.aHrefSanitizationWhitelist(); - } - }; - - - /** - * @ngdoc method - * @name $compileProvider#imgSrcSanitizationWhitelist - * @kind function - * - * @description - * Retrieves or overrides the default regular expression that is used for whitelisting of safe - * urls during img[src] sanitization. - * - * The sanitization is a security measure aimed at prevent XSS attacks via html links. - * - * Any url about to be assigned to img[src] via data-binding is first normalized and turned into - * an absolute url. Afterwards, the url is matched against the `imgSrcSanitizationWhitelist` - * regular expression. If a match is found, the original url is written into the dom. Otherwise, - * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM. - * - * @param {RegExp=} regexp New regexp to whitelist urls with. - * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for - * chaining otherwise. - */ - this.imgSrcSanitizationWhitelist = function(regexp) { - if (isDefined(regexp)) { - $$sanitizeUriProvider.imgSrcSanitizationWhitelist(regexp); - return this; - } else { - return $$sanitizeUriProvider.imgSrcSanitizationWhitelist(); - } - }; - - /** - * @ngdoc method - * @name $compileProvider#debugInfoEnabled - * - * @param {boolean=} enabled update the debugInfoEnabled state if provided, otherwise just return the - * current debugInfoEnabled state - * @returns {*} current value if used as getter or itself (chaining) if used as setter - * - * @kind function - * - * @description - * Call this method to enable/disable various debug runtime information in the compiler such as adding - * binding information and a reference to the current scope on to DOM elements. - * If enabled, the compiler will add the following to DOM elements that have been bound to the scope - * * `ng-binding` CSS class - * * `ng-scope` and `ng-isolated-scope` CSS classes - * * `$binding` data property containing an array of the binding expressions - * * Data properties used by the {@link angular.element#methods `scope()`/`isolateScope()` methods} to return - * the element's scope. - * * Placeholder comments will contain information about what directive and binding caused the placeholder. - * E.g. ``. - * - * You may want to disable this in production for a significant performance boost. See - * {@link guide/production#disabling-debug-data Disabling Debug Data} for more. - * - * The default value is true. - */ - var debugInfoEnabled = true; - this.debugInfoEnabled = function(enabled) { - if (isDefined(enabled)) { - debugInfoEnabled = enabled; - return this; - } - return debugInfoEnabled; - }; - - /** - * @ngdoc method - * @name $compileProvider#strictComponentBindingsEnabled - * - * @param {boolean=} enabled update the strictComponentBindingsEnabled state if provided, - * otherwise return the current strictComponentBindingsEnabled state. - * @returns {*} current value if used as getter or itself (chaining) if used as setter - * - * @kind function - * - * @description - * Call this method to enable / disable the strict component bindings check. If enabled, the - * compiler will enforce that all scope / controller bindings of a - * {@link $compileProvider#directive directive} / {@link $compileProvider#component component} - * that are not set as optional with `?`, must be provided when the directive is instantiated. - * If not provided, the compiler will throw the - * {@link error/$compile/missingattr $compile:missingattr error}. - * - * The default value is false. - */ - var strictComponentBindingsEnabled = false; - this.strictComponentBindingsEnabled = function(enabled) { - if (isDefined(enabled)) { - strictComponentBindingsEnabled = enabled; - return this; - } - return strictComponentBindingsEnabled; - }; - - var TTL = 10; - /** - * @ngdoc method - * @name $compileProvider#onChangesTtl - * @description - * - * Sets the number of times `$onChanges` hooks can trigger new changes before giving up and - * assuming that the model is unstable. - * - * The current default is 10 iterations. - * - * In complex applications it's possible that dependencies between `$onChanges` hooks and bindings will result - * in several iterations of calls to these hooks. However if an application needs more than the default 10 - * iterations to stabilize then you should investigate what is causing the model to continuously change during - * the `$onChanges` hook execution. - * - * Increasing the TTL could have performance implications, so you should not change it without proper justification. - * - * @param {number} limit The number of `$onChanges` hook iterations. - * @returns {number|object} the current limit (or `this` if called as a setter for chaining) - */ - this.onChangesTtl = function(value) { - if (arguments.length) { - TTL = value; - return this; - } - return TTL; - }; - - var commentDirectivesEnabledConfig = true; - /** - * @ngdoc method - * @name $compileProvider#commentDirectivesEnabled - * @description - * - * It indicates to the compiler - * whether or not directives on comments should be compiled. - * Defaults to `true`. - * - * Calling this function with false disables the compilation of directives - * on comments for the whole application. - * This results in a compilation performance gain, - * as the compiler doesn't have to check comments when looking for directives. - * This should however only be used if you are sure that no comment directives are used in - * the application (including any 3rd party directives). - * - * @param {boolean} enabled `false` if the compiler may ignore directives on comments - * @returns {boolean|object} the current value (or `this` if called as a setter for chaining) - */ - this.commentDirectivesEnabled = function(value) { - if (arguments.length) { - commentDirectivesEnabledConfig = value; - return this; - } - return commentDirectivesEnabledConfig; - }; - - - var cssClassDirectivesEnabledConfig = true; - /** - * @ngdoc method - * @name $compileProvider#cssClassDirectivesEnabled - * @description - * - * It indicates to the compiler - * whether or not directives on element classes should be compiled. - * Defaults to `true`. - * - * Calling this function with false disables the compilation of directives - * on element classes for the whole application. - * This results in a compilation performance gain, - * as the compiler doesn't have to check element classes when looking for directives. - * This should however only be used if you are sure that no class directives are used in - * the application (including any 3rd party directives). - * - * @param {boolean} enabled `false` if the compiler may ignore directives on element classes - * @returns {boolean|object} the current value (or `this` if called as a setter for chaining) - */ - this.cssClassDirectivesEnabled = function(value) { - if (arguments.length) { - cssClassDirectivesEnabledConfig = value; - return this; - } - return cssClassDirectivesEnabledConfig; - }; - - - /** - * The security context of DOM Properties. - * @private - */ - var PROP_CONTEXTS = createMap(); - - /** - * @ngdoc method - * @name $compileProvider#addPropertySecurityContext - * @description - * - * Defines the security context for DOM properties bound by ng-prop-*. - * - * @param {string} elementName The element name or '*' to match any element. - * @param {string} propertyName The DOM property name. - * @param {string} ctx The {@link $sce} security context in which this value is safe for use, e.g. `$sce.URL` - * @returns {object} `this` for chaining - */ - this.addPropertySecurityContext = function(elementName, propertyName, ctx) { - var key = (elementName.toLowerCase() + '|' + propertyName.toLowerCase()); - - if (key in PROP_CONTEXTS && PROP_CONTEXTS[key] !== ctx) { - throw $compileMinErr('ctxoverride', 'Property context \'{0}.{1}\' already set to \'{2}\', cannot override to \'{3}\'.', elementName, propertyName, PROP_CONTEXTS[key], ctx); - } - - PROP_CONTEXTS[key] = ctx; - return this; - }; - - /* Default property contexts. - * - * Copy of https://github.com/angular/angular/blob/6.0.6/packages/compiler/src/schema/dom_security_schema.ts#L31-L58 - * Changing: - * - SecurityContext.* => SCE_CONTEXTS/$sce.* - * - STYLE => CSS - * - various URL => MEDIA_URL - * - *|formAction, form|action URL => RESOURCE_URL (like the attribute) - */ - (function registerNativePropertyContexts() { - function registerContext(ctx, values) { - forEach(values, function(v) { PROP_CONTEXTS[v.toLowerCase()] = ctx; }); - } - - registerContext(SCE_CONTEXTS.HTML, [ - 'iframe|srcdoc', - '*|innerHTML', - '*|outerHTML' - ]); - registerContext(SCE_CONTEXTS.CSS, ['*|style']); - registerContext(SCE_CONTEXTS.URL, [ - 'area|href', 'area|ping', - 'a|href', 'a|ping', - 'blockquote|cite', - 'body|background', - 'del|cite', - 'input|src', - 'ins|cite', - 'q|cite' - ]); - registerContext(SCE_CONTEXTS.MEDIA_URL, [ - 'audio|src', - 'img|src', 'img|srcset', - 'source|src', 'source|srcset', - 'track|src', - 'video|src', 'video|poster' - ]); - registerContext(SCE_CONTEXTS.RESOURCE_URL, [ - '*|formAction', - 'applet|code', 'applet|codebase', - 'base|href', - 'embed|src', - 'frame|src', - 'form|action', - 'head|profile', - 'html|manifest', - 'iframe|src', - 'link|href', - 'media|src', - 'object|codebase', 'object|data', - 'script|src' - ]); - })(); - - - this.$get = [ - '$injector', '$interpolate', '$exceptionHandler', '$templateRequest', '$parse', - '$controller', '$rootScope', '$sce', '$animate', - function($injector, $interpolate, $exceptionHandler, $templateRequest, $parse, - $controller, $rootScope, $sce, $animate) { - - var SIMPLE_ATTR_NAME = /^\w/; - var specialAttrHolder = window.document.createElement('div'); - - - var commentDirectivesEnabled = commentDirectivesEnabledConfig; - var cssClassDirectivesEnabled = cssClassDirectivesEnabledConfig; - - - var onChangesTtl = TTL; - // The onChanges hooks should all be run together in a single digest - // When changes occur, the call to trigger their hooks will be added to this queue - var onChangesQueue; - - // This function is called in a $$postDigest to trigger all the onChanges hooks in a single digest - function flushOnChangesQueue() { - try { - if (!(--onChangesTtl)) { - // We have hit the TTL limit so reset everything - onChangesQueue = undefined; - throw $compileMinErr('infchng', '{0} $onChanges() iterations reached. Aborting!\n', TTL); - } - // We must run this hook in an apply since the $$postDigest runs outside apply - $rootScope.$apply(function() { - for (var i = 0, ii = onChangesQueue.length; i < ii; ++i) { - try { - onChangesQueue[i](); - } catch (e) { - $exceptionHandler(e); - } - } - // Reset the queue to trigger a new schedule next time there is a change - onChangesQueue = undefined; - }); - } finally { - onChangesTtl++; - } - } - - - function sanitizeSrcset(value, invokeType) { - if (!value) { - return value; - } - if (!isString(value)) { - throw $compileMinErr('srcset', 'Can\'t pass trusted values to `{0}`: "{1}"', invokeType, value.toString()); - } - - // Such values are a bit too complex to handle automatically inside $sce. - // Instead, we sanitize each of the URIs individually, which works, even dynamically. - - // It's not possible to work around this using `$sce.trustAsMediaUrl`. - // If you want to programmatically set explicitly trusted unsafe URLs, you should use - // `$sce.trustAsHtml` on the whole `img` tag and inject it into the DOM using the - // `ng-bind-html` directive. - - var result = ''; - - // first check if there are spaces because it's not the same pattern - var trimmedSrcset = trim(value); - // ( 999x ,| 999w ,| ,|, ) - var srcPattern = /(\s+\d+x\s*,|\s+\d+w\s*,|\s+,|,\s+)/; - var pattern = /\s/.test(trimmedSrcset) ? srcPattern : /(,)/; - - // split srcset into tuple of uri and descriptor except for the last item - var rawUris = trimmedSrcset.split(pattern); - - // for each tuples - var nbrUrisWith2parts = Math.floor(rawUris.length / 2); - for (var i = 0; i < nbrUrisWith2parts; i++) { - var innerIdx = i * 2; - // sanitize the uri - result += $sce.getTrustedMediaUrl(trim(rawUris[innerIdx])); - // add the descriptor - result += ' ' + trim(rawUris[innerIdx + 1]); - } - - // split the last item into uri and descriptor - var lastTuple = trim(rawUris[i * 2]).split(/\s/); - - // sanitize the last uri - result += $sce.getTrustedMediaUrl(trim(lastTuple[0])); - - // and add the last descriptor if any - if (lastTuple.length === 2) { - result += (' ' + trim(lastTuple[1])); - } - return result; - } - - - function Attributes(element, attributesToCopy) { - if (attributesToCopy) { - var keys = Object.keys(attributesToCopy); - var i, l, key; - - for (i = 0, l = keys.length; i < l; i++) { - key = keys[i]; - this[key] = attributesToCopy[key]; - } - } else { - this.$attr = {}; - } - - this.$$element = element; - } - - Attributes.prototype = { - /** - * @ngdoc method - * @name $compile.directive.Attributes#$normalize - * @kind function - * - * @description - * Converts an attribute name (e.g. dash/colon/underscore-delimited string, optionally prefixed with `x-` or - * `data-`) to its normalized, camelCase form. - * - * Also there is special case for Moz prefix starting with upper case letter. - * - * For further information check out the guide on {@link guide/directive#matching-directives Matching Directives} - * - * @param {string} name Name to normalize - */ - $normalize: directiveNormalize, - - - /** - * @ngdoc method - * @name $compile.directive.Attributes#$addClass - * @kind function - * - * @description - * Adds the CSS class value specified by the classVal parameter to the element. If animations - * are enabled then an animation will be triggered for the class addition. - * - * @param {string} classVal The className value that will be added to the element - */ - $addClass: function(classVal) { - if (classVal && classVal.length > 0) { - $animate.addClass(this.$$element, classVal); - } - }, - - /** - * @ngdoc method - * @name $compile.directive.Attributes#$removeClass - * @kind function - * - * @description - * Removes the CSS class value specified by the classVal parameter from the element. If - * animations are enabled then an animation will be triggered for the class removal. - * - * @param {string} classVal The className value that will be removed from the element - */ - $removeClass: function(classVal) { - if (classVal && classVal.length > 0) { - $animate.removeClass(this.$$element, classVal); - } - }, - - /** - * @ngdoc method - * @name $compile.directive.Attributes#$updateClass - * @kind function - * - * @description - * Adds and removes the appropriate CSS class values to the element based on the difference - * between the new and old CSS class values (specified as newClasses and oldClasses). - * - * @param {string} newClasses The current CSS className value - * @param {string} oldClasses The former CSS className value - */ - $updateClass: function(newClasses, oldClasses) { - var toAdd = tokenDifference(newClasses, oldClasses); - if (toAdd && toAdd.length) { - $animate.addClass(this.$$element, toAdd); - } - - var toRemove = tokenDifference(oldClasses, newClasses); - if (toRemove && toRemove.length) { - $animate.removeClass(this.$$element, toRemove); - } - }, - - /** - * Set a normalized attribute on the element in a way such that all directives - * can share the attribute. This function properly handles boolean attributes. - * @param {string} key Normalized key. (ie ngAttribute) - * @param {string|boolean} value The value to set. If `null` attribute will be deleted. - * @param {boolean=} writeAttr If false, does not write the value to DOM element attribute. - * Defaults to true. - * @param {string=} attrName Optional none normalized name. Defaults to key. - */ - $set: function(key, value, writeAttr, attrName) { - // TODO: decide whether or not to throw an error if "class" - // is set through this function since it may cause $updateClass to - // become unstable. - - var node = this.$$element[0], - booleanKey = getBooleanAttrName(node, key), - aliasedKey = getAliasedAttrName(key), - observer = key, - nodeName; - - if (booleanKey) { - this.$$element.prop(key, value); - attrName = booleanKey; - } else if (aliasedKey) { - this[aliasedKey] = value; - observer = aliasedKey; - } - - this[key] = value; - - // translate normalized key to actual key - if (attrName) { - this.$attr[key] = attrName; - } else { - attrName = this.$attr[key]; - if (!attrName) { - this.$attr[key] = attrName = snake_case(key, '-'); - } - } - - nodeName = nodeName_(this.$$element); - - // Sanitize img[srcset] values. - if (nodeName === 'img' && key === 'srcset') { - this[key] = value = sanitizeSrcset(value, '$set(\'srcset\', value)'); - } - - if (writeAttr !== false) { - if (value === null || isUndefined(value)) { - this.$$element.removeAttr(attrName); - } else { - if (SIMPLE_ATTR_NAME.test(attrName)) { - // jQuery skips special boolean attrs treatment in XML nodes for - // historical reasons and hence AngularJS cannot freely call - // `.attr(attrName, false) with such attributes. To avoid issues - // in XHTML, call `removeAttr` in such cases instead. - // See https://github.com/jquery/jquery/issues/4249 - if (booleanKey && value === false) { - this.$$element.removeAttr(attrName); - } else { - this.$$element.attr(attrName, value); - } - } else { - setSpecialAttr(this.$$element[0], attrName, value); - } - } - } - - // fire observers - var $$observers = this.$$observers; - if ($$observers) { - forEach($$observers[observer], function(fn) { - try { - fn(value); - } catch (e) { - $exceptionHandler(e); - } - }); - } - }, - - - /** - * @ngdoc method - * @name $compile.directive.Attributes#$observe - * @kind function - * - * @description - * Observes an interpolated attribute. - * - * The observer function will be invoked once during the next `$digest` following - * compilation. The observer is then invoked whenever the interpolated value - * changes. - * - * @param {string} key Normalized key. (ie ngAttribute) . - * @param {function(interpolatedValue)} fn Function that will be called whenever - the interpolated value of the attribute changes. - * See the {@link guide/interpolation#how-text-and-attribute-bindings-work Interpolation - * guide} for more info. - * @returns {function()} Returns a deregistration function for this observer. - */ - $observe: function(key, fn) { - var attrs = this, - $$observers = (attrs.$$observers || (attrs.$$observers = createMap())), - listeners = ($$observers[key] || ($$observers[key] = [])); - - listeners.push(fn); - $rootScope.$evalAsync(function() { - if (!listeners.$$inter && attrs.hasOwnProperty(key) && !isUndefined(attrs[key])) { - // no one registered attribute interpolation function, so lets call it manually - fn(attrs[key]); - } - }); - - return function() { - arrayRemove(listeners, fn); - }; - } - }; - - function setSpecialAttr(element, attrName, value) { - // Attributes names that do not start with letters (such as `(click)`) cannot be set using `setAttribute` - // so we have to jump through some hoops to get such an attribute - // https://github.com/angular/angular.js/pull/13318 - specialAttrHolder.innerHTML = ''; - var attributes = specialAttrHolder.firstChild.attributes; - var attribute = attributes[0]; - // We have to remove the attribute from its container element before we can add it to the destination element - attributes.removeNamedItem(attribute.name); - attribute.value = value; - element.attributes.setNamedItem(attribute); - } - - function safeAddClass($element, className) { - try { - $element.addClass(className); - } catch (e) { - // ignore, since it means that we are trying to set class on - // SVG element, where class name is read-only. - } - } - - - var startSymbol = $interpolate.startSymbol(), - endSymbol = $interpolate.endSymbol(), - denormalizeTemplate = (startSymbol === '{{' && endSymbol === '}}') - ? identity - : function denormalizeTemplate(template) { - return template.replace(/\{\{/g, startSymbol).replace(/}}/g, endSymbol); - }, - NG_PREFIX_BINDING = /^ng(Attr|Prop|On)([A-Z].*)$/; - var MULTI_ELEMENT_DIR_RE = /^(.+)Start$/; - - compile.$$addBindingInfo = debugInfoEnabled ? function $$addBindingInfo($element, binding) { - var bindings = $element.data('$binding') || []; - - if (isArray(binding)) { - bindings = bindings.concat(binding); - } else { - bindings.push(binding); - } - - $element.data('$binding', bindings); - } : noop; - - compile.$$addBindingClass = debugInfoEnabled ? function $$addBindingClass($element) { - safeAddClass($element, 'ng-binding'); - } : noop; - - compile.$$addScopeInfo = debugInfoEnabled ? function $$addScopeInfo($element, scope, isolated, noTemplate) { - var dataName = isolated ? (noTemplate ? '$isolateScopeNoTemplate' : '$isolateScope') : '$scope'; - $element.data(dataName, scope); - } : noop; - - compile.$$addScopeClass = debugInfoEnabled ? function $$addScopeClass($element, isolated) { - safeAddClass($element, isolated ? 'ng-isolate-scope' : 'ng-scope'); - } : noop; - - compile.$$createComment = function(directiveName, comment) { - var content = ''; - if (debugInfoEnabled) { - content = ' ' + (directiveName || '') + ': '; - if (comment) content += comment + ' '; - } - return window.document.createComment(content); - }; - - return compile; - - //================================ - - function compile($compileNodes, transcludeFn, maxPriority, ignoreDirective, - previousCompileContext) { - if (!($compileNodes instanceof jqLite)) { - // jquery always rewraps, whereas we need to preserve the original selector so that we can - // modify it. - $compileNodes = jqLite($compileNodes); - } - var compositeLinkFn = - compileNodes($compileNodes, transcludeFn, $compileNodes, - maxPriority, ignoreDirective, previousCompileContext); - compile.$$addScopeClass($compileNodes); - var namespace = null; - return function publicLinkFn(scope, cloneConnectFn, options) { - if (!$compileNodes) { - throw $compileMinErr('multilink', 'This element has already been linked.'); - } - assertArg(scope, 'scope'); - - if (previousCompileContext && previousCompileContext.needsNewScope) { - // A parent directive did a replace and a directive on this element asked - // for transclusion, which caused us to lose a layer of element on which - // we could hold the new transclusion scope, so we will create it manually - // here. - scope = scope.$parent.$new(); - } - - options = options || {}; - var parentBoundTranscludeFn = options.parentBoundTranscludeFn, - transcludeControllers = options.transcludeControllers, - futureParentElement = options.futureParentElement; - - // When `parentBoundTranscludeFn` is passed, it is a - // `controllersBoundTransclude` function (it was previously passed - // as `transclude` to directive.link) so we must unwrap it to get - // its `boundTranscludeFn` - if (parentBoundTranscludeFn && parentBoundTranscludeFn.$$boundTransclude) { - parentBoundTranscludeFn = parentBoundTranscludeFn.$$boundTransclude; - } - - if (!namespace) { - namespace = detectNamespaceForChildElements(futureParentElement); - } - var $linkNode; - if (namespace !== 'html') { - // When using a directive with replace:true and templateUrl the $compileNodes - // (or a child element inside of them) - // might change, so we need to recreate the namespace adapted compileNodes - // for call to the link function. - // Note: This will already clone the nodes... - $linkNode = jqLite( - wrapTemplate(namespace, jqLite('
    ').append($compileNodes).html()) - ); - } else if (cloneConnectFn) { - // important!!: we must call our jqLite.clone() since the jQuery one is trying to be smart - // and sometimes changes the structure of the DOM. - $linkNode = JQLitePrototype.clone.call($compileNodes); - } else { - $linkNode = $compileNodes; - } - - if (transcludeControllers) { - for (var controllerName in transcludeControllers) { - $linkNode.data('$' + controllerName + 'Controller', transcludeControllers[controllerName].instance); - } - } - - compile.$$addScopeInfo($linkNode, scope); - - if (cloneConnectFn) cloneConnectFn($linkNode, scope); - if (compositeLinkFn) compositeLinkFn(scope, $linkNode, $linkNode, parentBoundTranscludeFn); - - if (!cloneConnectFn) { - $compileNodes = compositeLinkFn = null; - } - return $linkNode; - }; - } - - function detectNamespaceForChildElements(parentElement) { - // TODO: Make this detect MathML as well... - var node = parentElement && parentElement[0]; - if (!node) { - return 'html'; - } else { - return nodeName_(node) !== 'foreignobject' && toString.call(node).match(/SVG/) ? 'svg' : 'html'; - } - } - - /** - * Compile function matches each node in nodeList against the directives. Once all directives - * for a particular node are collected their compile functions are executed. The compile - * functions return values - the linking functions - are combined into a composite linking - * function, which is the a linking function for the node. - * - * @param {NodeList} nodeList an array of nodes or NodeList to compile - * @param {function(angular.Scope, cloneAttachFn=)} transcludeFn A linking function, where the - * scope argument is auto-generated to the new child of the transcluded parent scope. - * @param {DOMElement=} $rootElement If the nodeList is the root of the compilation tree then - * the rootElement must be set the jqLite collection of the compile root. This is - * needed so that the jqLite collection items can be replaced with widgets. - * @param {number=} maxPriority Max directive priority. - * @returns {Function} A composite linking function of all of the matched directives or null. - */ - function compileNodes(nodeList, transcludeFn, $rootElement, maxPriority, ignoreDirective, - previousCompileContext) { - var linkFns = [], - // `nodeList` can be either an element's `.childNodes` (live NodeList) - // or a jqLite/jQuery collection or an array - notLiveList = isArray(nodeList) || (nodeList instanceof jqLite), - attrs, directives, nodeLinkFn, childNodes, childLinkFn, linkFnFound, nodeLinkFnFound; - - - for (var i = 0; i < nodeList.length; i++) { - attrs = new Attributes(); - - // Support: IE 11 only - // Workaround for #11781 and #14924 - if (msie === 11) { - mergeConsecutiveTextNodes(nodeList, i, notLiveList); - } - - // We must always refer to `nodeList[i]` hereafter, - // since the nodes can be replaced underneath us. - directives = collectDirectives(nodeList[i], [], attrs, i === 0 ? maxPriority : undefined, - ignoreDirective); - - nodeLinkFn = (directives.length) - ? applyDirectivesToNode(directives, nodeList[i], attrs, transcludeFn, $rootElement, - null, [], [], previousCompileContext) - : null; - - if (nodeLinkFn && nodeLinkFn.scope) { - compile.$$addScopeClass(attrs.$$element); - } - - childLinkFn = (nodeLinkFn && nodeLinkFn.terminal || - !(childNodes = nodeList[i].childNodes) || - !childNodes.length) - ? null - : compileNodes(childNodes, - nodeLinkFn ? ( - (nodeLinkFn.transcludeOnThisElement || !nodeLinkFn.templateOnThisElement) - && nodeLinkFn.transclude) : transcludeFn); - - if (nodeLinkFn || childLinkFn) { - linkFns.push(i, nodeLinkFn, childLinkFn); - linkFnFound = true; - nodeLinkFnFound = nodeLinkFnFound || nodeLinkFn; - } - - //use the previous context only for the first element in the virtual group - previousCompileContext = null; - } - - // return a linking function if we have found anything, null otherwise - return linkFnFound ? compositeLinkFn : null; - - function compositeLinkFn(scope, nodeList, $rootElement, parentBoundTranscludeFn) { - var nodeLinkFn, childLinkFn, node, childScope, i, ii, idx, childBoundTranscludeFn; - var stableNodeList; - - - if (nodeLinkFnFound) { - // copy nodeList so that if a nodeLinkFn removes or adds an element at this DOM level our - // offsets don't get screwed up - var nodeListLength = nodeList.length; - stableNodeList = new Array(nodeListLength); - - // create a sparse array by only copying the elements which have a linkFn - for (i = 0; i < linkFns.length; i += 3) { - idx = linkFns[i]; - stableNodeList[idx] = nodeList[idx]; - } - } else { - stableNodeList = nodeList; - } - - for (i = 0, ii = linkFns.length; i < ii;) { - node = stableNodeList[linkFns[i++]]; - nodeLinkFn = linkFns[i++]; - childLinkFn = linkFns[i++]; - - if (nodeLinkFn) { - if (nodeLinkFn.scope) { - childScope = scope.$new(); - compile.$$addScopeInfo(jqLite(node), childScope); - } else { - childScope = scope; - } - - if (nodeLinkFn.transcludeOnThisElement) { - childBoundTranscludeFn = createBoundTranscludeFn( - scope, nodeLinkFn.transclude, parentBoundTranscludeFn); - - } else if (!nodeLinkFn.templateOnThisElement && parentBoundTranscludeFn) { - childBoundTranscludeFn = parentBoundTranscludeFn; - - } else if (!parentBoundTranscludeFn && transcludeFn) { - childBoundTranscludeFn = createBoundTranscludeFn(scope, transcludeFn); - - } else { - childBoundTranscludeFn = null; - } - - nodeLinkFn(childLinkFn, childScope, node, $rootElement, childBoundTranscludeFn); - - } else if (childLinkFn) { - childLinkFn(scope, node.childNodes, undefined, parentBoundTranscludeFn); - } - } - } - } - - function mergeConsecutiveTextNodes(nodeList, idx, notLiveList) { - var node = nodeList[idx]; - var parent = node.parentNode; - var sibling; - - if (node.nodeType !== NODE_TYPE_TEXT) { - return; - } - - while (true) { - sibling = parent ? node.nextSibling : nodeList[idx + 1]; - if (!sibling || sibling.nodeType !== NODE_TYPE_TEXT) { - break; - } - - node.nodeValue = node.nodeValue + sibling.nodeValue; - - if (sibling.parentNode) { - sibling.parentNode.removeChild(sibling); - } - if (notLiveList && sibling === nodeList[idx + 1]) { - nodeList.splice(idx + 1, 1); - } - } - } - - function createBoundTranscludeFn(scope, transcludeFn, previousBoundTranscludeFn) { - function boundTranscludeFn(transcludedScope, cloneFn, controllers, futureParentElement, containingScope) { - - if (!transcludedScope) { - transcludedScope = scope.$new(false, containingScope); - transcludedScope.$$transcluded = true; - } - - return transcludeFn(transcludedScope, cloneFn, { - parentBoundTranscludeFn: previousBoundTranscludeFn, - transcludeControllers: controllers, - futureParentElement: futureParentElement - }); - } - - // We need to attach the transclusion slots onto the `boundTranscludeFn` - // so that they are available inside the `controllersBoundTransclude` function - var boundSlots = boundTranscludeFn.$$slots = createMap(); - for (var slotName in transcludeFn.$$slots) { - if (transcludeFn.$$slots[slotName]) { - boundSlots[slotName] = createBoundTranscludeFn(scope, transcludeFn.$$slots[slotName], previousBoundTranscludeFn); - } else { - boundSlots[slotName] = null; - } - } - - return boundTranscludeFn; - } - - /** - * Looks for directives on the given node and adds them to the directive collection which is - * sorted. - * - * @param node Node to search. - * @param directives An array to which the directives are added to. This array is sorted before - * the function returns. - * @param attrs The shared attrs object which is used to populate the normalized attributes. - * @param {number=} maxPriority Max directive priority. - */ - function collectDirectives(node, directives, attrs, maxPriority, ignoreDirective) { - var nodeType = node.nodeType, - attrsMap = attrs.$attr, - match, - nodeName, - className; - - switch (nodeType) { - case NODE_TYPE_ELEMENT: /* Element */ - - nodeName = nodeName_(node); - - // use the node name: - addDirective(directives, - directiveNormalize(nodeName), 'E', maxPriority, ignoreDirective); - - // iterate over the attributes - for (var attr, name, nName, value, ngPrefixMatch, nAttrs = node.attributes, - j = 0, jj = nAttrs && nAttrs.length; j < jj; j++) { - var attrStartName = false; - var attrEndName = false; - - var isNgAttr = false, isNgProp = false, isNgEvent = false; - var multiElementMatch; - - attr = nAttrs[j]; - name = attr.name; - value = attr.value; - - nName = directiveNormalize(name.toLowerCase()); - - // Support ng-attr-*, ng-prop-* and ng-on-* - if ((ngPrefixMatch = nName.match(NG_PREFIX_BINDING))) { - isNgAttr = ngPrefixMatch[1] === 'Attr'; - isNgProp = ngPrefixMatch[1] === 'Prop'; - isNgEvent = ngPrefixMatch[1] === 'On'; - - // Normalize the non-prefixed name - name = name.replace(PREFIX_REGEXP, '') - .toLowerCase() - .substr(4 + ngPrefixMatch[1].length).replace(/_(.)/g, function(match, letter) { - return letter.toUpperCase(); - }); - - // Support *-start / *-end multi element directives - } else if ((multiElementMatch = nName.match(MULTI_ELEMENT_DIR_RE)) && directiveIsMultiElement(multiElementMatch[1])) { - attrStartName = name; - attrEndName = name.substr(0, name.length - 5) + 'end'; - name = name.substr(0, name.length - 6); - } - - if (isNgProp || isNgEvent) { - attrs[nName] = value; - attrsMap[nName] = attr.name; - - if (isNgProp) { - addPropertyDirective(node, directives, nName, name); - } else { - addEventDirective(directives, nName, name); - } - } else { - // Update nName for cases where a prefix was removed - // NOTE: the .toLowerCase() is unnecessary and causes https://github.com/angular/angular.js/issues/16624 for ng-attr-* - nName = directiveNormalize(name.toLowerCase()); - attrsMap[nName] = name; - - if (isNgAttr || !attrs.hasOwnProperty(nName)) { - attrs[nName] = value; - if (getBooleanAttrName(node, nName)) { - attrs[nName] = true; // presence means true - } - } - - addAttrInterpolateDirective(node, directives, value, nName, isNgAttr); - addDirective(directives, nName, 'A', maxPriority, ignoreDirective, attrStartName, - attrEndName); - } - } - - if (nodeName === 'input' && node.getAttribute('type') === 'hidden') { - // Hidden input elements can have strange behaviour when navigating back to the page - // This tells the browser not to try to cache and reinstate previous values - node.setAttribute('autocomplete', 'off'); - } - - // use class as directive - if (!cssClassDirectivesEnabled) break; - className = node.className; - if (isObject(className)) { - // Maybe SVGAnimatedString - className = className.animVal; - } - if (isString(className) && className !== '') { - while ((match = CLASS_DIRECTIVE_REGEXP.exec(className))) { - nName = directiveNormalize(match[2]); - if (addDirective(directives, nName, 'C', maxPriority, ignoreDirective)) { - attrs[nName] = trim(match[3]); - } - className = className.substr(match.index + match[0].length); - } - } - break; - case NODE_TYPE_TEXT: /* Text Node */ - addTextInterpolateDirective(directives, node.nodeValue); - break; - case NODE_TYPE_COMMENT: /* Comment */ - if (!commentDirectivesEnabled) break; - collectCommentDirectives(node, directives, attrs, maxPriority, ignoreDirective); - break; - } - - directives.sort(byPriority); - return directives; - } - - function collectCommentDirectives(node, directives, attrs, maxPriority, ignoreDirective) { - // function created because of performance, try/catch disables - // the optimization of the whole function #14848 - try { - var match = COMMENT_DIRECTIVE_REGEXP.exec(node.nodeValue); - if (match) { - var nName = directiveNormalize(match[1]); - if (addDirective(directives, nName, 'M', maxPriority, ignoreDirective)) { - attrs[nName] = trim(match[2]); - } - } - } catch (e) { - // turns out that under some circumstances IE9 throws errors when one attempts to read - // comment's node value. - // Just ignore it and continue. (Can't seem to reproduce in test case.) - } - } - - /** - * Given a node with a directive-start it collects all of the siblings until it finds - * directive-end. - * @param node - * @param attrStart - * @param attrEnd - * @returns {*} - */ - function groupScan(node, attrStart, attrEnd) { - var nodes = []; - var depth = 0; - if (attrStart && node.hasAttribute && node.hasAttribute(attrStart)) { - do { - if (!node) { - throw $compileMinErr('uterdir', - 'Unterminated attribute, found \'{0}\' but no matching \'{1}\' found.', - attrStart, attrEnd); - } - if (node.nodeType === NODE_TYPE_ELEMENT) { - if (node.hasAttribute(attrStart)) depth++; - if (node.hasAttribute(attrEnd)) depth--; - } - nodes.push(node); - node = node.nextSibling; - } while (depth > 0); - } else { - nodes.push(node); - } - - return jqLite(nodes); - } - - /** - * Wrapper for linking function which converts normal linking function into a grouped - * linking function. - * @param linkFn - * @param attrStart - * @param attrEnd - * @returns {Function} - */ - function groupElementsLinkFnWrapper(linkFn, attrStart, attrEnd) { - return function groupedElementsLink(scope, element, attrs, controllers, transcludeFn) { - element = groupScan(element[0], attrStart, attrEnd); - return linkFn(scope, element, attrs, controllers, transcludeFn); - }; - } - - /** - * A function generator that is used to support both eager and lazy compilation - * linking function. - * @param eager - * @param $compileNodes - * @param transcludeFn - * @param maxPriority - * @param ignoreDirective - * @param previousCompileContext - * @returns {Function} - */ - function compilationGenerator(eager, $compileNodes, transcludeFn, maxPriority, ignoreDirective, previousCompileContext) { - var compiled; - - if (eager) { - return compile($compileNodes, transcludeFn, maxPriority, ignoreDirective, previousCompileContext); - } - return /** @this */ function lazyCompilation() { - if (!compiled) { - compiled = compile($compileNodes, transcludeFn, maxPriority, ignoreDirective, previousCompileContext); - - // Null out all of these references in order to make them eligible for garbage collection - // since this is a potentially long lived closure - $compileNodes = transcludeFn = previousCompileContext = null; - } - return compiled.apply(this, arguments); - }; - } - - /** - * Once the directives have been collected, their compile functions are executed. This method - * is responsible for inlining directive templates as well as terminating the application - * of the directives if the terminal directive has been reached. - * - * @param {Array} directives Array of collected directives to execute their compile function. - * this needs to be pre-sorted by priority order. - * @param {Node} compileNode The raw DOM node to apply the compile functions to - * @param {Object} templateAttrs The shared attribute function - * @param {function(angular.Scope, cloneAttachFn=)} transcludeFn A linking function, where the - * scope argument is auto-generated to the new - * child of the transcluded parent scope. - * @param {JQLite} jqCollection If we are working on the root of the compile tree then this - * argument has the root jqLite array so that we can replace nodes - * on it. - * @param {Object=} originalReplaceDirective An optional directive that will be ignored when - * compiling the transclusion. - * @param {Array.} preLinkFns - * @param {Array.} postLinkFns - * @param {Object} previousCompileContext Context used for previous compilation of the current - * node - * @returns {Function} linkFn - */ - function applyDirectivesToNode(directives, compileNode, templateAttrs, transcludeFn, - jqCollection, originalReplaceDirective, preLinkFns, postLinkFns, - previousCompileContext) { - previousCompileContext = previousCompileContext || {}; - - var terminalPriority = -Number.MAX_VALUE, - newScopeDirective = previousCompileContext.newScopeDirective, - controllerDirectives = previousCompileContext.controllerDirectives, - newIsolateScopeDirective = previousCompileContext.newIsolateScopeDirective, - templateDirective = previousCompileContext.templateDirective, - nonTlbTranscludeDirective = previousCompileContext.nonTlbTranscludeDirective, - hasTranscludeDirective = false, - hasTemplate = false, - hasElementTranscludeDirective = previousCompileContext.hasElementTranscludeDirective, - $compileNode = templateAttrs.$$element = jqLite(compileNode), - directive, - directiveName, - $template, - replaceDirective = originalReplaceDirective, - childTranscludeFn = transcludeFn, - linkFn, - didScanForMultipleTransclusion = false, - mightHaveMultipleTransclusionError = false, - directiveValue; - - // executes all directives on the current element - for (var i = 0, ii = directives.length; i < ii; i++) { - directive = directives[i]; - var attrStart = directive.$$start; - var attrEnd = directive.$$end; - - // collect multiblock sections - if (attrStart) { - $compileNode = groupScan(compileNode, attrStart, attrEnd); - } - $template = undefined; - - if (terminalPriority > directive.priority) { - break; // prevent further processing of directives - } - - directiveValue = directive.scope; - - if (directiveValue) { - - // skip the check for directives with async templates, we'll check the derived sync - // directive when the template arrives - if (!directive.templateUrl) { - if (isObject(directiveValue)) { - // This directive is trying to add an isolated scope. - // Check that there is no scope of any kind already - assertNoDuplicate('new/isolated scope', newIsolateScopeDirective || newScopeDirective, - directive, $compileNode); - newIsolateScopeDirective = directive; - } else { - // This directive is trying to add a child scope. - // Check that there is no isolated scope already - assertNoDuplicate('new/isolated scope', newIsolateScopeDirective, directive, - $compileNode); - } - } - - newScopeDirective = newScopeDirective || directive; - } - - directiveName = directive.name; - - // If we encounter a condition that can result in transclusion on the directive, - // then scan ahead in the remaining directives for others that may cause a multiple - // transclusion error to be thrown during the compilation process. If a matching directive - // is found, then we know that when we encounter a transcluded directive, we need to eagerly - // compile the `transclude` function rather than doing it lazily in order to throw - // exceptions at the correct time - if (!didScanForMultipleTransclusion && ((directive.replace && (directive.templateUrl || directive.template)) - || (directive.transclude && !directive.$$tlb))) { - var candidateDirective; - - for (var scanningIndex = i + 1; (candidateDirective = directives[scanningIndex++]);) { - if ((candidateDirective.transclude && !candidateDirective.$$tlb) - || (candidateDirective.replace && (candidateDirective.templateUrl || candidateDirective.template))) { - mightHaveMultipleTransclusionError = true; - break; - } - } - - didScanForMultipleTransclusion = true; - } - - if (!directive.templateUrl && directive.controller) { - controllerDirectives = controllerDirectives || createMap(); - assertNoDuplicate('\'' + directiveName + '\' controller', - controllerDirectives[directiveName], directive, $compileNode); - controllerDirectives[directiveName] = directive; - } - - directiveValue = directive.transclude; - - if (directiveValue) { - hasTranscludeDirective = true; - - // Special case ngIf and ngRepeat so that we don't complain about duplicate transclusion. - // This option should only be used by directives that know how to safely handle element transclusion, - // where the transcluded nodes are added or replaced after linking. - if (!directive.$$tlb) { - assertNoDuplicate('transclusion', nonTlbTranscludeDirective, directive, $compileNode); - nonTlbTranscludeDirective = directive; - } - - if (directiveValue === 'element') { - hasElementTranscludeDirective = true; - terminalPriority = directive.priority; - $template = $compileNode; - $compileNode = templateAttrs.$$element = - jqLite(compile.$$createComment(directiveName, templateAttrs[directiveName])); - compileNode = $compileNode[0]; - replaceWith(jqCollection, sliceArgs($template), compileNode); - - childTranscludeFn = compilationGenerator(mightHaveMultipleTransclusionError, $template, transcludeFn, terminalPriority, - replaceDirective && replaceDirective.name, { - // Don't pass in: - // - controllerDirectives - otherwise we'll create duplicates controllers - // - newIsolateScopeDirective or templateDirective - combining templates with - // element transclusion doesn't make sense. - // - // We need only nonTlbTranscludeDirective so that we prevent putting transclusion - // on the same element more than once. - nonTlbTranscludeDirective: nonTlbTranscludeDirective - }); - } else { - - var slots = createMap(); - - if (!isObject(directiveValue)) { - $template = jqLite(jqLiteClone(compileNode)).contents(); - } else { - - // We have transclusion slots, - // collect them up, compile them and store their transclusion functions - $template = window.document.createDocumentFragment(); - - var slotMap = createMap(); - var filledSlots = createMap(); - - // Parse the element selectors - forEach(directiveValue, function(elementSelector, slotName) { - // If an element selector starts with a ? then it is optional - var optional = (elementSelector.charAt(0) === '?'); - elementSelector = optional ? elementSelector.substring(1) : elementSelector; - - slotMap[elementSelector] = slotName; - - // We explicitly assign `null` since this implies that a slot was defined but not filled. - // Later when calling boundTransclusion functions with a slot name we only error if the - // slot is `undefined` - slots[slotName] = null; - - // filledSlots contains `true` for all slots that are either optional or have been - // filled. This is used to check that we have not missed any required slots - filledSlots[slotName] = optional; - }); - - // Add the matching elements into their slot - forEach($compileNode.contents(), function(node) { - var slotName = slotMap[directiveNormalize(nodeName_(node))]; - if (slotName) { - filledSlots[slotName] = true; - slots[slotName] = slots[slotName] || window.document.createDocumentFragment(); - slots[slotName].appendChild(node); - } else { - $template.appendChild(node); - } - }); - - // Check for required slots that were not filled - forEach(filledSlots, function(filled, slotName) { - if (!filled) { - throw $compileMinErr('reqslot', 'Required transclusion slot `{0}` was not filled.', slotName); - } - }); - - for (var slotName in slots) { - if (slots[slotName]) { - // Only define a transclusion function if the slot was filled - var slotCompileNodes = jqLite(slots[slotName].childNodes); - slots[slotName] = compilationGenerator(mightHaveMultipleTransclusionError, slotCompileNodes, transcludeFn); - } - } - - $template = jqLite($template.childNodes); - } - - $compileNode.empty(); // clear contents - childTranscludeFn = compilationGenerator(mightHaveMultipleTransclusionError, $template, transcludeFn, undefined, - undefined, { needsNewScope: directive.$$isolateScope || directive.$$newScope}); - childTranscludeFn.$$slots = slots; - } - } - - if (directive.template) { - hasTemplate = true; - assertNoDuplicate('template', templateDirective, directive, $compileNode); - templateDirective = directive; - - directiveValue = (isFunction(directive.template)) - ? directive.template($compileNode, templateAttrs) - : directive.template; - - directiveValue = denormalizeTemplate(directiveValue); - - if (directive.replace) { - replaceDirective = directive; - if (jqLiteIsTextNode(directiveValue)) { - $template = []; - } else { - $template = removeComments(wrapTemplate(directive.templateNamespace, trim(directiveValue))); - } - compileNode = $template[0]; - - if ($template.length !== 1 || compileNode.nodeType !== NODE_TYPE_ELEMENT) { - throw $compileMinErr('tplrt', - 'Template for directive \'{0}\' must have exactly one root element. {1}', - directiveName, ''); - } - - replaceWith(jqCollection, $compileNode, compileNode); - - var newTemplateAttrs = {$attr: {}}; - - // combine directives from the original node and from the template: - // - take the array of directives for this element - // - split it into two parts, those that already applied (processed) and those that weren't (unprocessed) - // - collect directives from the template and sort them by priority - // - combine directives as: processed + template + unprocessed - var templateDirectives = collectDirectives(compileNode, [], newTemplateAttrs); - var unprocessedDirectives = directives.splice(i + 1, directives.length - (i + 1)); - - if (newIsolateScopeDirective || newScopeDirective) { - // The original directive caused the current element to be replaced but this element - // also needs to have a new scope, so we need to tell the template directives - // that they would need to get their scope from further up, if they require transclusion - markDirectiveScope(templateDirectives, newIsolateScopeDirective, newScopeDirective); - } - directives = directives.concat(templateDirectives).concat(unprocessedDirectives); - mergeTemplateAttributes(templateAttrs, newTemplateAttrs); - - ii = directives.length; - } else { - $compileNode.html(directiveValue); - } - } - - if (directive.templateUrl) { - hasTemplate = true; - assertNoDuplicate('template', templateDirective, directive, $compileNode); - templateDirective = directive; - - if (directive.replace) { - replaceDirective = directive; - } - - // eslint-disable-next-line no-func-assign - nodeLinkFn = compileTemplateUrl(directives.splice(i, directives.length - i), $compileNode, - templateAttrs, jqCollection, hasTranscludeDirective && childTranscludeFn, preLinkFns, postLinkFns, { - controllerDirectives: controllerDirectives, - newScopeDirective: (newScopeDirective !== directive) && newScopeDirective, - newIsolateScopeDirective: newIsolateScopeDirective, - templateDirective: templateDirective, - nonTlbTranscludeDirective: nonTlbTranscludeDirective - }); - ii = directives.length; - } else if (directive.compile) { - try { - linkFn = directive.compile($compileNode, templateAttrs, childTranscludeFn); - var context = directive.$$originalDirective || directive; - if (isFunction(linkFn)) { - addLinkFns(null, bind(context, linkFn), attrStart, attrEnd); - } else if (linkFn) { - addLinkFns(bind(context, linkFn.pre), bind(context, linkFn.post), attrStart, attrEnd); - } - } catch (e) { - $exceptionHandler(e, startingTag($compileNode)); - } - } - - if (directive.terminal) { - nodeLinkFn.terminal = true; - terminalPriority = Math.max(terminalPriority, directive.priority); - } - - } - - nodeLinkFn.scope = newScopeDirective && newScopeDirective.scope === true; - nodeLinkFn.transcludeOnThisElement = hasTranscludeDirective; - nodeLinkFn.templateOnThisElement = hasTemplate; - nodeLinkFn.transclude = childTranscludeFn; - - previousCompileContext.hasElementTranscludeDirective = hasElementTranscludeDirective; - - // might be normal or delayed nodeLinkFn depending on if templateUrl is present - return nodeLinkFn; - - //////////////////// - - function addLinkFns(pre, post, attrStart, attrEnd) { - if (pre) { - if (attrStart) pre = groupElementsLinkFnWrapper(pre, attrStart, attrEnd); - pre.require = directive.require; - pre.directiveName = directiveName; - if (newIsolateScopeDirective === directive || directive.$$isolateScope) { - pre = cloneAndAnnotateFn(pre, {isolateScope: true}); - } - preLinkFns.push(pre); - } - if (post) { - if (attrStart) post = groupElementsLinkFnWrapper(post, attrStart, attrEnd); - post.require = directive.require; - post.directiveName = directiveName; - if (newIsolateScopeDirective === directive || directive.$$isolateScope) { - post = cloneAndAnnotateFn(post, {isolateScope: true}); - } - postLinkFns.push(post); - } - } - - function nodeLinkFn(childLinkFn, scope, linkNode, $rootElement, boundTranscludeFn) { - var i, ii, linkFn, isolateScope, controllerScope, elementControllers, transcludeFn, $element, - attrs, scopeBindingInfo; - - if (compileNode === linkNode) { - attrs = templateAttrs; - $element = templateAttrs.$$element; - } else { - $element = jqLite(linkNode); - attrs = new Attributes($element, templateAttrs); - } - - controllerScope = scope; - if (newIsolateScopeDirective) { - isolateScope = scope.$new(true); - } else if (newScopeDirective) { - controllerScope = scope.$parent; - } - - if (boundTranscludeFn) { - // track `boundTranscludeFn` so it can be unwrapped if `transcludeFn` - // is later passed as `parentBoundTranscludeFn` to `publicLinkFn` - transcludeFn = controllersBoundTransclude; - transcludeFn.$$boundTransclude = boundTranscludeFn; - // expose the slots on the `$transclude` function - transcludeFn.isSlotFilled = function(slotName) { - return !!boundTranscludeFn.$$slots[slotName]; - }; - } - - if (controllerDirectives) { - elementControllers = setupControllers($element, attrs, transcludeFn, controllerDirectives, isolateScope, scope, newIsolateScopeDirective); - } - - if (newIsolateScopeDirective) { - // Initialize isolate scope bindings for new isolate scope directive. - compile.$$addScopeInfo($element, isolateScope, true, !(templateDirective && (templateDirective === newIsolateScopeDirective || - templateDirective === newIsolateScopeDirective.$$originalDirective))); - compile.$$addScopeClass($element, true); - isolateScope.$$isolateBindings = - newIsolateScopeDirective.$$isolateBindings; - scopeBindingInfo = initializeDirectiveBindings(scope, attrs, isolateScope, - isolateScope.$$isolateBindings, - newIsolateScopeDirective); - if (scopeBindingInfo.removeWatches) { - isolateScope.$on('$destroy', scopeBindingInfo.removeWatches); - } - } - - // Initialize bindToController bindings - for (var name in elementControllers) { - var controllerDirective = controllerDirectives[name]; - var controller = elementControllers[name]; - var bindings = controllerDirective.$$bindings.bindToController; - - controller.instance = controller(); - $element.data('$' + controllerDirective.name + 'Controller', controller.instance); - controller.bindingInfo = - initializeDirectiveBindings(controllerScope, attrs, controller.instance, bindings, controllerDirective); - } - - // Bind the required controllers to the controller, if `require` is an object and `bindToController` is truthy - forEach(controllerDirectives, function(controllerDirective, name) { - var require = controllerDirective.require; - if (controllerDirective.bindToController && !isArray(require) && isObject(require)) { - extend(elementControllers[name].instance, getControllers(name, require, $element, elementControllers)); - } - }); - - // Handle the init and destroy lifecycle hooks on all controllers that have them - forEach(elementControllers, function(controller) { - var controllerInstance = controller.instance; - if (isFunction(controllerInstance.$onChanges)) { - try { - controllerInstance.$onChanges(controller.bindingInfo.initialChanges); - } catch (e) { - $exceptionHandler(e); - } - } - if (isFunction(controllerInstance.$onInit)) { - try { - controllerInstance.$onInit(); - } catch (e) { - $exceptionHandler(e); - } - } - if (isFunction(controllerInstance.$doCheck)) { - controllerScope.$watch(function() { controllerInstance.$doCheck(); }); - controllerInstance.$doCheck(); - } - if (isFunction(controllerInstance.$onDestroy)) { - controllerScope.$on('$destroy', function callOnDestroyHook() { - controllerInstance.$onDestroy(); - }); - } - }); - - // PRELINKING - for (i = 0, ii = preLinkFns.length; i < ii; i++) { - linkFn = preLinkFns[i]; - invokeLinkFn(linkFn, - linkFn.isolateScope ? isolateScope : scope, - $element, - attrs, - linkFn.require && getControllers(linkFn.directiveName, linkFn.require, $element, elementControllers), - transcludeFn - ); - } - - // RECURSION - // We only pass the isolate scope, if the isolate directive has a template, - // otherwise the child elements do not belong to the isolate directive. - var scopeToChild = scope; - if (newIsolateScopeDirective && (newIsolateScopeDirective.template || newIsolateScopeDirective.templateUrl === null)) { - scopeToChild = isolateScope; - } - if (childLinkFn) { - childLinkFn(scopeToChild, linkNode.childNodes, undefined, boundTranscludeFn); - } - - // POSTLINKING - for (i = postLinkFns.length - 1; i >= 0; i--) { - linkFn = postLinkFns[i]; - invokeLinkFn(linkFn, - linkFn.isolateScope ? isolateScope : scope, - $element, - attrs, - linkFn.require && getControllers(linkFn.directiveName, linkFn.require, $element, elementControllers), - transcludeFn - ); - } - - // Trigger $postLink lifecycle hooks - forEach(elementControllers, function(controller) { - var controllerInstance = controller.instance; - if (isFunction(controllerInstance.$postLink)) { - controllerInstance.$postLink(); - } - }); - - // This is the function that is injected as `$transclude`. - // Note: all arguments are optional! - function controllersBoundTransclude(scope, cloneAttachFn, futureParentElement, slotName) { - var transcludeControllers; - // No scope passed in: - if (!isScope(scope)) { - slotName = futureParentElement; - futureParentElement = cloneAttachFn; - cloneAttachFn = scope; - scope = undefined; - } - - if (hasElementTranscludeDirective) { - transcludeControllers = elementControllers; - } - if (!futureParentElement) { - futureParentElement = hasElementTranscludeDirective ? $element.parent() : $element; - } - if (slotName) { - // slotTranscludeFn can be one of three things: - // * a transclude function - a filled slot - // * `null` - an optional slot that was not filled - // * `undefined` - a slot that was not declared (i.e. invalid) - var slotTranscludeFn = boundTranscludeFn.$$slots[slotName]; - if (slotTranscludeFn) { - return slotTranscludeFn(scope, cloneAttachFn, transcludeControllers, futureParentElement, scopeToChild); - } else if (isUndefined(slotTranscludeFn)) { - throw $compileMinErr('noslot', - 'No parent directive that requires a transclusion with slot name "{0}". ' + - 'Element: {1}', - slotName, startingTag($element)); - } - } else { - return boundTranscludeFn(scope, cloneAttachFn, transcludeControllers, futureParentElement, scopeToChild); - } - } - } - } - - function getControllers(directiveName, require, $element, elementControllers) { - var value; - - if (isString(require)) { - var match = require.match(REQUIRE_PREFIX_REGEXP); - var name = require.substring(match[0].length); - var inheritType = match[1] || match[3]; - var optional = match[2] === '?'; - - //If only parents then start at the parent element - if (inheritType === '^^') { - $element = $element.parent(); - //Otherwise attempt getting the controller from elementControllers in case - //the element is transcluded (and has no data) and to avoid .data if possible - } else { - value = elementControllers && elementControllers[name]; - value = value && value.instance; - } - - if (!value) { - var dataName = '$' + name + 'Controller'; - - if (inheritType === '^^' && $element[0] && $element[0].nodeType === NODE_TYPE_DOCUMENT) { - // inheritedData() uses the documentElement when it finds the document, so we would - // require from the element itself. - value = null; - } else { - value = inheritType ? $element.inheritedData(dataName) : $element.data(dataName); - } - } - - if (!value && !optional) { - throw $compileMinErr('ctreq', - 'Controller \'{0}\', required by directive \'{1}\', can\'t be found!', - name, directiveName); - } - } else if (isArray(require)) { - value = []; - for (var i = 0, ii = require.length; i < ii; i++) { - value[i] = getControllers(directiveName, require[i], $element, elementControllers); - } - } else if (isObject(require)) { - value = {}; - forEach(require, function(controller, property) { - value[property] = getControllers(directiveName, controller, $element, elementControllers); - }); - } - - return value || null; - } - - function setupControllers($element, attrs, transcludeFn, controllerDirectives, isolateScope, scope, newIsolateScopeDirective) { - var elementControllers = createMap(); - for (var controllerKey in controllerDirectives) { - var directive = controllerDirectives[controllerKey]; - var locals = { - $scope: directive === newIsolateScopeDirective || directive.$$isolateScope ? isolateScope : scope, - $element: $element, - $attrs: attrs, - $transclude: transcludeFn - }; - - var controller = directive.controller; - if (controller === '@') { - controller = attrs[directive.name]; - } - - var controllerInstance = $controller(controller, locals, true, directive.controllerAs); - - // For directives with element transclusion the element is a comment. - // In this case .data will not attach any data. - // Instead, we save the controllers for the element in a local hash and attach to .data - // later, once we have the actual element. - elementControllers[directive.name] = controllerInstance; - $element.data('$' + directive.name + 'Controller', controllerInstance.instance); - } - return elementControllers; - } - - // Depending upon the context in which a directive finds itself it might need to have a new isolated - // or child scope created. For instance: - // * if the directive has been pulled into a template because another directive with a higher priority - // asked for element transclusion - // * if the directive itself asks for transclusion but it is at the root of a template and the original - // element was replaced. See https://github.com/angular/angular.js/issues/12936 - function markDirectiveScope(directives, isolateScope, newScope) { - for (var j = 0, jj = directives.length; j < jj; j++) { - directives[j] = inherit(directives[j], {$$isolateScope: isolateScope, $$newScope: newScope}); - } - } - - /** - * looks up the directive and decorates it with exception handling and proper parameters. We - * call this the boundDirective. - * - * @param {string} name name of the directive to look up. - * @param {string} location The directive must be found in specific format. - * String containing any of theses characters: - * - * * `E`: element name - * * `A': attribute - * * `C`: class - * * `M`: comment - * @returns {boolean} true if directive was added. - */ - function addDirective(tDirectives, name, location, maxPriority, ignoreDirective, startAttrName, - endAttrName) { - if (name === ignoreDirective) return null; - var match = null; - if (hasDirectives.hasOwnProperty(name)) { - for (var directive, directives = $injector.get(name + Suffix), - i = 0, ii = directives.length; i < ii; i++) { - directive = directives[i]; - if ((isUndefined(maxPriority) || maxPriority > directive.priority) && - directive.restrict.indexOf(location) !== -1) { - if (startAttrName) { - directive = inherit(directive, {$$start: startAttrName, $$end: endAttrName}); - } - if (!directive.$$bindings) { - var bindings = directive.$$bindings = - parseDirectiveBindings(directive, directive.name); - if (isObject(bindings.isolateScope)) { - directive.$$isolateBindings = bindings.isolateScope; - } - } - tDirectives.push(directive); - match = directive; - } - } - } - return match; - } - - - /** - * looks up the directive and returns true if it is a multi-element directive, - * and therefore requires DOM nodes between -start and -end markers to be grouped - * together. - * - * @param {string} name name of the directive to look up. - * @returns true if directive was registered as multi-element. - */ - function directiveIsMultiElement(name) { - if (hasDirectives.hasOwnProperty(name)) { - for (var directive, directives = $injector.get(name + Suffix), - i = 0, ii = directives.length; i < ii; i++) { - directive = directives[i]; - if (directive.multiElement) { - return true; - } - } - } - return false; - } - - /** - * When the element is replaced with HTML template then the new attributes - * on the template need to be merged with the existing attributes in the DOM. - * The desired effect is to have both of the attributes present. - * - * @param {object} dst destination attributes (original DOM) - * @param {object} src source attributes (from the directive template) - */ - function mergeTemplateAttributes(dst, src) { - var srcAttr = src.$attr, - dstAttr = dst.$attr; - - // reapply the old attributes to the new element - forEach(dst, function(value, key) { - if (key.charAt(0) !== '$') { - if (src[key] && src[key] !== value) { - if (value.length) { - value += (key === 'style' ? ';' : ' ') + src[key]; - } else { - value = src[key]; - } - } - dst.$set(key, value, true, srcAttr[key]); - } - }); - - // copy the new attributes on the old attrs object - forEach(src, function(value, key) { - // Check if we already set this attribute in the loop above. - // `dst` will never contain hasOwnProperty as DOM parser won't let it. - // You will get an "InvalidCharacterError: DOM Exception 5" error if you - // have an attribute like "has-own-property" or "data-has-own-property", etc. - if (!dst.hasOwnProperty(key) && key.charAt(0) !== '$') { - dst[key] = value; - - if (key !== 'class' && key !== 'style') { - dstAttr[key] = srcAttr[key]; - } - } - }); - } - - - function compileTemplateUrl(directives, $compileNode, tAttrs, - $rootElement, childTranscludeFn, preLinkFns, postLinkFns, previousCompileContext) { - var linkQueue = [], - afterTemplateNodeLinkFn, - afterTemplateChildLinkFn, - beforeTemplateCompileNode = $compileNode[0], - origAsyncDirective = directives.shift(), - derivedSyncDirective = inherit(origAsyncDirective, { - templateUrl: null, transclude: null, replace: null, $$originalDirective: origAsyncDirective - }), - templateUrl = (isFunction(origAsyncDirective.templateUrl)) - ? origAsyncDirective.templateUrl($compileNode, tAttrs) - : origAsyncDirective.templateUrl, - templateNamespace = origAsyncDirective.templateNamespace; - - $compileNode.empty(); - - $templateRequest(templateUrl) - .then(function(content) { - var compileNode, tempTemplateAttrs, $template, childBoundTranscludeFn; - - content = denormalizeTemplate(content); - - if (origAsyncDirective.replace) { - if (jqLiteIsTextNode(content)) { - $template = []; - } else { - $template = removeComments(wrapTemplate(templateNamespace, trim(content))); - } - compileNode = $template[0]; - - if ($template.length !== 1 || compileNode.nodeType !== NODE_TYPE_ELEMENT) { - throw $compileMinErr('tplrt', - 'Template for directive \'{0}\' must have exactly one root element. {1}', - origAsyncDirective.name, templateUrl); - } - - tempTemplateAttrs = {$attr: {}}; - replaceWith($rootElement, $compileNode, compileNode); - var templateDirectives = collectDirectives(compileNode, [], tempTemplateAttrs); - - if (isObject(origAsyncDirective.scope)) { - // the original directive that caused the template to be loaded async required - // an isolate scope - markDirectiveScope(templateDirectives, true); - } - directives = templateDirectives.concat(directives); - mergeTemplateAttributes(tAttrs, tempTemplateAttrs); - } else { - compileNode = beforeTemplateCompileNode; - $compileNode.html(content); - } - - directives.unshift(derivedSyncDirective); - - afterTemplateNodeLinkFn = applyDirectivesToNode(directives, compileNode, tAttrs, - childTranscludeFn, $compileNode, origAsyncDirective, preLinkFns, postLinkFns, - previousCompileContext); - forEach($rootElement, function(node, i) { - if (node === compileNode) { - $rootElement[i] = $compileNode[0]; - } - }); - afterTemplateChildLinkFn = compileNodes($compileNode[0].childNodes, childTranscludeFn); - - while (linkQueue.length) { - var scope = linkQueue.shift(), - beforeTemplateLinkNode = linkQueue.shift(), - linkRootElement = linkQueue.shift(), - boundTranscludeFn = linkQueue.shift(), - linkNode = $compileNode[0]; - - if (scope.$$destroyed) continue; - - if (beforeTemplateLinkNode !== beforeTemplateCompileNode) { - var oldClasses = beforeTemplateLinkNode.className; - - if (!(previousCompileContext.hasElementTranscludeDirective && - origAsyncDirective.replace)) { - // it was cloned therefore we have to clone as well. - linkNode = jqLiteClone(compileNode); - } - replaceWith(linkRootElement, jqLite(beforeTemplateLinkNode), linkNode); - - // Copy in CSS classes from original node - safeAddClass(jqLite(linkNode), oldClasses); - } - if (afterTemplateNodeLinkFn.transcludeOnThisElement) { - childBoundTranscludeFn = createBoundTranscludeFn(scope, afterTemplateNodeLinkFn.transclude, boundTranscludeFn); - } else { - childBoundTranscludeFn = boundTranscludeFn; - } - afterTemplateNodeLinkFn(afterTemplateChildLinkFn, scope, linkNode, $rootElement, - childBoundTranscludeFn); - } - linkQueue = null; - }).catch(function(error) { - if (isError(error)) { - $exceptionHandler(error); - } - }); - - return function delayedNodeLinkFn(ignoreChildLinkFn, scope, node, rootElement, boundTranscludeFn) { - var childBoundTranscludeFn = boundTranscludeFn; - if (scope.$$destroyed) return; - if (linkQueue) { - linkQueue.push(scope, - node, - rootElement, - childBoundTranscludeFn); - } else { - if (afterTemplateNodeLinkFn.transcludeOnThisElement) { - childBoundTranscludeFn = createBoundTranscludeFn(scope, afterTemplateNodeLinkFn.transclude, boundTranscludeFn); - } - afterTemplateNodeLinkFn(afterTemplateChildLinkFn, scope, node, rootElement, childBoundTranscludeFn); - } - }; - } - - - /** - * Sorting function for bound directives. - */ - function byPriority(a, b) { - var diff = b.priority - a.priority; - if (diff !== 0) return diff; - if (a.name !== b.name) return (a.name < b.name) ? -1 : 1; - return a.index - b.index; - } - - function assertNoDuplicate(what, previousDirective, directive, element) { - - function wrapModuleNameIfDefined(moduleName) { - return moduleName ? - (' (module: ' + moduleName + ')') : - ''; - } - - if (previousDirective) { - throw $compileMinErr('multidir', 'Multiple directives [{0}{1}, {2}{3}] asking for {4} on: {5}', - previousDirective.name, wrapModuleNameIfDefined(previousDirective.$$moduleName), - directive.name, wrapModuleNameIfDefined(directive.$$moduleName), what, startingTag(element)); - } - } - - - function addTextInterpolateDirective(directives, text) { - var interpolateFn = $interpolate(text, true); - if (interpolateFn) { - directives.push({ - priority: 0, - compile: function textInterpolateCompileFn(templateNode) { - var templateNodeParent = templateNode.parent(), - hasCompileParent = !!templateNodeParent.length; - - // When transcluding a template that has bindings in the root - // we don't have a parent and thus need to add the class during linking fn. - if (hasCompileParent) compile.$$addBindingClass(templateNodeParent); - - return function textInterpolateLinkFn(scope, node) { - var parent = node.parent(); - if (!hasCompileParent) compile.$$addBindingClass(parent); - compile.$$addBindingInfo(parent, interpolateFn.expressions); - scope.$watch(interpolateFn, function interpolateFnWatchAction(value) { - node[0].nodeValue = value; - }); - }; - } - }); - } - } - - - function wrapTemplate(type, template) { - type = lowercase(type || 'html'); - switch (type) { - case 'svg': - case 'math': - var wrapper = window.document.createElement('div'); - wrapper.innerHTML = '<' + type + '>' + template + ''; - return wrapper.childNodes[0].childNodes; - default: - return template; - } - } - - - function getTrustedAttrContext(nodeName, attrNormalizedName) { - if (attrNormalizedName === 'srcdoc') { - return $sce.HTML; - } - // All nodes with src attributes require a RESOURCE_URL value, except for - // img and various html5 media nodes, which require the MEDIA_URL context. - if (attrNormalizedName === 'src' || attrNormalizedName === 'ngSrc') { - if (['img', 'video', 'audio', 'source', 'track'].indexOf(nodeName) === -1) { - return $sce.RESOURCE_URL; - } - return $sce.MEDIA_URL; - } else if (attrNormalizedName === 'xlinkHref') { - // Some xlink:href are okay, most aren't - if (nodeName === 'image') return $sce.MEDIA_URL; - if (nodeName === 'a') return $sce.URL; - return $sce.RESOURCE_URL; - } else if ( - // Formaction - (nodeName === 'form' && attrNormalizedName === 'action') || - // If relative URLs can go where they are not expected to, then - // all sorts of trust issues can arise. - (nodeName === 'base' && attrNormalizedName === 'href') || - // links can be stylesheets or imports, which can run script in the current origin - (nodeName === 'link' && attrNormalizedName === 'href') - ) { - return $sce.RESOURCE_URL; - } else if (nodeName === 'a' && (attrNormalizedName === 'href' || - attrNormalizedName === 'ngHref')) { - return $sce.URL; - } - } - - function getTrustedPropContext(nodeName, propNormalizedName) { - var prop = propNormalizedName.toLowerCase(); - return PROP_CONTEXTS[nodeName + '|' + prop] || PROP_CONTEXTS['*|' + prop]; - } - - function sanitizeSrcsetPropertyValue(value) { - return sanitizeSrcset($sce.valueOf(value), 'ng-prop-srcset'); - } - function addPropertyDirective(node, directives, attrName, propName) { - if (EVENT_HANDLER_ATTR_REGEXP.test(propName)) { - throw $compileMinErr('nodomevents', 'Property bindings for HTML DOM event properties are disallowed'); - } - - var nodeName = nodeName_(node); - var trustedContext = getTrustedPropContext(nodeName, propName); - - var sanitizer = identity; - // Sanitize img[srcset] + source[srcset] values. - if (propName === 'srcset' && (nodeName === 'img' || nodeName === 'source')) { - sanitizer = sanitizeSrcsetPropertyValue; - } else if (trustedContext) { - sanitizer = $sce.getTrusted.bind($sce, trustedContext); - } - - directives.push({ - priority: 100, - compile: function ngPropCompileFn(_, attr) { - var ngPropGetter = $parse(attr[attrName]); - var ngPropWatch = $parse(attr[attrName], function sceValueOf(val) { - // Unwrap the value to compare the actual inner safe value, not the wrapper object. - return $sce.valueOf(val); - }); - - return { - pre: function ngPropPreLinkFn(scope, $element) { - function applyPropValue() { - var propValue = ngPropGetter(scope); - $element[0][propName] = sanitizer(propValue); - } - - applyPropValue(); - scope.$watch(ngPropWatch, applyPropValue); - } - }; - } - }); - } - - function addEventDirective(directives, attrName, eventName) { - directives.push( - createEventDirective($parse, $rootScope, $exceptionHandler, attrName, eventName, /*forceAsync=*/false) - ); - } - - function addAttrInterpolateDirective(node, directives, value, name, isNgAttr) { - var nodeName = nodeName_(node); - var trustedContext = getTrustedAttrContext(nodeName, name); - var mustHaveExpression = !isNgAttr; - var allOrNothing = ALL_OR_NOTHING_ATTRS[name] || isNgAttr; - - var interpolateFn = $interpolate(value, mustHaveExpression, trustedContext, allOrNothing); - - // no interpolation found -> ignore - if (!interpolateFn) return; - - if (name === 'multiple' && nodeName === 'select') { - throw $compileMinErr('selmulti', - 'Binding to the \'multiple\' attribute is not supported. Element: {0}', - startingTag(node)); - } - - if (EVENT_HANDLER_ATTR_REGEXP.test(name)) { - throw $compileMinErr('nodomevents', 'Interpolations for HTML DOM event attributes are disallowed'); - } - - directives.push({ - priority: 100, - compile: function() { - return { - pre: function attrInterpolatePreLinkFn(scope, element, attr) { - var $$observers = (attr.$$observers || (attr.$$observers = createMap())); - - // If the attribute has changed since last $interpolate()ed - var newValue = attr[name]; - if (newValue !== value) { - // we need to interpolate again since the attribute value has been updated - // (e.g. by another directive's compile function) - // ensure unset/empty values make interpolateFn falsy - interpolateFn = newValue && $interpolate(newValue, true, trustedContext, allOrNothing); - value = newValue; - } - - // if attribute was updated so that there is no interpolation going on we don't want to - // register any observers - if (!interpolateFn) return; - - // initialize attr object so that it's ready in case we need the value for isolate - // scope initialization, otherwise the value would not be available from isolate - // directive's linking fn during linking phase - attr[name] = interpolateFn(scope); - - ($$observers[name] || ($$observers[name] = [])).$$inter = true; - (attr.$$observers && attr.$$observers[name].$$scope || scope). - $watch(interpolateFn, function interpolateFnWatchAction(newValue, oldValue) { - //special case for class attribute addition + removal - //so that class changes can tap into the animation - //hooks provided by the $animate service. Be sure to - //skip animations when the first digest occurs (when - //both the new and the old values are the same) since - //the CSS classes are the non-interpolated values - if (name === 'class' && newValue !== oldValue) { - attr.$updateClass(newValue, oldValue); - } else { - attr.$set(name, newValue); - } - }); - } - }; - } - }); - } - - - /** - * This is a special jqLite.replaceWith, which can replace items which - * have no parents, provided that the containing jqLite collection is provided. - * - * @param {JqLite=} $rootElement The root of the compile tree. Used so that we can replace nodes - * in the root of the tree. - * @param {JqLite} elementsToRemove The jqLite element which we are going to replace. We keep - * the shell, but replace its DOM node reference. - * @param {Node} newNode The new DOM node. - */ - function replaceWith($rootElement, elementsToRemove, newNode) { - var firstElementToRemove = elementsToRemove[0], - removeCount = elementsToRemove.length, - parent = firstElementToRemove.parentNode, - i, ii; - - if ($rootElement) { - for (i = 0, ii = $rootElement.length; i < ii; i++) { - if ($rootElement[i] === firstElementToRemove) { - $rootElement[i++] = newNode; - for (var j = i, j2 = j + removeCount - 1, - jj = $rootElement.length; - j < jj; j++, j2++) { - if (j2 < jj) { - $rootElement[j] = $rootElement[j2]; - } else { - delete $rootElement[j]; - } - } - $rootElement.length -= removeCount - 1; - - // If the replaced element is also the jQuery .context then replace it - // .context is a deprecated jQuery api, so we should set it only when jQuery set it - // http://api.jquery.com/context/ - if ($rootElement.context === firstElementToRemove) { - $rootElement.context = newNode; - } - break; - } - } - } - - if (parent) { - parent.replaceChild(newNode, firstElementToRemove); - } - - // Append all the `elementsToRemove` to a fragment. This will... - // - remove them from the DOM - // - allow them to still be traversed with .nextSibling - // - allow a single fragment.qSA to fetch all elements being removed - var fragment = window.document.createDocumentFragment(); - for (i = 0; i < removeCount; i++) { - fragment.appendChild(elementsToRemove[i]); - } - - if (jqLite.hasData(firstElementToRemove)) { - // Copy over user data (that includes AngularJS's $scope etc.). Don't copy private - // data here because there's no public interface in jQuery to do that and copying over - // event listeners (which is the main use of private data) wouldn't work anyway. - jqLite.data(newNode, jqLite.data(firstElementToRemove)); - - // Remove $destroy event listeners from `firstElementToRemove` - jqLite(firstElementToRemove).off('$destroy'); - } - - // Cleanup any data/listeners on the elements and children. - // This includes invoking the $destroy event on any elements with listeners. - jqLite.cleanData(fragment.querySelectorAll('*')); - - // Update the jqLite collection to only contain the `newNode` - for (i = 1; i < removeCount; i++) { - delete elementsToRemove[i]; - } - elementsToRemove[0] = newNode; - elementsToRemove.length = 1; - } - - - function cloneAndAnnotateFn(fn, annotation) { - return extend(function() { return fn.apply(null, arguments); }, fn, annotation); - } - - - function invokeLinkFn(linkFn, scope, $element, attrs, controllers, transcludeFn) { - try { - linkFn(scope, $element, attrs, controllers, transcludeFn); - } catch (e) { - $exceptionHandler(e, startingTag($element)); - } - } - - function strictBindingsCheck(attrName, directiveName) { - if (strictComponentBindingsEnabled) { - throw $compileMinErr('missingattr', - 'Attribute \'{0}\' of \'{1}\' is non-optional and must be set!', - attrName, directiveName); - } - } - - // Set up $watches for isolate scope and controller bindings. - function initializeDirectiveBindings(scope, attrs, destination, bindings, directive) { - var removeWatchCollection = []; - var initialChanges = {}; - var changes; - - forEach(bindings, function initializeBinding(definition, scopeName) { - var attrName = definition.attrName, - optional = definition.optional, - mode = definition.mode, // @, =, <, or & - lastValue, - parentGet, parentSet, compare, removeWatch; - - switch (mode) { - - case '@': - if (!optional && !hasOwnProperty.call(attrs, attrName)) { - strictBindingsCheck(attrName, directive.name); - destination[scopeName] = attrs[attrName] = undefined; - - } - removeWatch = attrs.$observe(attrName, function(value) { - if (isString(value) || isBoolean(value)) { - var oldValue = destination[scopeName]; - recordChanges(scopeName, value, oldValue); - destination[scopeName] = value; - } - }); - attrs.$$observers[attrName].$$scope = scope; - lastValue = attrs[attrName]; - if (isString(lastValue)) { - // If the attribute has been provided then we trigger an interpolation to ensure - // the value is there for use in the link fn - destination[scopeName] = $interpolate(lastValue)(scope); - } else if (isBoolean(lastValue)) { - // If the attributes is one of the BOOLEAN_ATTR then AngularJS will have converted - // the value to boolean rather than a string, so we special case this situation - destination[scopeName] = lastValue; - } - initialChanges[scopeName] = new SimpleChange(_UNINITIALIZED_VALUE, destination[scopeName]); - removeWatchCollection.push(removeWatch); - break; - - case '=': - if (!hasOwnProperty.call(attrs, attrName)) { - if (optional) break; - strictBindingsCheck(attrName, directive.name); - attrs[attrName] = undefined; - } - if (optional && !attrs[attrName]) break; - - parentGet = $parse(attrs[attrName]); - if (parentGet.literal) { - compare = equals; - } else { - compare = simpleCompare; - } - parentSet = parentGet.assign || function() { - // reset the change, or we will throw this exception on every $digest - lastValue = destination[scopeName] = parentGet(scope); - throw $compileMinErr('nonassign', - 'Expression \'{0}\' in attribute \'{1}\' used with directive \'{2}\' is non-assignable!', - attrs[attrName], attrName, directive.name); - }; - lastValue = destination[scopeName] = parentGet(scope); - var parentValueWatch = function parentValueWatch(parentValue) { - if (!compare(parentValue, destination[scopeName])) { - // we are out of sync and need to copy - if (!compare(parentValue, lastValue)) { - // parent changed and it has precedence - destination[scopeName] = parentValue; - } else { - // if the parent can be assigned then do so - parentSet(scope, parentValue = destination[scopeName]); - } - } - lastValue = parentValue; - return lastValue; - }; - parentValueWatch.$stateful = true; - if (definition.collection) { - removeWatch = scope.$watchCollection(attrs[attrName], parentValueWatch); - } else { - removeWatch = scope.$watch($parse(attrs[attrName], parentValueWatch), null, parentGet.literal); - } - removeWatchCollection.push(removeWatch); - break; - - case '<': - if (!hasOwnProperty.call(attrs, attrName)) { - if (optional) break; - strictBindingsCheck(attrName, directive.name); - attrs[attrName] = undefined; - } - if (optional && !attrs[attrName]) break; - - parentGet = $parse(attrs[attrName]); - var isLiteral = parentGet.literal; - - var initialValue = destination[scopeName] = parentGet(scope); - initialChanges[scopeName] = new SimpleChange(_UNINITIALIZED_VALUE, destination[scopeName]); - - removeWatch = scope[definition.collection ? '$watchCollection' : '$watch'](parentGet, function parentValueWatchAction(newValue, oldValue) { - if (oldValue === newValue) { - if (oldValue === initialValue || (isLiteral && equals(oldValue, initialValue))) { - return; - } - oldValue = initialValue; - } - recordChanges(scopeName, newValue, oldValue); - destination[scopeName] = newValue; - }); - - removeWatchCollection.push(removeWatch); - break; - - case '&': - if (!optional && !hasOwnProperty.call(attrs, attrName)) { - strictBindingsCheck(attrName, directive.name); - } - // Don't assign Object.prototype method to scope - parentGet = attrs.hasOwnProperty(attrName) ? $parse(attrs[attrName]) : noop; - - // Don't assign noop to destination if expression is not valid - if (parentGet === noop && optional) break; - - destination[scopeName] = function(locals) { - return parentGet(scope, locals); - }; - break; - } - }); - - function recordChanges(key, currentValue, previousValue) { - if (isFunction(destination.$onChanges) && !simpleCompare(currentValue, previousValue)) { - // If we have not already scheduled the top level onChangesQueue handler then do so now - if (!onChangesQueue) { - scope.$$postDigest(flushOnChangesQueue); - onChangesQueue = []; - } - // If we have not already queued a trigger of onChanges for this controller then do so now - if (!changes) { - changes = {}; - onChangesQueue.push(triggerOnChangesHook); - } - // If the has been a change on this property already then we need to reuse the previous value - if (changes[key]) { - previousValue = changes[key].previousValue; - } - // Store this change - changes[key] = new SimpleChange(previousValue, currentValue); - } - } - - function triggerOnChangesHook() { - destination.$onChanges(changes); - // Now clear the changes so that we schedule onChanges when more changes arrive - changes = undefined; - } - - return { - initialChanges: initialChanges, - removeWatches: removeWatchCollection.length && function removeWatches() { - for (var i = 0, ii = removeWatchCollection.length; i < ii; ++i) { - removeWatchCollection[i](); - } - } - }; - } - }]; -} - -function SimpleChange(previous, current) { - this.previousValue = previous; - this.currentValue = current; -} -SimpleChange.prototype.isFirstChange = function() { return this.previousValue === _UNINITIALIZED_VALUE; }; - - -var PREFIX_REGEXP = /^((?:x|data)[:\-_])/i; -var SPECIAL_CHARS_REGEXP = /[:\-_]+(.)/g; - -/** - * Converts all accepted directives format into proper directive name. - * @param name Name to normalize - */ -function directiveNormalize(name) { - return name - .replace(PREFIX_REGEXP, '') - .replace(SPECIAL_CHARS_REGEXP, function(_, letter, offset) { - return offset ? letter.toUpperCase() : letter; - }); -} - -/** - * @ngdoc type - * @name $compile.directive.Attributes - * - * @description - * A shared object between directive compile / linking functions which contains normalized DOM - * element attributes. The values reflect current binding state `{{ }}`. The normalization is - * needed since all of these are treated as equivalent in AngularJS: - * - * ``` - * - * ``` - */ - -/** - * @ngdoc property - * @name $compile.directive.Attributes#$attr - * - * @description - * A map of DOM element attribute names to the normalized name. This is - * needed to do reverse lookup from normalized name back to actual name. - */ - - -/** - * @ngdoc method - * @name $compile.directive.Attributes#$set - * @kind function - * - * @description - * Set DOM element attribute value. - * - * - * @param {string} name Normalized element attribute name of the property to modify. The name is - * reverse-translated using the {@link ng.$compile.directive.Attributes#$attr $attr} - * property to the original name. - * @param {string} value Value to set the attribute to. The value can be an interpolated string. - */ - - - -/** - * Closure compiler type information - */ - -function nodesetLinkingFn( - /* angular.Scope */ scope, - /* NodeList */ nodeList, - /* Element */ rootElement, - /* function(Function) */ boundTranscludeFn -) {} - -function directiveLinkingFn( - /* nodesetLinkingFn */ nodesetLinkingFn, - /* angular.Scope */ scope, - /* Node */ node, - /* Element */ rootElement, - /* function(Function) */ boundTranscludeFn -) {} - -function tokenDifference(str1, str2) { - var values = '', - tokens1 = str1.split(/\s+/), - tokens2 = str2.split(/\s+/); - - outer: - for (var i = 0; i < tokens1.length; i++) { - var token = tokens1[i]; - for (var j = 0; j < tokens2.length; j++) { - if (token === tokens2[j]) continue outer; - } - values += (values.length > 0 ? ' ' : '') + token; - } - return values; -} - -function removeComments(jqNodes) { - jqNodes = jqLite(jqNodes); - var i = jqNodes.length; - - if (i <= 1) { - return jqNodes; - } - - while (i--) { - var node = jqNodes[i]; - if (node.nodeType === NODE_TYPE_COMMENT || - (node.nodeType === NODE_TYPE_TEXT && node.nodeValue.trim() === '')) { - splice.call(jqNodes, i, 1); - } - } - return jqNodes; -} - -var $controllerMinErr = minErr('$controller'); - - -var CNTRL_REG = /^(\S+)(\s+as\s+([\w$]+))?$/; -function identifierForController(controller, ident) { - if (ident && isString(ident)) return ident; - if (isString(controller)) { - var match = CNTRL_REG.exec(controller); - if (match) return match[3]; - } -} - - -/** - * @ngdoc provider - * @name $controllerProvider - * @this - * - * @description - * The {@link ng.$controller $controller service} is used by AngularJS to create new - * controllers. - * - * This provider allows controller registration via the - * {@link ng.$controllerProvider#register register} method. - */ -function $ControllerProvider() { - var controllers = {}; - - /** - * @ngdoc method - * @name $controllerProvider#has - * @param {string} name Controller name to check. - */ - this.has = function(name) { - return controllers.hasOwnProperty(name); - }; - - /** - * @ngdoc method - * @name $controllerProvider#register - * @param {string|Object} name Controller name, or an object map of controllers where the keys are - * the names and the values are the constructors. - * @param {Function|Array} constructor Controller constructor fn (optionally decorated with DI - * annotations in the array notation). - */ - this.register = function(name, constructor) { - assertNotHasOwnProperty(name, 'controller'); - if (isObject(name)) { - extend(controllers, name); - } else { - controllers[name] = constructor; - } - }; - - this.$get = ['$injector', function($injector) { - - /** - * @ngdoc service - * @name $controller - * @requires $injector - * - * @param {Function|string} constructor If called with a function then it's considered to be the - * controller constructor function. Otherwise it's considered to be a string which is used - * to retrieve the controller constructor using the following steps: - * - * * check if a controller with given name is registered via `$controllerProvider` - * * check if evaluating the string on the current scope returns a constructor - * - * The string can use the `controller as property` syntax, where the controller instance is published - * as the specified property on the `scope`; the `scope` must be injected into `locals` param for this - * to work correctly. - * - * @param {Object} locals Injection locals for Controller. - * @return {Object} Instance of given controller. - * - * @description - * `$controller` service is responsible for instantiating controllers. - * - * It's just a simple call to {@link auto.$injector $injector}, but extracted into - * a service, so that one can override this service with [BC version](https://gist.github.com/1649788). - */ - return function $controller(expression, locals, later, ident) { - // PRIVATE API: - // param `later` --- indicates that the controller's constructor is invoked at a later time. - // If true, $controller will allocate the object with the correct - // prototype chain, but will not invoke the controller until a returned - // callback is invoked. - // param `ident` --- An optional label which overrides the label parsed from the controller - // expression, if any. - var instance, match, constructor, identifier; - later = later === true; - if (ident && isString(ident)) { - identifier = ident; - } - - if (isString(expression)) { - match = expression.match(CNTRL_REG); - if (!match) { - throw $controllerMinErr('ctrlfmt', - 'Badly formed controller string \'{0}\'. ' + - 'Must match `__name__ as __id__` or `__name__`.', expression); - } - constructor = match[1]; - identifier = identifier || match[3]; - expression = controllers.hasOwnProperty(constructor) - ? controllers[constructor] - : getter(locals.$scope, constructor, true); - - if (!expression) { - throw $controllerMinErr('ctrlreg', - 'The controller with the name \'{0}\' is not registered.', constructor); - } - - assertArgFn(expression, constructor, true); - } - - if (later) { - // Instantiate controller later: - // This machinery is used to create an instance of the object before calling the - // controller's constructor itself. - // - // This allows properties to be added to the controller before the constructor is - // invoked. Primarily, this is used for isolate scope bindings in $compile. - // - // This feature is not intended for use by applications, and is thus not documented - // publicly. - // Object creation: http://jsperf.com/create-constructor/2 - var controllerPrototype = (isArray(expression) ? - expression[expression.length - 1] : expression).prototype; - instance = Object.create(controllerPrototype || null); - - if (identifier) { - addIdentifier(locals, identifier, instance, constructor || expression.name); - } - - return extend(function $controllerInit() { - var result = $injector.invoke(expression, instance, locals, constructor); - if (result !== instance && (isObject(result) || isFunction(result))) { - instance = result; - if (identifier) { - // If result changed, re-assign controllerAs value to scope. - addIdentifier(locals, identifier, instance, constructor || expression.name); - } - } - return instance; - }, { - instance: instance, - identifier: identifier - }); - } - - instance = $injector.instantiate(expression, locals, constructor); - - if (identifier) { - addIdentifier(locals, identifier, instance, constructor || expression.name); - } - - return instance; - }; - - function addIdentifier(locals, identifier, instance, name) { - if (!(locals && isObject(locals.$scope))) { - throw minErr('$controller')('noscp', - 'Cannot export controller \'{0}\' as \'{1}\'! No $scope object provided via `locals`.', - name, identifier); - } - - locals.$scope[identifier] = instance; - } - }]; -} - -/** - * @ngdoc service - * @name $document - * @requires $window - * @this - * - * @description - * A {@link angular.element jQuery or jqLite} wrapper for the browser's `window.document` object. - * - * @example - - -
    -

    $document title:

    -

    window.document title:

    -
    -
    - - angular.module('documentExample', []) - .controller('ExampleController', ['$scope', '$document', function($scope, $document) { - $scope.title = $document[0].title; - $scope.windowTitle = angular.element(window.document)[0].title; - }]); - -
    - */ -function $DocumentProvider() { - this.$get = ['$window', function(window) { - return jqLite(window.document); - }]; -} - - -/** - * @private - * @this - * Listens for document visibility change and makes the current status accessible. - */ -function $$IsDocumentHiddenProvider() { - this.$get = ['$document', '$rootScope', function($document, $rootScope) { - var doc = $document[0]; - var hidden = doc && doc.hidden; - - $document.on('visibilitychange', changeListener); - - $rootScope.$on('$destroy', function() { - $document.off('visibilitychange', changeListener); - }); - - function changeListener() { - hidden = doc.hidden; - } - - return function() { - return hidden; - }; - }]; -} - -/** - * @ngdoc service - * @name $exceptionHandler - * @requires ng.$log - * @this - * - * @description - * Any uncaught exception in AngularJS expressions is delegated to this service. - * The default implementation simply delegates to `$log.error` which logs it into - * the browser console. - * - * In unit tests, if `angular-mocks.js` is loaded, this service is overridden by - * {@link ngMock.$exceptionHandler mock $exceptionHandler} which aids in testing. - * - * ## Example: - * - * The example below will overwrite the default `$exceptionHandler` in order to (a) log uncaught - * errors to the backend for later inspection by the developers and (b) to use `$log.warn()` instead - * of `$log.error()`. - * - * ```js - * angular. - * module('exceptionOverwrite', []). - * factory('$exceptionHandler', ['$log', 'logErrorsToBackend', function($log, logErrorsToBackend) { - * return function myExceptionHandler(exception, cause) { - * logErrorsToBackend(exception, cause); - * $log.warn(exception, cause); - * }; - * }]); - * ``` - * - *
    - * Note, that code executed in event-listeners (even those registered using jqLite's `on`/`bind` - * methods) does not delegate exceptions to the {@link ng.$exceptionHandler $exceptionHandler} - * (unless executed during a digest). - * - * If you wish, you can manually delegate exceptions, e.g. - * `try { ... } catch(e) { $exceptionHandler(e); }` - * - * @param {Error} exception Exception associated with the error. - * @param {string=} cause Optional information about the context in which - * the error was thrown. - * - */ -function $ExceptionHandlerProvider() { - this.$get = ['$log', function($log) { - return function(exception, cause) { - $log.error.apply($log, arguments); - }; - }]; -} - -var $$ForceReflowProvider = /** @this */ function() { - this.$get = ['$document', function($document) { - return function(domNode) { - //the line below will force the browser to perform a repaint so - //that all the animated elements within the animation frame will - //be properly updated and drawn on screen. This is required to - //ensure that the preparation animation is properly flushed so that - //the active state picks up from there. DO NOT REMOVE THIS LINE. - //DO NOT OPTIMIZE THIS LINE. THE MINIFIER WILL REMOVE IT OTHERWISE WHICH - //WILL RESULT IN AN UNPREDICTABLE BUG THAT IS VERY HARD TO TRACK DOWN AND - //WILL TAKE YEARS AWAY FROM YOUR LIFE. - if (domNode) { - if (!domNode.nodeType && domNode instanceof jqLite) { - domNode = domNode[0]; - } - } else { - domNode = $document[0].body; - } - return domNode.offsetWidth + 1; - }; - }]; -}; - -var APPLICATION_JSON = 'application/json'; -var CONTENT_TYPE_APPLICATION_JSON = {'Content-Type': APPLICATION_JSON + ';charset=utf-8'}; -var JSON_START = /^\[|^\{(?!\{)/; -var JSON_ENDS = { - '[': /]$/, - '{': /}$/ -}; -var JSON_PROTECTION_PREFIX = /^\)]\}',?\n/; -var $httpMinErr = minErr('$http'); - -function serializeValue(v) { - if (isObject(v)) { - return isDate(v) ? v.toISOString() : toJson(v); - } - return v; -} - - -/** @this */ -function $HttpParamSerializerProvider() { - /** - * @ngdoc service - * @name $httpParamSerializer - * @description - * - * Default {@link $http `$http`} params serializer that converts objects to strings - * according to the following rules: - * - * * `{'foo': 'bar'}` results in `foo=bar` - * * `{'foo': Date.now()}` results in `foo=2015-04-01T09%3A50%3A49.262Z` (`toISOString()` and encoded representation of a Date object) - * * `{'foo': ['bar', 'baz']}` results in `foo=bar&foo=baz` (repeated key for each array element) - * * `{'foo': {'bar':'baz'}}` results in `foo=%7B%22bar%22%3A%22baz%22%7D` (stringified and encoded representation of an object) - * - * Note that serializer will sort the request parameters alphabetically. - */ - - this.$get = function() { - return function ngParamSerializer(params) { - if (!params) return ''; - var parts = []; - forEachSorted(params, function(value, key) { - if (value === null || isUndefined(value) || isFunction(value)) return; - if (isArray(value)) { - forEach(value, function(v) { - parts.push(encodeUriQuery(key) + '=' + encodeUriQuery(serializeValue(v))); - }); - } else { - parts.push(encodeUriQuery(key) + '=' + encodeUriQuery(serializeValue(value))); - } - }); - - return parts.join('&'); - }; - }; -} - -/** @this */ -function $HttpParamSerializerJQLikeProvider() { - /** - * @ngdoc service - * @name $httpParamSerializerJQLike - * - * @description - * - * Alternative {@link $http `$http`} params serializer that follows - * jQuery's [`param()`](http://api.jquery.com/jquery.param/) method logic. - * The serializer will also sort the params alphabetically. - * - * To use it for serializing `$http` request parameters, set it as the `paramSerializer` property: - * - * ```js - * $http({ - * url: myUrl, - * method: 'GET', - * params: myParams, - * paramSerializer: '$httpParamSerializerJQLike' - * }); - * ``` - * - * It is also possible to set it as the default `paramSerializer` in the - * {@link $httpProvider#defaults `$httpProvider`}. - * - * Additionally, you can inject the serializer and use it explicitly, for example to serialize - * form data for submission: - * - * ```js - * .controller(function($http, $httpParamSerializerJQLike) { - * //... - * - * $http({ - * url: myUrl, - * method: 'POST', - * data: $httpParamSerializerJQLike(myData), - * headers: { - * 'Content-Type': 'application/x-www-form-urlencoded' - * } - * }); - * - * }); - * ``` - * - */ - this.$get = function() { - return function jQueryLikeParamSerializer(params) { - if (!params) return ''; - var parts = []; - serialize(params, '', true); - return parts.join('&'); - - function serialize(toSerialize, prefix, topLevel) { - if (isArray(toSerialize)) { - forEach(toSerialize, function(value, index) { - serialize(value, prefix + '[' + (isObject(value) ? index : '') + ']'); - }); - } else if (isObject(toSerialize) && !isDate(toSerialize)) { - forEachSorted(toSerialize, function(value, key) { - serialize(value, prefix + - (topLevel ? '' : '[') + - key + - (topLevel ? '' : ']')); - }); - } else { - if (isFunction(toSerialize)) { - toSerialize = toSerialize(); - } - parts.push(encodeUriQuery(prefix) + '=' + - (toSerialize == null ? '' : encodeUriQuery(serializeValue(toSerialize)))); - } - } - }; - }; -} - -function defaultHttpResponseTransform(data, headers) { - if (isString(data)) { - // Strip json vulnerability protection prefix and trim whitespace - var tempData = data.replace(JSON_PROTECTION_PREFIX, '').trim(); - - if (tempData) { - var contentType = headers('Content-Type'); - var hasJsonContentType = contentType && (contentType.indexOf(APPLICATION_JSON) === 0); - - if (hasJsonContentType || isJsonLike(tempData)) { - try { - data = fromJson(tempData); - } catch (e) { - if (!hasJsonContentType) { - return data; - } - throw $httpMinErr('baddata', 'Data must be a valid JSON object. Received: "{0}". ' + - 'Parse error: "{1}"', data, e); - } - } - } - } - - return data; -} - -function isJsonLike(str) { - var jsonStart = str.match(JSON_START); - return jsonStart && JSON_ENDS[jsonStart[0]].test(str); -} - -/** - * Parse headers into key value object - * - * @param {string} headers Raw headers as a string - * @returns {Object} Parsed headers as key value object - */ -function parseHeaders(headers) { - var parsed = createMap(), i; - - function fillInParsed(key, val) { - if (key) { - parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val; - } - } - - if (isString(headers)) { - forEach(headers.split('\n'), function(line) { - i = line.indexOf(':'); - fillInParsed(lowercase(trim(line.substr(0, i))), trim(line.substr(i + 1))); - }); - } else if (isObject(headers)) { - forEach(headers, function(headerVal, headerKey) { - fillInParsed(lowercase(headerKey), trim(headerVal)); - }); - } - - return parsed; -} - - -/** - * Returns a function that provides access to parsed headers. - * - * Headers are lazy parsed when first requested. - * @see parseHeaders - * - * @param {(string|Object)} headers Headers to provide access to. - * @returns {function(string=)} Returns a getter function which if called with: - * - * - if called with an argument returns a single header value or null - * - if called with no arguments returns an object containing all headers. - */ -function headersGetter(headers) { - var headersObj; - - return function(name) { - if (!headersObj) headersObj = parseHeaders(headers); - - if (name) { - var value = headersObj[lowercase(name)]; - if (value === undefined) { - value = null; - } - return value; - } - - return headersObj; - }; -} - - -/** - * Chain all given functions - * - * This function is used for both request and response transforming - * - * @param {*} data Data to transform. - * @param {function(string=)} headers HTTP headers getter fn. - * @param {number} status HTTP status code of the response. - * @param {(Function|Array.)} fns Function or an array of functions. - * @returns {*} Transformed data. - */ -function transformData(data, headers, status, fns) { - if (isFunction(fns)) { - return fns(data, headers, status); - } - - forEach(fns, function(fn) { - data = fn(data, headers, status); - }); - - return data; -} - - -function isSuccess(status) { - return 200 <= status && status < 300; -} - - -/** - * @ngdoc provider - * @name $httpProvider - * @this - * - * @description - * Use `$httpProvider` to change the default behavior of the {@link ng.$http $http} service. - */ -function $HttpProvider() { - /** - * @ngdoc property - * @name $httpProvider#defaults - * @description - * - * Object containing default values for all {@link ng.$http $http} requests. - * - * - **`defaults.cache`** - {boolean|Object} - A boolean value or object created with - * {@link ng.$cacheFactory `$cacheFactory`} to enable or disable caching of HTTP responses - * by default. See {@link $http#caching $http Caching} for more information. - * - * - **`defaults.headers`** - {Object} - Default headers for all $http requests. - * Refer to {@link ng.$http#setting-http-headers $http} for documentation on - * setting default headers. - * - **`defaults.headers.common`** - * - **`defaults.headers.post`** - * - **`defaults.headers.put`** - * - **`defaults.headers.patch`** - * - * - **`defaults.jsonpCallbackParam`** - `{string}` - the name of the query parameter that passes the name of the - * callback in a JSONP request. The value of this parameter will be replaced with the expression generated by the - * {@link $jsonpCallbacks} service. Defaults to `'callback'`. - * - * - **`defaults.paramSerializer`** - `{string|function(Object):string}` - A function - * used to the prepare string representation of request parameters (specified as an object). - * If specified as string, it is interpreted as a function registered with the {@link auto.$injector $injector}. - * Defaults to {@link ng.$httpParamSerializer $httpParamSerializer}. - * - * - **`defaults.transformRequest`** - - * `{Array|function(data, headersGetter)}` - - * An array of functions (or a single function) which are applied to the request data. - * By default, this is an array with one request transformation function: - * - * - If the `data` property of the request configuration object contains an object, serialize it - * into JSON format. - * - * - **`defaults.transformResponse`** - - * `{Array|function(data, headersGetter, status)}` - - * An array of functions (or a single function) which are applied to the response data. By default, - * this is an array which applies one response transformation function that does two things: - * - * - If XSRF prefix is detected, strip it - * (see {@link ng.$http#security-considerations Security Considerations in the $http docs}). - * - If the `Content-Type` is `application/json` or the response looks like JSON, - * deserialize it using a JSON parser. - * - * - **`defaults.xsrfCookieName`** - {string} - Name of cookie containing the XSRF token. - * Defaults value is `'XSRF-TOKEN'`. - * - * - **`defaults.xsrfHeaderName`** - {string} - Name of HTTP header to populate with the - * XSRF token. Defaults value is `'X-XSRF-TOKEN'`. - * - */ - var defaults = this.defaults = { - // transform incoming response data - transformResponse: [defaultHttpResponseTransform], - - // transform outgoing request data - transformRequest: [function(d) { - return isObject(d) && !isFile(d) && !isBlob(d) && !isFormData(d) ? toJson(d) : d; - }], - - // default headers - headers: { - common: { - 'Accept': 'application/json, text/plain, */*' - }, - post: shallowCopy(CONTENT_TYPE_APPLICATION_JSON), - put: shallowCopy(CONTENT_TYPE_APPLICATION_JSON), - patch: shallowCopy(CONTENT_TYPE_APPLICATION_JSON) - }, - - xsrfCookieName: 'XSRF-TOKEN', - xsrfHeaderName: 'X-XSRF-TOKEN', - - paramSerializer: '$httpParamSerializer', - - jsonpCallbackParam: 'callback' - }; - - var useApplyAsync = false; - /** - * @ngdoc method - * @name $httpProvider#useApplyAsync - * @description - * - * Configure $http service to combine processing of multiple http responses received at around - * the same time via {@link ng.$rootScope.Scope#$applyAsync $rootScope.$applyAsync}. This can result in - * significant performance improvement for bigger applications that make many HTTP requests - * concurrently (common during application bootstrap). - * - * Defaults to false. If no value is specified, returns the current configured value. - * - * @param {boolean=} value If true, when requests are loaded, they will schedule a deferred - * "apply" on the next tick, giving time for subsequent requests in a roughly ~10ms window - * to load and share the same digest cycle. - * - * @returns {boolean|Object} If a value is specified, returns the $httpProvider for chaining. - * otherwise, returns the current configured value. - */ - this.useApplyAsync = function(value) { - if (isDefined(value)) { - useApplyAsync = !!value; - return this; - } - return useApplyAsync; - }; - - /** - * @ngdoc property - * @name $httpProvider#interceptors - * @description - * - * Array containing service factories for all synchronous or asynchronous {@link ng.$http $http} - * pre-processing of request or postprocessing of responses. - * - * These service factories are ordered by request, i.e. they are applied in the same order as the - * array, on request, but reverse order, on response. - * - * {@link ng.$http#interceptors Interceptors detailed info} - */ - var interceptorFactories = this.interceptors = []; - - /** - * @ngdoc property - * @name $httpProvider#xsrfWhitelistedOrigins - * @description - * - * Array containing URLs whose origins are trusted to receive the XSRF token. See the - * {@link ng.$http#security-considerations Security Considerations} sections for more details on - * XSRF. - * - * **Note:** An "origin" consists of the [URI scheme](https://en.wikipedia.org/wiki/URI_scheme), - * the [hostname](https://en.wikipedia.org/wiki/Hostname) and the - * [port number](https://en.wikipedia.org/wiki/Port_(computer_networking). For `http:` and - * `https:`, the port number can be omitted if using th default ports (80 and 443 respectively). - * Examples: `http://example.com`, `https://api.example.com:9876` - * - *
    - * It is not possible to whitelist specific URLs/paths. The `path`, `query` and `fragment` parts - * of a URL will be ignored. For example, `https://foo.com/path/bar?query=baz#fragment` will be - * treated as `https://foo.com`, meaning that **all** requests to URLs starting with - * `https://foo.com/` will include the XSRF token. - *
    - * - * @example - * - * ```js - * // App served from `https://example.com/`. - * angular. - * module('xsrfWhitelistedOriginsExample', []). - * config(['$httpProvider', function($httpProvider) { - * $httpProvider.xsrfWhitelistedOrigins.push('https://api.example.com'); - * }]). - * run(['$http', function($http) { - * // The XSRF token will be sent. - * $http.get('https://api.example.com/preferences').then(...); - * - * // The XSRF token will NOT be sent. - * $http.get('https://stats.example.com/activity').then(...); - * }]); - * ``` - */ - var xsrfWhitelistedOrigins = this.xsrfWhitelistedOrigins = []; - - this.$get = ['$browser', '$httpBackend', '$$cookieReader', '$cacheFactory', '$rootScope', '$q', '$injector', '$sce', - function($browser, $httpBackend, $$cookieReader, $cacheFactory, $rootScope, $q, $injector, $sce) { - - var defaultCache = $cacheFactory('$http'); - - /** - * Make sure that default param serializer is exposed as a function - */ - defaults.paramSerializer = isString(defaults.paramSerializer) ? - $injector.get(defaults.paramSerializer) : defaults.paramSerializer; - - /** - * Interceptors stored in reverse order. Inner interceptors before outer interceptors. - * The reversal is needed so that we can build up the interception chain around the - * server request. - */ - var reversedInterceptors = []; - - forEach(interceptorFactories, function(interceptorFactory) { - reversedInterceptors.unshift(isString(interceptorFactory) - ? $injector.get(interceptorFactory) : $injector.invoke(interceptorFactory)); - }); - - /** - * A function to check request URLs against a list of allowed origins. - */ - var urlIsAllowedOrigin = urlIsAllowedOriginFactory(xsrfWhitelistedOrigins); - - /** - * @ngdoc service - * @kind function - * @name $http - * @requires ng.$httpBackend - * @requires $cacheFactory - * @requires $rootScope - * @requires $q - * @requires $injector - * - * @description - * The `$http` service is a core AngularJS service that facilitates communication with the remote - * HTTP servers via the browser's [XMLHttpRequest](https://developer.mozilla.org/en/xmlhttprequest) - * object or via [JSONP](http://en.wikipedia.org/wiki/JSONP). - * - * For unit testing applications that use `$http` service, see - * {@link ngMock.$httpBackend $httpBackend mock}. - * - * For a higher level of abstraction, please check out the {@link ngResource.$resource - * $resource} service. - * - * The $http API is based on the {@link ng.$q deferred/promise APIs} exposed by - * the $q service. While for simple usage patterns this doesn't matter much, for advanced usage - * it is important to familiarize yourself with these APIs and the guarantees they provide. - * - * - * ## General usage - * The `$http` service is a function which takes a single argument — a {@link $http#usage configuration object} — - * that is used to generate an HTTP request and returns a {@link ng.$q promise} that is - * resolved (request success) or rejected (request failure) with a - * {@link ng.$http#$http-returns response} object. - * - * ```js - * // Simple GET request example: - * $http({ - * method: 'GET', - * url: '/someUrl' - * }).then(function successCallback(response) { - * // this callback will be called asynchronously - * // when the response is available - * }, function errorCallback(response) { - * // called asynchronously if an error occurs - * // or server returns response with an error status. - * }); - * ``` - * - * - * ## Shortcut methods - * - * Shortcut methods are also available. All shortcut methods require passing in the URL, and - * request data must be passed in for POST/PUT requests. An optional config can be passed as the - * last argument. - * - * ```js - * $http.get('/someUrl', config).then(successCallback, errorCallback); - * $http.post('/someUrl', data, config).then(successCallback, errorCallback); - * ``` - * - * Complete list of shortcut methods: - * - * - {@link ng.$http#get $http.get} - * - {@link ng.$http#head $http.head} - * - {@link ng.$http#post $http.post} - * - {@link ng.$http#put $http.put} - * - {@link ng.$http#delete $http.delete} - * - {@link ng.$http#jsonp $http.jsonp} - * - {@link ng.$http#patch $http.patch} - * - * - * ## Writing Unit Tests that use $http - * When unit testing (using {@link ngMock ngMock}), it is necessary to call - * {@link ngMock.$httpBackend#flush $httpBackend.flush()} to flush each pending - * request using trained responses. - * - * ``` - * $httpBackend.expectGET(...); - * $http.get(...); - * $httpBackend.flush(); - * ``` - * - * ## Setting HTTP Headers - * - * The $http service will automatically add certain HTTP headers to all requests. These defaults - * can be fully configured by accessing the `$httpProvider.defaults.headers` configuration - * object, which currently contains this default configuration: - * - * - `$httpProvider.defaults.headers.common` (headers that are common for all requests): - * - Accept: application/json, text/plain, \*/\* - * - `$httpProvider.defaults.headers.post`: (header defaults for POST requests) - * - `Content-Type: application/json` - * - `$httpProvider.defaults.headers.put` (header defaults for PUT requests) - * - `Content-Type: application/json` - * - * To add or overwrite these defaults, simply add or remove a property from these configuration - * objects. To add headers for an HTTP method other than POST or PUT, simply add a new object - * with the lowercased HTTP method name as the key, e.g. - * `$httpProvider.defaults.headers.get = { 'My-Header' : 'value' }`. - * - * The defaults can also be set at runtime via the `$http.defaults` object in the same - * fashion. For example: - * - * ``` - * module.run(function($http) { - * $http.defaults.headers.common.Authorization = 'Basic YmVlcDpib29w'; - * }); - * ``` - * - * In addition, you can supply a `headers` property in the config object passed when - * calling `$http(config)`, which overrides the defaults without changing them globally. - * - * To explicitly remove a header automatically added via $httpProvider.defaults.headers on a per request basis, - * Use the `headers` property, setting the desired header to `undefined`. For example: - * - * ```js - * var req = { - * method: 'POST', - * url: 'http://example.com', - * headers: { - * 'Content-Type': undefined - * }, - * data: { test: 'test' } - * } - * - * $http(req).then(function(){...}, function(){...}); - * ``` - * - * ## Transforming Requests and Responses - * - * Both requests and responses can be transformed using transformation functions: `transformRequest` - * and `transformResponse`. These properties can be a single function that returns - * the transformed value (`function(data, headersGetter, status)`) or an array of such transformation functions, - * which allows you to `push` or `unshift` a new transformation function into the transformation chain. - * - *
    - * **Note:** AngularJS does not make a copy of the `data` parameter before it is passed into the `transformRequest` pipeline. - * That means changes to the properties of `data` are not local to the transform function (since Javascript passes objects by reference). - * For example, when calling `$http.get(url, $scope.myObject)`, modifications to the object's properties in a transformRequest - * function will be reflected on the scope and in any templates where the object is data-bound. - * To prevent this, transform functions should have no side-effects. - * If you need to modify properties, it is recommended to make a copy of the data, or create new object to return. - *
    - * - * ### Default Transformations - * - * The `$httpProvider` provider and `$http` service expose `defaults.transformRequest` and - * `defaults.transformResponse` properties. If a request does not provide its own transformations - * then these will be applied. - * - * You can augment or replace the default transformations by modifying these properties by adding to or - * replacing the array. - * - * AngularJS provides the following default transformations: - * - * Request transformations (`$httpProvider.defaults.transformRequest` and `$http.defaults.transformRequest`) is - * an array with one function that does the following: - * - * - If the `data` property of the request configuration object contains an object, serialize it - * into JSON format. - * - * Response transformations (`$httpProvider.defaults.transformResponse` and `$http.defaults.transformResponse`) is - * an array with one function that does the following: - * - * - If XSRF prefix is detected, strip it (see Security Considerations section below). - * - If the `Content-Type` is `application/json` or the response looks like JSON, - * deserialize it using a JSON parser. - * - * - * ### Overriding the Default Transformations Per Request - * - * If you wish to override the request/response transformations only for a single request then provide - * `transformRequest` and/or `transformResponse` properties on the configuration object passed - * into `$http`. - * - * Note that if you provide these properties on the config object the default transformations will be - * overwritten. If you wish to augment the default transformations then you must include them in your - * local transformation array. - * - * The following code demonstrates adding a new response transformation to be run after the default response - * transformations have been run. - * - * ```js - * function appendTransform(defaults, transform) { - * - * // We can't guarantee that the default transformation is an array - * defaults = angular.isArray(defaults) ? defaults : [defaults]; - * - * // Append the new transformation to the defaults - * return defaults.concat(transform); - * } - * - * $http({ - * url: '...', - * method: 'GET', - * transformResponse: appendTransform($http.defaults.transformResponse, function(value) { - * return doTransform(value); - * }) - * }); - * ``` - * - * - * ## Caching - * - * {@link ng.$http `$http`} responses are not cached by default. To enable caching, you must - * set the config.cache value or the default cache value to TRUE or to a cache object (created - * with {@link ng.$cacheFactory `$cacheFactory`}). If defined, the value of config.cache takes - * precedence over the default cache value. - * - * In order to: - * * cache all responses - set the default cache value to TRUE or to a cache object - * * cache a specific response - set config.cache value to TRUE or to a cache object - * - * If caching is enabled, but neither the default cache nor config.cache are set to a cache object, - * then the default `$cacheFactory("$http")` object is used. - * - * The default cache value can be set by updating the - * {@link ng.$http#defaults `$http.defaults.cache`} property or the - * {@link $httpProvider#defaults `$httpProvider.defaults.cache`} property. - * - * When caching is enabled, {@link ng.$http `$http`} stores the response from the server using - * the relevant cache object. The next time the same request is made, the response is returned - * from the cache without sending a request to the server. - * - * Take note that: - * - * * Only GET and JSONP requests are cached. - * * The cache key is the request URL including search parameters; headers are not considered. - * * Cached responses are returned asynchronously, in the same way as responses from the server. - * * If multiple identical requests are made using the same cache, which is not yet populated, - * one request will be made to the server and remaining requests will return the same response. - * * A cache-control header on the response does not affect if or how responses are cached. - * - * - * ## Interceptors - * - * Before you start creating interceptors, be sure to understand the - * {@link ng.$q $q and deferred/promise APIs}. - * - * For purposes of global error handling, authentication, or any kind of synchronous or - * asynchronous pre-processing of request or postprocessing of responses, it is desirable to be - * able to intercept requests before they are handed to the server and - * responses before they are handed over to the application code that - * initiated these requests. The interceptors leverage the {@link ng.$q - * promise APIs} to fulfill this need for both synchronous and asynchronous pre-processing. - * - * The interceptors are service factories that are registered with the `$httpProvider` by - * adding them to the `$httpProvider.interceptors` array. The factory is called and - * injected with dependencies (if specified) and returns the interceptor. - * - * There are two kinds of interceptors (and two kinds of rejection interceptors): - * - * * `request`: interceptors get called with a http {@link $http#usage config} object. The function is free to - * modify the `config` object or create a new one. The function needs to return the `config` - * object directly, or a promise containing the `config` or a new `config` object. - * * `requestError`: interceptor gets called when a previous interceptor threw an error or - * resolved with a rejection. - * * `response`: interceptors get called with http `response` object. The function is free to - * modify the `response` object or create a new one. The function needs to return the `response` - * object directly, or as a promise containing the `response` or a new `response` object. - * * `responseError`: interceptor gets called when a previous interceptor threw an error or - * resolved with a rejection. - * - * - * ```js - * // register the interceptor as a service - * $provide.factory('myHttpInterceptor', function($q, dependency1, dependency2) { - * return { - * // optional method - * 'request': function(config) { - * // do something on success - * return config; - * }, - * - * // optional method - * 'requestError': function(rejection) { - * // do something on error - * if (canRecover(rejection)) { - * return responseOrNewPromise - * } - * return $q.reject(rejection); - * }, - * - * - * - * // optional method - * 'response': function(response) { - * // do something on success - * return response; - * }, - * - * // optional method - * 'responseError': function(rejection) { - * // do something on error - * if (canRecover(rejection)) { - * return responseOrNewPromise - * } - * return $q.reject(rejection); - * } - * }; - * }); - * - * $httpProvider.interceptors.push('myHttpInterceptor'); - * - * - * // alternatively, register the interceptor via an anonymous factory - * $httpProvider.interceptors.push(function($q, dependency1, dependency2) { - * return { - * 'request': function(config) { - * // same as above - * }, - * - * 'response': function(response) { - * // same as above - * } - * }; - * }); - * ``` - * - * ## Security Considerations - * - * When designing web applications, consider security threats from: - * - * - [JSON vulnerability](http://haacked.com/archive/2008/11/20/anatomy-of-a-subtle-json-vulnerability.aspx) - * - [XSRF](http://en.wikipedia.org/wiki/Cross-site_request_forgery) - * - * Both server and the client must cooperate in order to eliminate these threats. AngularJS comes - * pre-configured with strategies that address these issues, but for this to work backend server - * cooperation is required. - * - * ### JSON Vulnerability Protection - * - * A [JSON vulnerability](http://haacked.com/archive/2008/11/20/anatomy-of-a-subtle-json-vulnerability.aspx) - * allows third party website to turn your JSON resource URL into - * [JSONP](http://en.wikipedia.org/wiki/JSONP) request under some conditions. To - * counter this your server can prefix all JSON requests with following string `")]}',\n"`. - * AngularJS will automatically strip the prefix before processing it as JSON. - * - * For example if your server needs to return: - * ```js - * ['one','two'] - * ``` - * - * which is vulnerable to attack, your server can return: - * ```js - * )]}', - * ['one','two'] - * ``` - * - * AngularJS will strip the prefix, before processing the JSON. - * - * - * ### Cross Site Request Forgery (XSRF) Protection - * - * [XSRF](http://en.wikipedia.org/wiki/Cross-site_request_forgery) is an attack technique by - * which the attacker can trick an authenticated user into unknowingly executing actions on your - * website. AngularJS provides a mechanism to counter XSRF. When performing XHR requests, the - * $http service reads a token from a cookie (by default, `XSRF-TOKEN`) and sets it as an HTTP - * header (by default `X-XSRF-TOKEN`). Since only JavaScript that runs on your domain could read - * the cookie, your server can be assured that the XHR came from JavaScript running on your - * domain. - * - * To take advantage of this, your server needs to set a token in a JavaScript readable session - * cookie called `XSRF-TOKEN` on the first HTTP GET request. On subsequent XHR requests the - * server can verify that the cookie matches the `X-XSRF-TOKEN` HTTP header, and therefore be - * sure that only JavaScript running on your domain could have sent the request. The token must - * be unique for each user and must be verifiable by the server (to prevent the JavaScript from - * making up its own tokens). We recommend that the token is a digest of your site's - * authentication cookie with a [salt](https://en.wikipedia.org/wiki/Salt_(cryptography)) - * for added security. - * - * The header will — by default — **not** be set for cross-domain requests. This - * prevents unauthorized servers (e.g. malicious or compromised 3rd-party APIs) from gaining - * access to your users' XSRF tokens and exposing them to Cross Site Request Forgery. If you - * want to, you can whitelist additional origins to also receive the XSRF token, by adding them - * to {@link ng.$httpProvider#xsrfWhitelistedOrigins xsrfWhitelistedOrigins}. This might be - * useful, for example, if your application, served from `example.com`, needs to access your API - * at `api.example.com`. - * See {@link ng.$httpProvider#xsrfWhitelistedOrigins $httpProvider.xsrfWhitelistedOrigins} for - * more details. - * - *
    - * **Warning**
    - * Only whitelist origins that you have control over and make sure you understand the - * implications of doing so. - *
    - * - * The name of the cookie and the header can be specified using the `xsrfCookieName` and - * `xsrfHeaderName` properties of either `$httpProvider.defaults` at config-time, - * `$http.defaults` at run-time, or the per-request config object. - * - * In order to prevent collisions in environments where multiple AngularJS apps share the - * same domain or subdomain, we recommend that each application uses a unique cookie name. - * - * - * @param {object} config Object describing the request to be made and how it should be - * processed. The object has following properties: - * - * - **method** – `{string}` – HTTP method (e.g. 'GET', 'POST', etc) - * - **url** – `{string|TrustedObject}` – Absolute or relative URL of the resource that is being requested; - * or an object created by a call to `$sce.trustAsResourceUrl(url)`. - * - **params** – `{Object.}` – Map of strings or objects which will be serialized - * with the `paramSerializer` and appended as GET parameters. - * - **data** – `{string|Object}` – Data to be sent as the request message data. - * - **headers** – `{Object}` – Map of strings or functions which return strings representing - * HTTP headers to send to the server. If the return value of a function is null, the - * header will not be sent. Functions accept a config object as an argument. - * - **eventHandlers** - `{Object}` - Event listeners to be bound to the XMLHttpRequest object. - * To bind events to the XMLHttpRequest upload object, use `uploadEventHandlers`. - * The handler will be called in the context of a `$apply` block. - * - **uploadEventHandlers** - `{Object}` - Event listeners to be bound to the XMLHttpRequest upload - * object. To bind events to the XMLHttpRequest object, use `eventHandlers`. - * The handler will be called in the context of a `$apply` block. - * - **xsrfHeaderName** – `{string}` – Name of HTTP header to populate with the XSRF token. - * - **xsrfCookieName** – `{string}` – Name of cookie containing the XSRF token. - * - **transformRequest** – - * `{function(data, headersGetter)|Array.}` – - * transform function or an array of such functions. The transform function takes the http - * request body and headers and returns its transformed (typically serialized) version. - * See {@link ng.$http#overriding-the-default-transformations-per-request - * Overriding the Default Transformations} - * - **transformResponse** – - * `{function(data, headersGetter, status)|Array.}` – - * transform function or an array of such functions. The transform function takes the http - * response body, headers and status and returns its transformed (typically deserialized) version. - * See {@link ng.$http#overriding-the-default-transformations-per-request - * Overriding the Default Transformations} - * - **paramSerializer** - `{string|function(Object):string}` - A function used to - * prepare the string representation of request parameters (specified as an object). - * If specified as string, it is interpreted as function registered with the - * {@link $injector $injector}, which means you can create your own serializer - * by registering it as a {@link auto.$provide#service service}. - * The default serializer is the {@link $httpParamSerializer $httpParamSerializer}; - * alternatively, you can use the {@link $httpParamSerializerJQLike $httpParamSerializerJQLike} - * - **cache** – `{boolean|Object}` – A boolean value or object created with - * {@link ng.$cacheFactory `$cacheFactory`} to enable or disable caching of the HTTP response. - * See {@link $http#caching $http Caching} for more information. - * - **timeout** – `{number|Promise}` – timeout in milliseconds, or {@link ng.$q promise} - * that should abort the request when resolved. - * - * A numerical timeout or a promise returned from {@link ng.$timeout $timeout}, will set - * the `xhrStatus` in the {@link $http#$http-returns response} to "timeout", and any other - * resolved promise will set it to "abort", following standard XMLHttpRequest behavior. - * - * - **withCredentials** - `{boolean}` - whether to set the `withCredentials` flag on the - * XHR object. See [requests with credentials](https://developer.mozilla.org/docs/Web/HTTP/Access_control_CORS#Requests_with_credentials) - * for more information. - * - **responseType** - `{string}` - see - * [XMLHttpRequest.responseType](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#xmlhttprequest-responsetype). - * - * @returns {HttpPromise} A {@link ng.$q `Promise}` that will be resolved (request success) - * or rejected (request failure) with a response object. - * - * The response object has these properties: - * - * - **data** – `{string|Object}` – The response body transformed with - * the transform functions. - * - **status** – `{number}` – HTTP status code of the response. - * - **headers** – `{function([headerName])}` – Header getter function. - * - **config** – `{Object}` – The configuration object that was used - * to generate the request. - * - **statusText** – `{string}` – HTTP status text of the response. - * - **xhrStatus** – `{string}` – Status of the XMLHttpRequest - * (`complete`, `error`, `timeout` or `abort`). - * - * - * A response status code between 200 and 299 is considered a success status - * and will result in the success callback being called. Any response status - * code outside of that range is considered an error status and will result - * in the error callback being called. - * Also, status codes less than -1 are normalized to zero. -1 usually means - * the request was aborted, e.g. using a `config.timeout`. More information - * about the status might be available in the `xhrStatus` property. - * - * Note that if the response is a redirect, XMLHttpRequest will transparently - * follow it, meaning that the outcome (success or error) will be determined - * by the final response status code. - * - * - * @property {Array.} pendingRequests Array of config objects for currently pending - * requests. This is primarily meant to be used for debugging purposes. - * - * - * @example - - -
    - - -
    - - - -
    http status code: {{status}}
    -
    http response data: {{data}}
    -
    -
    - - angular.module('httpExample', []) - .config(['$sceDelegateProvider', function($sceDelegateProvider) { - // We must whitelist the JSONP endpoint that we are using to show that we trust it - $sceDelegateProvider.resourceUrlWhitelist([ - 'self', - 'https://angularjs.org/**' - ]); - }]) - .controller('FetchController', ['$scope', '$http', '$templateCache', - function($scope, $http, $templateCache) { - $scope.method = 'GET'; - $scope.url = 'http-hello.html'; - - $scope.fetch = function() { - $scope.code = null; - $scope.response = null; - - $http({method: $scope.method, url: $scope.url, cache: $templateCache}). - then(function(response) { - $scope.status = response.status; - $scope.data = response.data; - }, function(response) { - $scope.data = response.data || 'Request failed'; - $scope.status = response.status; - }); - }; - - $scope.updateModel = function(method, url) { - $scope.method = method; - $scope.url = url; - }; - }]); - - - Hello, $http! - - - var status = element(by.binding('status')); - var data = element(by.binding('data')); - var fetchBtn = element(by.id('fetchbtn')); - var sampleGetBtn = element(by.id('samplegetbtn')); - var invalidJsonpBtn = element(by.id('invalidjsonpbtn')); - - it('should make an xhr GET request', function() { - sampleGetBtn.click(); - fetchBtn.click(); - expect(status.getText()).toMatch('200'); - expect(data.getText()).toMatch(/Hello, \$http!/); - }); - -// Commented out due to flakes. See https://github.com/angular/angular.js/issues/9185 -// it('should make a JSONP request to angularjs.org', function() { -// var sampleJsonpBtn = element(by.id('samplejsonpbtn')); -// sampleJsonpBtn.click(); -// fetchBtn.click(); -// expect(status.getText()).toMatch('200'); -// expect(data.getText()).toMatch(/Super Hero!/); -// }); - - it('should make JSONP request to invalid URL and invoke the error handler', - function() { - invalidJsonpBtn.click(); - fetchBtn.click(); - expect(status.getText()).toMatch('0'); - expect(data.getText()).toMatch('Request failed'); - }); - -
    - */ - function $http(requestConfig) { - - if (!isObject(requestConfig)) { - throw minErr('$http')('badreq', 'Http request configuration must be an object. Received: {0}', requestConfig); - } - - if (!isString($sce.valueOf(requestConfig.url))) { - throw minErr('$http')('badreq', 'Http request configuration url must be a string or a $sce trusted object. Received: {0}', requestConfig.url); - } - - var config = extend({ - method: 'get', - transformRequest: defaults.transformRequest, - transformResponse: defaults.transformResponse, - paramSerializer: defaults.paramSerializer, - jsonpCallbackParam: defaults.jsonpCallbackParam - }, requestConfig); - - config.headers = mergeHeaders(requestConfig); - config.method = uppercase(config.method); - config.paramSerializer = isString(config.paramSerializer) ? - $injector.get(config.paramSerializer) : config.paramSerializer; - - $browser.$$incOutstandingRequestCount('$http'); - - var requestInterceptors = []; - var responseInterceptors = []; - var promise = $q.resolve(config); - - // apply interceptors - forEach(reversedInterceptors, function(interceptor) { - if (interceptor.request || interceptor.requestError) { - requestInterceptors.unshift(interceptor.request, interceptor.requestError); - } - if (interceptor.response || interceptor.responseError) { - responseInterceptors.push(interceptor.response, interceptor.responseError); - } - }); - - promise = chainInterceptors(promise, requestInterceptors); - promise = promise.then(serverRequest); - promise = chainInterceptors(promise, responseInterceptors); - promise = promise.finally(completeOutstandingRequest); - - return promise; - - - function chainInterceptors(promise, interceptors) { - for (var i = 0, ii = interceptors.length; i < ii;) { - var thenFn = interceptors[i++]; - var rejectFn = interceptors[i++]; - - promise = promise.then(thenFn, rejectFn); - } - - interceptors.length = 0; - - return promise; - } - - function completeOutstandingRequest() { - $browser.$$completeOutstandingRequest(noop, '$http'); - } - - function executeHeaderFns(headers, config) { - var headerContent, processedHeaders = {}; - - forEach(headers, function(headerFn, header) { - if (isFunction(headerFn)) { - headerContent = headerFn(config); - if (headerContent != null) { - processedHeaders[header] = headerContent; - } - } else { - processedHeaders[header] = headerFn; - } - }); - - return processedHeaders; - } - - function mergeHeaders(config) { - var defHeaders = defaults.headers, - reqHeaders = extend({}, config.headers), - defHeaderName, lowercaseDefHeaderName, reqHeaderName; - - defHeaders = extend({}, defHeaders.common, defHeaders[lowercase(config.method)]); - - // using for-in instead of forEach to avoid unnecessary iteration after header has been found - defaultHeadersIteration: - for (defHeaderName in defHeaders) { - lowercaseDefHeaderName = lowercase(defHeaderName); - - for (reqHeaderName in reqHeaders) { - if (lowercase(reqHeaderName) === lowercaseDefHeaderName) { - continue defaultHeadersIteration; - } - } - - reqHeaders[defHeaderName] = defHeaders[defHeaderName]; - } - - // execute if header value is a function for merged headers - return executeHeaderFns(reqHeaders, shallowCopy(config)); - } - - function serverRequest(config) { - var headers = config.headers; - var reqData = transformData(config.data, headersGetter(headers), undefined, config.transformRequest); - - // strip content-type if data is undefined - if (isUndefined(reqData)) { - forEach(headers, function(value, header) { - if (lowercase(header) === 'content-type') { - delete headers[header]; - } - }); - } - - if (isUndefined(config.withCredentials) && !isUndefined(defaults.withCredentials)) { - config.withCredentials = defaults.withCredentials; - } - - // send request - return sendReq(config, reqData).then(transformResponse, transformResponse); - } - - function transformResponse(response) { - // make a copy since the response must be cacheable - var resp = extend({}, response); - resp.data = transformData(response.data, response.headers, response.status, - config.transformResponse); - return (isSuccess(response.status)) - ? resp - : $q.reject(resp); - } - } - - $http.pendingRequests = []; - - /** - * @ngdoc method - * @name $http#get - * - * @description - * Shortcut method to perform `GET` request. - * - * @param {string|TrustedObject} url Absolute or relative URL of the resource that is being requested; - * or an object created by a call to `$sce.trustAsResourceUrl(url)`. - * @param {Object=} config Optional configuration object. See {@link ng.$http#$http-arguments `$http()` arguments}. - * @returns {HttpPromise} A Promise that will be resolved or rejected with a response object. - * See {@link ng.$http#$http-returns `$http()` return value}. - */ - - /** - * @ngdoc method - * @name $http#delete - * - * @description - * Shortcut method to perform `DELETE` request. - * - * @param {string|TrustedObject} url Absolute or relative URL of the resource that is being requested; - * or an object created by a call to `$sce.trustAsResourceUrl(url)`. - * @param {Object=} config Optional configuration object. See {@link ng.$http#$http-arguments `$http()` arguments}. - * @returns {HttpPromise} A Promise that will be resolved or rejected with a response object. - * See {@link ng.$http#$http-returns `$http()` return value}. - */ - - /** - * @ngdoc method - * @name $http#head - * - * @description - * Shortcut method to perform `HEAD` request. - * - * @param {string|TrustedObject} url Absolute or relative URL of the resource that is being requested; - * or an object created by a call to `$sce.trustAsResourceUrl(url)`. - * @param {Object=} config Optional configuration object. See {@link ng.$http#$http-arguments `$http()` arguments}. - * @returns {HttpPromise} A Promise that will be resolved or rejected with a response object. - * See {@link ng.$http#$http-returns `$http()` return value}. - */ - - /** - * @ngdoc method - * @name $http#jsonp - * - * @description - * Shortcut method to perform `JSONP` request. - * - * Note that, since JSONP requests are sensitive because the response is given full access to the browser, - * the url must be declared, via {@link $sce} as a trusted resource URL. - * You can trust a URL by adding it to the whitelist via - * {@link $sceDelegateProvider#resourceUrlWhitelist `$sceDelegateProvider.resourceUrlWhitelist`} or - * by explicitly trusting the URL via {@link $sce#trustAsResourceUrl `$sce.trustAsResourceUrl(url)`}. - * - * You should avoid generating the URL for the JSONP request from user provided data. - * Provide additional query parameters via `params` property of the `config` parameter, rather than - * modifying the URL itself. - * - * JSONP requests must specify a callback to be used in the response from the server. This callback - * is passed as a query parameter in the request. You must specify the name of this parameter by - * setting the `jsonpCallbackParam` property on the request config object. - * - * ``` - * $http.jsonp('some/trusted/url', {jsonpCallbackParam: 'callback'}) - * ``` - * - * You can also specify a default callback parameter name in `$http.defaults.jsonpCallbackParam`. - * Initially this is set to `'callback'`. - * - *
    - * You can no longer use the `JSON_CALLBACK` string as a placeholder for specifying where the callback - * parameter value should go. - *
    - * - * If you would like to customise where and how the callbacks are stored then try overriding - * or decorating the {@link $jsonpCallbacks} service. - * - * @param {string|TrustedObject} url Absolute or relative URL of the resource that is being requested; - * or an object created by a call to `$sce.trustAsResourceUrl(url)`. - * @param {Object=} config Optional configuration object. See {@link ng.$http#$http-arguments `$http()` arguments}. - * @returns {HttpPromise} A Promise that will be resolved or rejected with a response object. - * See {@link ng.$http#$http-returns `$http()` return value}. - */ - createShortMethods('get', 'delete', 'head', 'jsonp'); - - /** - * @ngdoc method - * @name $http#post - * - * @description - * Shortcut method to perform `POST` request. - * - * @param {string} url Relative or absolute URL specifying the destination of the request - * @param {*} data Request content - * @param {Object=} config Optional configuration object. See {@link ng.$http#$http-arguments `$http()` arguments}. - * @returns {HttpPromise} A Promise that will be resolved or rejected with a response object. - * See {@link ng.$http#$http-returns `$http()` return value}. - */ - - /** - * @ngdoc method - * @name $http#put - * - * @description - * Shortcut method to perform `PUT` request. - * - * @param {string} url Relative or absolute URL specifying the destination of the request - * @param {*} data Request content - * @param {Object=} config Optional configuration object. See {@link ng.$http#$http-arguments `$http()` arguments}. - * @returns {HttpPromise} A Promise that will be resolved or rejected with a response object. - * See {@link ng.$http#$http-returns `$http()` return value}. - */ - - /** - * @ngdoc method - * @name $http#patch - * - * @description - * Shortcut method to perform `PATCH` request. - * - * @param {string} url Relative or absolute URL specifying the destination of the request - * @param {*} data Request content - * @param {Object=} config Optional configuration object. See {@link ng.$http#$http-arguments `$http()` arguments}. - * @returns {HttpPromise} A Promise that will be resolved or rejected with a response object. - * See {@link ng.$http#$http-returns `$http()` return value}. - */ - createShortMethodsWithData('post', 'put', 'patch'); - - /** - * @ngdoc property - * @name $http#defaults - * - * @description - * Runtime equivalent of the `$httpProvider.defaults` property. Allows configuration of - * default headers, withCredentials as well as request and response transformations. - * - * See "Setting HTTP Headers" and "Transforming Requests and Responses" sections above. - */ - $http.defaults = defaults; - - - return $http; - - - function createShortMethods(names) { - forEach(arguments, function(name) { - $http[name] = function(url, config) { - return $http(extend({}, config || {}, { - method: name, - url: url - })); - }; - }); - } - - - function createShortMethodsWithData(name) { - forEach(arguments, function(name) { - $http[name] = function(url, data, config) { - return $http(extend({}, config || {}, { - method: name, - url: url, - data: data - })); - }; - }); - } - - - /** - * Makes the request. - * - * !!! ACCESSES CLOSURE VARS: - * $httpBackend, defaults, $log, $rootScope, defaultCache, $http.pendingRequests - */ - function sendReq(config, reqData) { - var deferred = $q.defer(), - promise = deferred.promise, - cache, - cachedResp, - reqHeaders = config.headers, - isJsonp = lowercase(config.method) === 'jsonp', - url = config.url; - - if (isJsonp) { - // JSONP is a pretty sensitive operation where we're allowing a script to have full access to - // our DOM and JS space. So we require that the URL satisfies SCE.RESOURCE_URL. - url = $sce.getTrustedResourceUrl(url); - } else if (!isString(url)) { - // If it is not a string then the URL must be a $sce trusted object - url = $sce.valueOf(url); - } - - url = buildUrl(url, config.paramSerializer(config.params)); - - if (isJsonp) { - // Check the url and add the JSONP callback placeholder - url = sanitizeJsonpCallbackParam(url, config.jsonpCallbackParam); - } - - $http.pendingRequests.push(config); - promise.then(removePendingReq, removePendingReq); - - if ((config.cache || defaults.cache) && config.cache !== false && - (config.method === 'GET' || config.method === 'JSONP')) { - cache = isObject(config.cache) ? config.cache - : isObject(/** @type {?} */ (defaults).cache) - ? /** @type {?} */ (defaults).cache - : defaultCache; - } - - if (cache) { - cachedResp = cache.get(url); - if (isDefined(cachedResp)) { - if (isPromiseLike(cachedResp)) { - // cached request has already been sent, but there is no response yet - cachedResp.then(resolvePromiseWithResult, resolvePromiseWithResult); - } else { - // serving from cache - if (isArray(cachedResp)) { - resolvePromise(cachedResp[1], cachedResp[0], shallowCopy(cachedResp[2]), cachedResp[3], cachedResp[4]); - } else { - resolvePromise(cachedResp, 200, {}, 'OK', 'complete'); - } - } - } else { - // put the promise for the non-transformed response into cache as a placeholder - cache.put(url, promise); - } - } - - - // if we won't have the response in cache, set the xsrf headers and - // send the request to the backend - if (isUndefined(cachedResp)) { - var xsrfValue = urlIsAllowedOrigin(config.url) - ? $$cookieReader()[config.xsrfCookieName || defaults.xsrfCookieName] - : undefined; - if (xsrfValue) { - reqHeaders[(config.xsrfHeaderName || defaults.xsrfHeaderName)] = xsrfValue; - } - - $httpBackend(config.method, url, reqData, done, reqHeaders, config.timeout, - config.withCredentials, config.responseType, - createApplyHandlers(config.eventHandlers), - createApplyHandlers(config.uploadEventHandlers)); - } - - return promise; - - function createApplyHandlers(eventHandlers) { - if (eventHandlers) { - var applyHandlers = {}; - forEach(eventHandlers, function(eventHandler, key) { - applyHandlers[key] = function(event) { - if (useApplyAsync) { - $rootScope.$applyAsync(callEventHandler); - } else if ($rootScope.$$phase) { - callEventHandler(); - } else { - $rootScope.$apply(callEventHandler); - } - - function callEventHandler() { - eventHandler(event); - } - }; - }); - return applyHandlers; - } - } - - - /** - * Callback registered to $httpBackend(): - * - caches the response if desired - * - resolves the raw $http promise - * - calls $apply - */ - function done(status, response, headersString, statusText, xhrStatus) { - if (cache) { - if (isSuccess(status)) { - cache.put(url, [status, response, parseHeaders(headersString), statusText, xhrStatus]); - } else { - // remove promise from the cache - cache.remove(url); - } - } - - function resolveHttpPromise() { - resolvePromise(response, status, headersString, statusText, xhrStatus); - } - - if (useApplyAsync) { - $rootScope.$applyAsync(resolveHttpPromise); - } else { - resolveHttpPromise(); - if (!$rootScope.$$phase) $rootScope.$apply(); - } - } - - - /** - * Resolves the raw $http promise. - */ - function resolvePromise(response, status, headers, statusText, xhrStatus) { - //status: HTTP response status code, 0, -1 (aborted by timeout / promise) - status = status >= -1 ? status : 0; - - (isSuccess(status) ? deferred.resolve : deferred.reject)({ - data: response, - status: status, - headers: headersGetter(headers), - config: config, - statusText: statusText, - xhrStatus: xhrStatus - }); - } - - function resolvePromiseWithResult(result) { - resolvePromise(result.data, result.status, shallowCopy(result.headers()), result.statusText, result.xhrStatus); - } - - function removePendingReq() { - var idx = $http.pendingRequests.indexOf(config); - if (idx !== -1) $http.pendingRequests.splice(idx, 1); - } - } - - - function buildUrl(url, serializedParams) { - if (serializedParams.length > 0) { - url += ((url.indexOf('?') === -1) ? '?' : '&') + serializedParams; - } - return url; - } - - function sanitizeJsonpCallbackParam(url, cbKey) { - var parts = url.split('?'); - if (parts.length > 2) { - // Throw if the url contains more than one `?` query indicator - throw $httpMinErr('badjsonp', 'Illegal use more than one "?", in url, "{1}"', url); - } - var params = parseKeyValue(parts[1]); - forEach(params, function(value, key) { - if (value === 'JSON_CALLBACK') { - // Throw if the url already contains a reference to JSON_CALLBACK - throw $httpMinErr('badjsonp', 'Illegal use of JSON_CALLBACK in url, "{0}"', url); - } - if (key === cbKey) { - // Throw if the callback param was already provided - throw $httpMinErr('badjsonp', 'Illegal use of callback param, "{0}", in url, "{1}"', cbKey, url); - } - }); - - // Add in the JSON_CALLBACK callback param value - url += ((url.indexOf('?') === -1) ? '?' : '&') + cbKey + '=JSON_CALLBACK'; - - return url; - } - }]; -} - -/** - * @ngdoc service - * @name $xhrFactory - * @this - * - * @description - * Factory function used to create XMLHttpRequest objects. - * - * Replace or decorate this service to create your own custom XMLHttpRequest objects. - * - * ``` - * angular.module('myApp', []) - * .factory('$xhrFactory', function() { - * return function createXhr(method, url) { - * return new window.XMLHttpRequest({mozSystem: true}); - * }; - * }); - * ``` - * - * @param {string} method HTTP method of the request (GET, POST, PUT, ..) - * @param {string} url URL of the request. - */ -function $xhrFactoryProvider() { - this.$get = function() { - return function createXhr() { - return new window.XMLHttpRequest(); - }; - }; -} - -/** - * @ngdoc service - * @name $httpBackend - * @requires $jsonpCallbacks - * @requires $document - * @requires $xhrFactory - * @this - * - * @description - * HTTP backend used by the {@link ng.$http service} that delegates to - * XMLHttpRequest object or JSONP and deals with browser incompatibilities. - * - * You should never need to use this service directly, instead use the higher-level abstractions: - * {@link ng.$http $http} or {@link ngResource.$resource $resource}. - * - * During testing this implementation is swapped with {@link ngMock.$httpBackend mock - * $httpBackend} which can be trained with responses. - */ -function $HttpBackendProvider() { - this.$get = ['$browser', '$jsonpCallbacks', '$document', '$xhrFactory', function($browser, $jsonpCallbacks, $document, $xhrFactory) { - return createHttpBackend($browser, $xhrFactory, $browser.defer, $jsonpCallbacks, $document[0]); - }]; -} - -function createHttpBackend($browser, createXhr, $browserDefer, callbacks, rawDocument) { - // TODO(vojta): fix the signature - return function(method, url, post, callback, headers, timeout, withCredentials, responseType, eventHandlers, uploadEventHandlers) { - url = url || $browser.url(); - - if (lowercase(method) === 'jsonp') { - var callbackPath = callbacks.createCallback(url); - var jsonpDone = jsonpReq(url, callbackPath, function(status, text) { - // jsonpReq only ever sets status to 200 (OK), 404 (ERROR) or -1 (WAITING) - var response = (status === 200) && callbacks.getResponse(callbackPath); - completeRequest(callback, status, response, '', text, 'complete'); - callbacks.removeCallback(callbackPath); - }); - } else { - - var xhr = createXhr(method, url); - var abortedByTimeout = false; - - xhr.open(method, url, true); - forEach(headers, function(value, key) { - if (isDefined(value)) { - xhr.setRequestHeader(key, value); - } - }); - - xhr.onload = function requestLoaded() { - var statusText = xhr.statusText || ''; - - // responseText is the old-school way of retrieving response (supported by IE9) - // response/responseType properties were introduced in XHR Level2 spec (supported by IE10) - var response = ('response' in xhr) ? xhr.response : xhr.responseText; - - // normalize IE9 bug (http://bugs.jquery.com/ticket/1450) - var status = xhr.status === 1223 ? 204 : xhr.status; - - // fix status code when it is 0 (0 status is undocumented). - // Occurs when accessing file resources or on Android 4.1 stock browser - // while retrieving files from application cache. - if (status === 0) { - status = response ? 200 : urlResolve(url).protocol === 'file' ? 404 : 0; - } - - completeRequest(callback, - status, - response, - xhr.getAllResponseHeaders(), - statusText, - 'complete'); - }; - - var requestError = function() { - // The response is always empty - // See https://xhr.spec.whatwg.org/#request-error-steps and https://fetch.spec.whatwg.org/#concept-network-error - completeRequest(callback, -1, null, null, '', 'error'); - }; - - var requestAborted = function() { - completeRequest(callback, -1, null, null, '', abortedByTimeout ? 'timeout' : 'abort'); - }; - - var requestTimeout = function() { - // The response is always empty - // See https://xhr.spec.whatwg.org/#request-error-steps and https://fetch.spec.whatwg.org/#concept-network-error - completeRequest(callback, -1, null, null, '', 'timeout'); - }; - - xhr.onerror = requestError; - xhr.ontimeout = requestTimeout; - xhr.onabort = requestAborted; - - forEach(eventHandlers, function(value, key) { - xhr.addEventListener(key, value); - }); - - forEach(uploadEventHandlers, function(value, key) { - xhr.upload.addEventListener(key, value); - }); - - if (withCredentials) { - xhr.withCredentials = true; - } - - if (responseType) { - try { - xhr.responseType = responseType; - } catch (e) { - // WebKit added support for the json responseType value on 09/03/2013 - // https://bugs.webkit.org/show_bug.cgi?id=73648. Versions of Safari prior to 7 are - // known to throw when setting the value "json" as the response type. Other older - // browsers implementing the responseType - // - // The json response type can be ignored if not supported, because JSON payloads are - // parsed on the client-side regardless. - if (responseType !== 'json') { - throw e; - } - } - } - - xhr.send(isUndefined(post) ? null : post); - } - - // Since we are using xhr.abort() when a request times out, we have to set a flag that - // indicates to requestAborted if the request timed out or was aborted. - // - // http.timeout = numerical timeout timeout - // http.timeout = $timeout timeout - // http.timeout = promise abort - // xhr.abort() abort (The xhr object is normally inaccessible, but - // can be exposed with the xhrFactory) - if (timeout > 0) { - var timeoutId = $browserDefer(function() { - timeoutRequest('timeout'); - }, timeout); - } else if (isPromiseLike(timeout)) { - timeout.then(function() { - timeoutRequest(isDefined(timeout.$$timeoutId) ? 'timeout' : 'abort'); - }); - } - - function timeoutRequest(reason) { - abortedByTimeout = reason === 'timeout'; - if (jsonpDone) { - jsonpDone(); - } - if (xhr) { - xhr.abort(); - } - } - - function completeRequest(callback, status, response, headersString, statusText, xhrStatus) { - // cancel timeout and subsequent timeout promise resolution - if (isDefined(timeoutId)) { - $browserDefer.cancel(timeoutId); - } - jsonpDone = xhr = null; - - callback(status, response, headersString, statusText, xhrStatus); - } - }; - - function jsonpReq(url, callbackPath, done) { - url = url.replace('JSON_CALLBACK', callbackPath); - // we can't use jQuery/jqLite here because jQuery does crazy stuff with script elements, e.g.: - // - fetches local scripts via XHR and evals them - // - adds and immediately removes script elements from the document - var script = rawDocument.createElement('script'), callback = null; - script.type = 'text/javascript'; - script.src = url; - script.async = true; - - callback = function(event) { - script.removeEventListener('load', callback); - script.removeEventListener('error', callback); - rawDocument.body.removeChild(script); - script = null; - var status = -1; - var text = 'unknown'; - - if (event) { - if (event.type === 'load' && !callbacks.wasCalled(callbackPath)) { - event = { type: 'error' }; - } - text = event.type; - status = event.type === 'error' ? 404 : 200; - } - - if (done) { - done(status, text); - } - }; - - script.addEventListener('load', callback); - script.addEventListener('error', callback); - rawDocument.body.appendChild(script); - return callback; - } -} - -var $interpolateMinErr = angular.$interpolateMinErr = minErr('$interpolate'); -$interpolateMinErr.throwNoconcat = function(text) { - throw $interpolateMinErr('noconcat', - 'Error while interpolating: {0}\nStrict Contextual Escaping disallows ' + - 'interpolations that concatenate multiple expressions when a trusted value is ' + - 'required. See http://docs.angularjs.org/api/ng.$sce', text); -}; - -$interpolateMinErr.interr = function(text, err) { - return $interpolateMinErr('interr', 'Can\'t interpolate: {0}\n{1}', text, err.toString()); -}; - -/** - * @ngdoc provider - * @name $interpolateProvider - * @this - * - * @description - * - * Used for configuring the interpolation markup. Defaults to `{{` and `}}`. - * - *
    - * This feature is sometimes used to mix different markup languages, e.g. to wrap an AngularJS - * template within a Python Jinja template (or any other template language). Mixing templating - * languages is **very dangerous**. The embedding template language will not safely escape AngularJS - * expressions, so any user-controlled values in the template will cause Cross Site Scripting (XSS) - * security bugs! - *
    - * - * @example - - - -
    - //demo.label// -
    -
    - - it('should interpolate binding with custom symbols', function() { - expect(element(by.binding('demo.label')).getText()).toBe('This binding is brought you by // interpolation symbols.'); - }); - -
    - */ -function $InterpolateProvider() { - var startSymbol = '{{'; - var endSymbol = '}}'; - - /** - * @ngdoc method - * @name $interpolateProvider#startSymbol - * @description - * Symbol to denote start of expression in the interpolated string. Defaults to `{{`. - * - * @param {string=} value new value to set the starting symbol to. - * @returns {string|self} Returns the symbol when used as getter and self if used as setter. - */ - this.startSymbol = function(value) { - if (value) { - startSymbol = value; - return this; - } - return startSymbol; - }; - - /** - * @ngdoc method - * @name $interpolateProvider#endSymbol - * @description - * Symbol to denote the end of expression in the interpolated string. Defaults to `}}`. - * - * @param {string=} value new value to set the ending symbol to. - * @returns {string|self} Returns the symbol when used as getter and self if used as setter. - */ - this.endSymbol = function(value) { - if (value) { - endSymbol = value; - return this; - } - return endSymbol; - }; - - - this.$get = ['$parse', '$exceptionHandler', '$sce', function($parse, $exceptionHandler, $sce) { - var startSymbolLength = startSymbol.length, - endSymbolLength = endSymbol.length, - escapedStartRegexp = new RegExp(startSymbol.replace(/./g, escape), 'g'), - escapedEndRegexp = new RegExp(endSymbol.replace(/./g, escape), 'g'); - - function escape(ch) { - return '\\\\\\' + ch; - } - - function unescapeText(text) { - return text.replace(escapedStartRegexp, startSymbol). - replace(escapedEndRegexp, endSymbol); - } - - // TODO: this is the same as the constantWatchDelegate in parse.js - function constantWatchDelegate(scope, listener, objectEquality, constantInterp) { - var unwatch = scope.$watch(function constantInterpolateWatch(scope) { - unwatch(); - return constantInterp(scope); - }, listener, objectEquality); - return unwatch; - } - - /** - * @ngdoc service - * @name $interpolate - * @kind function - * - * @requires $parse - * @requires $sce - * - * @description - * - * Compiles a string with markup into an interpolation function. This service is used by the - * HTML {@link ng.$compile $compile} service for data binding. See - * {@link ng.$interpolateProvider $interpolateProvider} for configuring the - * interpolation markup. - * - * - * ```js - * var $interpolate = ...; // injected - * var exp = $interpolate('Hello {{name | uppercase}}!'); - * expect(exp({name:'AngularJS'})).toEqual('Hello ANGULARJS!'); - * ``` - * - * `$interpolate` takes an optional fourth argument, `allOrNothing`. If `allOrNothing` is - * `true`, the interpolation function will return `undefined` unless all embedded expressions - * evaluate to a value other than `undefined`. - * - * ```js - * var $interpolate = ...; // injected - * var context = {greeting: 'Hello', name: undefined }; - * - * // default "forgiving" mode - * var exp = $interpolate('{{greeting}} {{name}}!'); - * expect(exp(context)).toEqual('Hello !'); - * - * // "allOrNothing" mode - * exp = $interpolate('{{greeting}} {{name}}!', false, null, true); - * expect(exp(context)).toBeUndefined(); - * context.name = 'AngularJS'; - * expect(exp(context)).toEqual('Hello AngularJS!'); - * ``` - * - * `allOrNothing` is useful for interpolating URLs. `ngSrc` and `ngSrcset` use this behavior. - * - * #### Escaped Interpolation - * $interpolate provides a mechanism for escaping interpolation markers. Start and end markers - * can be escaped by preceding each of their characters with a REVERSE SOLIDUS U+005C (backslash). - * It will be rendered as a regular start/end marker, and will not be interpreted as an expression - * or binding. - * - * This enables web-servers to prevent script injection attacks and defacing attacks, to some - * degree, while also enabling code examples to work without relying on the - * {@link ng.directive:ngNonBindable ngNonBindable} directive. - * - * **For security purposes, it is strongly encouraged that web servers escape user-supplied data, - * replacing angle brackets (<, >) with &lt; and &gt; respectively, and replacing all - * interpolation start/end markers with their escaped counterparts.** - * - * Escaped interpolation markers are only replaced with the actual interpolation markers in rendered - * output when the $interpolate service processes the text. So, for HTML elements interpolated - * by {@link ng.$compile $compile}, or otherwise interpolated with the `mustHaveExpression` parameter - * set to `true`, the interpolated text must contain an unescaped interpolation expression. As such, - * this is typically useful only when user-data is used in rendering a template from the server, or - * when otherwise untrusted data is used by a directive. - * - * - * - *
    - *

    {{apptitle}}: \{\{ username = "defaced value"; \}\} - *

    - *

    {{username}} attempts to inject code which will deface the - * application, but fails to accomplish their task, because the server has correctly - * escaped the interpolation start/end markers with REVERSE SOLIDUS U+005C (backslash) - * characters.

    - *

    Instead, the result of the attempted script injection is visible, and can be removed - * from the database by an administrator.

    - *
    - *
    - *
    - * - * @knownIssue - * It is currently not possible for an interpolated expression to contain the interpolation end - * symbol. For example, `{{ '}}' }}` will be incorrectly interpreted as `{{ ' }}` + `' }}`, i.e. - * an interpolated expression consisting of a single-quote (`'`) and the `' }}` string. - * - * @knownIssue - * All directives and components must use the standard `{{` `}}` interpolation symbols - * in their templates. If you change the application interpolation symbols the {@link $compile} - * service will attempt to denormalize the standard symbols to the custom symbols. - * The denormalization process is not clever enough to know not to replace instances of the standard - * symbols where they would not normally be treated as interpolation symbols. For example in the following - * code snippet the closing braces of the literal object will get incorrectly denormalized: - * - * ``` - *
    - * ``` - * - * See https://github.com/angular/angular.js/pull/14610#issuecomment-219401099 for more information. - * - * @param {string} text The text with markup to interpolate. - * @param {boolean=} mustHaveExpression if set to true then the interpolation string must have - * embedded expression in order to return an interpolation function. Strings with no - * embedded expression will return null for the interpolation function. - * @param {string=} trustedContext when provided, the returned function passes the interpolated - * result through {@link ng.$sce#getTrusted $sce.getTrusted(interpolatedResult, - * trustedContext)} before returning it. Refer to the {@link ng.$sce $sce} service that - * provides Strict Contextual Escaping for details. - * @param {boolean=} allOrNothing if `true`, then the returned function returns undefined - * unless all embedded expressions evaluate to a value other than `undefined`. - * @returns {function(context)} an interpolation function which is used to compute the - * interpolated string. The function has these parameters: - * - * - `context`: evaluation context for all expressions embedded in the interpolated text - */ - function $interpolate(text, mustHaveExpression, trustedContext, allOrNothing) { - var contextAllowsConcatenation = trustedContext === $sce.URL || trustedContext === $sce.MEDIA_URL; - - // Provide a quick exit and simplified result function for text with no interpolation - if (!text.length || text.indexOf(startSymbol) === -1) { - if (mustHaveExpression) return; - - var unescapedText = unescapeText(text); - if (contextAllowsConcatenation) { - unescapedText = $sce.getTrusted(trustedContext, unescapedText); - } - var constantInterp = valueFn(unescapedText); - constantInterp.exp = text; - constantInterp.expressions = []; - constantInterp.$$watchDelegate = constantWatchDelegate; - - return constantInterp; - } - - allOrNothing = !!allOrNothing; - var startIndex, - endIndex, - index = 0, - expressions = [], - parseFns, - textLength = text.length, - exp, - concat = [], - expressionPositions = [], - singleExpression; - - - while (index < textLength) { - if (((startIndex = text.indexOf(startSymbol, index)) !== -1) && - ((endIndex = text.indexOf(endSymbol, startIndex + startSymbolLength)) !== -1)) { - if (index !== startIndex) { - concat.push(unescapeText(text.substring(index, startIndex))); - } - exp = text.substring(startIndex + startSymbolLength, endIndex); - expressions.push(exp); - index = endIndex + endSymbolLength; - expressionPositions.push(concat.length); - concat.push(''); // Placeholder that will get replaced with the evaluated expression. - } else { - // we did not find an interpolation, so we have to add the remainder to the separators array - if (index !== textLength) { - concat.push(unescapeText(text.substring(index))); - } - break; - } - } - - singleExpression = concat.length === 1 && expressionPositions.length === 1; - // Intercept expression if we need to stringify concatenated inputs, which may be SCE trusted - // objects rather than simple strings - // (we don't modify the expression if the input consists of only a single trusted input) - var interceptor = contextAllowsConcatenation && singleExpression ? undefined : parseStringifyInterceptor; - parseFns = expressions.map(function(exp) { return $parse(exp, interceptor); }); - - // Concatenating expressions makes it hard to reason about whether some combination of - // concatenated values are unsafe to use and could easily lead to XSS. By requiring that a - // single expression be used for some $sce-managed secure contexts (RESOURCE_URLs mostly), - // we ensure that the value that's used is assigned or constructed by some JS code somewhere - // that is more testable or make it obvious that you bound the value to some user controlled - // value. This helps reduce the load when auditing for XSS issues. - - // Note that URL and MEDIA_URL $sce contexts do not need this, since `$sce` can sanitize the values - // passed to it. In that case, `$sce.getTrusted` will be called on either the single expression - // or on the overall concatenated string (losing trusted types used in the mix, by design). - // Both these methods will sanitize plain strings. Also, HTML could be included, but since it's - // only used in srcdoc attributes, this would not be very useful. - - if (!mustHaveExpression || expressions.length) { - var compute = function(values) { - for (var i = 0, ii = expressions.length; i < ii; i++) { - if (allOrNothing && isUndefined(values[i])) return; - concat[expressionPositions[i]] = values[i]; - } - - if (contextAllowsConcatenation) { - // If `singleExpression` then `concat[0]` might be a "trusted" value or `null`, rather than a string - return $sce.getTrusted(trustedContext, singleExpression ? concat[0] : concat.join('')); - } else if (trustedContext && concat.length > 1) { - // This context does not allow more than one part, e.g. expr + string or exp + exp. - $interpolateMinErr.throwNoconcat(text); - } - // In an unprivileged context or only one part: just concatenate and return. - return concat.join(''); - }; - - return extend(function interpolationFn(context) { - var i = 0; - var ii = expressions.length; - var values = new Array(ii); - - try { - for (; i < ii; i++) { - values[i] = parseFns[i](context); - } - - return compute(values); - } catch (err) { - $exceptionHandler($interpolateMinErr.interr(text, err)); - } - - }, { - // all of these properties are undocumented for now - exp: text, //just for compatibility with regular watchers created via $watch - expressions: expressions, - $$watchDelegate: function(scope, listener) { - var lastValue; - return scope.$watchGroup(parseFns, /** @this */ function interpolateFnWatcher(values, oldValues) { - var currValue = compute(values); - listener.call(this, currValue, values !== oldValues ? lastValue : currValue, scope); - lastValue = currValue; - }); - } - }); - } - - function parseStringifyInterceptor(value) { - try { - // In concatenable contexts, getTrusted comes at the end, to avoid sanitizing individual - // parts of a full URL. We don't care about losing the trustedness here. - // In non-concatenable contexts, where there is only one expression, this interceptor is - // not applied to the expression. - value = (trustedContext && !contextAllowsConcatenation) ? - $sce.getTrusted(trustedContext, value) : - $sce.valueOf(value); - return allOrNothing && !isDefined(value) ? value : stringify(value); - } catch (err) { - $exceptionHandler($interpolateMinErr.interr(text, err)); - } - } - } - - - /** - * @ngdoc method - * @name $interpolate#startSymbol - * @description - * Symbol to denote the start of expression in the interpolated string. Defaults to `{{`. - * - * Use {@link ng.$interpolateProvider#startSymbol `$interpolateProvider.startSymbol`} to change - * the symbol. - * - * @returns {string} start symbol. - */ - $interpolate.startSymbol = function() { - return startSymbol; - }; - - - /** - * @ngdoc method - * @name $interpolate#endSymbol - * @description - * Symbol to denote the end of expression in the interpolated string. Defaults to `}}`. - * - * Use {@link ng.$interpolateProvider#endSymbol `$interpolateProvider.endSymbol`} to change - * the symbol. - * - * @returns {string} end symbol. - */ - $interpolate.endSymbol = function() { - return endSymbol; - }; - - return $interpolate; - }]; -} - -var $intervalMinErr = minErr('$interval'); - -/** @this */ -function $IntervalProvider() { - this.$get = ['$$intervalFactory', '$window', - function($$intervalFactory, $window) { - var intervals = {}; - var setIntervalFn = function(tick, delay, deferred) { - var id = $window.setInterval(tick, delay); - intervals[id] = deferred; - return id; - }; - var clearIntervalFn = function(id) { - $window.clearInterval(id); - delete intervals[id]; - }; - - /** - * @ngdoc service - * @name $interval - * - * @description - * AngularJS's wrapper for `window.setInterval`. The `fn` function is executed every `delay` - * milliseconds. - * - * The return value of registering an interval function is a promise. This promise will be - * notified upon each tick of the interval, and will be resolved after `count` iterations, or - * run indefinitely if `count` is not defined. The value of the notification will be the - * number of iterations that have run. - * To cancel an interval, call `$interval.cancel(promise)`. - * - * In tests you can use {@link ngMock.$interval#flush `$interval.flush(millis)`} to - * move forward by `millis` milliseconds and trigger any functions scheduled to run in that - * time. - * - *
    - * **Note**: Intervals created by this service must be explicitly destroyed when you are finished - * with them. In particular they are not automatically destroyed when a controller's scope or a - * directive's element are destroyed. - * You should take this into consideration and make sure to always cancel the interval at the - * appropriate moment. See the example below for more details on how and when to do this. - *
    - * - * @param {function()} fn A function that should be called repeatedly. If no additional arguments - * are passed (see below), the function is called with the current iteration count. - * @param {number} delay Number of milliseconds between each function call. - * @param {number=} [count=0] Number of times to repeat. If not set, or 0, will repeat - * indefinitely. - * @param {boolean=} [invokeApply=true] If set to `false` skips model dirty checking, otherwise - * will invoke `fn` within the {@link ng.$rootScope.Scope#$apply $apply} block. - * @param {...*=} Pass additional parameters to the executed function. - * @returns {promise} A promise which will be notified on each iteration. It will resolve once all iterations of the interval complete. - * - * @example - * - * - * - * - *
    - *
    - *
    - * Current time is: - *
    - * Blood 1 : {{blood_1}} - * Blood 2 : {{blood_2}} - * - * - * - *
    - *
    - * - *
    - *
    - */ - var interval = $$intervalFactory(setIntervalFn, clearIntervalFn); - - /** - * @ngdoc method - * @name $interval#cancel - * - * @description - * Cancels a task associated with the `promise`. - * - * @param {Promise=} promise returned by the `$interval` function. - * @returns {boolean} Returns `true` if the task was successfully canceled. - */ - interval.cancel = function(promise) { - if (!promise) return false; - - if (!promise.hasOwnProperty('$$intervalId')) { - throw $intervalMinErr('badprom', - '`$interval.cancel()` called with a promise that was not generated by `$interval()`.'); - } - - if (!intervals.hasOwnProperty(promise.$$intervalId)) return false; - - var id = promise.$$intervalId; - var deferred = intervals[id]; - - // Interval cancels should not report an unhandled promise. - markQExceptionHandled(deferred.promise); - deferred.reject('canceled'); - clearIntervalFn(id); - - return true; - }; - - return interval; - }]; -} - -/** @this */ -function $$IntervalFactoryProvider() { - this.$get = ['$browser', '$q', '$$q', '$rootScope', - function($browser, $q, $$q, $rootScope) { - return function intervalFactory(setIntervalFn, clearIntervalFn) { - return function intervalFn(fn, delay, count, invokeApply) { - var hasParams = arguments.length > 4, - args = hasParams ? sliceArgs(arguments, 4) : [], - iteration = 0, - skipApply = isDefined(invokeApply) && !invokeApply, - deferred = (skipApply ? $$q : $q).defer(), - promise = deferred.promise; - - count = isDefined(count) ? count : 0; - - function callback() { - if (!hasParams) { - fn(iteration); - } else { - fn.apply(null, args); - } - } - - function tick() { - if (skipApply) { - $browser.defer(callback); - } else { - $rootScope.$evalAsync(callback); - } - deferred.notify(iteration++); - - if (count > 0 && iteration >= count) { - deferred.resolve(iteration); - clearIntervalFn(promise.$$intervalId); - } - - if (!skipApply) $rootScope.$apply(); - } - - promise.$$intervalId = setIntervalFn(tick, delay, deferred, skipApply); - - return promise; - }; - }; - }]; -} - -/** - * @ngdoc service - * @name $jsonpCallbacks - * @requires $window - * @description - * This service handles the lifecycle of callbacks to handle JSONP requests. - * Override this service if you wish to customise where the callbacks are stored and - * how they vary compared to the requested url. - */ -var $jsonpCallbacksProvider = /** @this */ function() { - this.$get = function() { - var callbacks = angular.callbacks; - var callbackMap = {}; - - function createCallback(callbackId) { - var callback = function(data) { - callback.data = data; - callback.called = true; - }; - callback.id = callbackId; - return callback; - } - - return { - /** - * @ngdoc method - * @name $jsonpCallbacks#createCallback - * @param {string} url the url of the JSONP request - * @returns {string} the callback path to send to the server as part of the JSONP request - * @description - * {@link $httpBackend} calls this method to create a callback and get hold of the path to the callback - * to pass to the server, which will be used to call the callback with its payload in the JSONP response. - */ - createCallback: function(url) { - var callbackId = '_' + (callbacks.$$counter++).toString(36); - var callbackPath = 'angular.callbacks.' + callbackId; - var callback = createCallback(callbackId); - callbackMap[callbackPath] = callbacks[callbackId] = callback; - return callbackPath; - }, - /** - * @ngdoc method - * @name $jsonpCallbacks#wasCalled - * @param {string} callbackPath the path to the callback that was sent in the JSONP request - * @returns {boolean} whether the callback has been called, as a result of the JSONP response - * @description - * {@link $httpBackend} calls this method to find out whether the JSONP response actually called the - * callback that was passed in the request. - */ - wasCalled: function(callbackPath) { - return callbackMap[callbackPath].called; - }, - /** - * @ngdoc method - * @name $jsonpCallbacks#getResponse - * @param {string} callbackPath the path to the callback that was sent in the JSONP request - * @returns {*} the data received from the response via the registered callback - * @description - * {@link $httpBackend} calls this method to get hold of the data that was provided to the callback - * in the JSONP response. - */ - getResponse: function(callbackPath) { - return callbackMap[callbackPath].data; - }, - /** - * @ngdoc method - * @name $jsonpCallbacks#removeCallback - * @param {string} callbackPath the path to the callback that was sent in the JSONP request - * @description - * {@link $httpBackend} calls this method to remove the callback after the JSONP request has - * completed or timed-out. - */ - removeCallback: function(callbackPath) { - var callback = callbackMap[callbackPath]; - delete callbacks[callback.id]; - delete callbackMap[callbackPath]; - } - }; - }; -}; - -/** - * @ngdoc service - * @name $locale - * - * @description - * $locale service provides localization rules for various AngularJS components. As of right now the - * only public api is: - * - * * `id` – `{string}` – locale id formatted as `languageId-countryId` (e.g. `en-us`) - */ - -/* global stripHash: true */ - -var PATH_MATCH = /^([^?#]*)(\?([^#]*))?(#(.*))?$/, - DEFAULT_PORTS = {'http': 80, 'https': 443, 'ftp': 21}; -var $locationMinErr = minErr('$location'); - - -/** - * Encode path using encodeUriSegment, ignoring forward slashes - * - * @param {string} path Path to encode - * @returns {string} - */ -function encodePath(path) { - var segments = path.split('/'), - i = segments.length; - - while (i--) { - // decode forward slashes to prevent them from being double encoded - segments[i] = encodeUriSegment(segments[i].replace(/%2F/g, '/')); - } - - return segments.join('/'); -} - -function decodePath(path, html5Mode) { - var segments = path.split('/'), - i = segments.length; - - while (i--) { - segments[i] = decodeURIComponent(segments[i]); - if (html5Mode) { - // encode forward slashes to prevent them from being mistaken for path separators - segments[i] = segments[i].replace(/\//g, '%2F'); - } - } - - return segments.join('/'); -} - -function normalizePath(pathValue, searchValue, hashValue) { - var search = toKeyValue(searchValue), - hash = hashValue ? '#' + encodeUriSegment(hashValue) : '', - path = encodePath(pathValue); - - return path + (search ? '?' + search : '') + hash; -} - -function parseAbsoluteUrl(absoluteUrl, locationObj) { - var parsedUrl = urlResolve(absoluteUrl); - - locationObj.$$protocol = parsedUrl.protocol; - locationObj.$$host = parsedUrl.hostname; - locationObj.$$port = toInt(parsedUrl.port) || DEFAULT_PORTS[parsedUrl.protocol] || null; -} - -var DOUBLE_SLASH_REGEX = /^\s*[\\/]{2,}/; -function parseAppUrl(url, locationObj, html5Mode) { - - if (DOUBLE_SLASH_REGEX.test(url)) { - throw $locationMinErr('badpath', 'Invalid url "{0}".', url); - } - - var prefixed = (url.charAt(0) !== '/'); - if (prefixed) { - url = '/' + url; - } - var match = urlResolve(url); - var path = prefixed && match.pathname.charAt(0) === '/' ? match.pathname.substring(1) : match.pathname; - locationObj.$$path = decodePath(path, html5Mode); - locationObj.$$search = parseKeyValue(match.search); - locationObj.$$hash = decodeURIComponent(match.hash); - - // make sure path starts with '/'; - if (locationObj.$$path && locationObj.$$path.charAt(0) !== '/') { - locationObj.$$path = '/' + locationObj.$$path; - } -} - -function startsWith(str, search) { - return str.slice(0, search.length) === search; -} - -/** - * - * @param {string} base - * @param {string} url - * @returns {string} returns text from `url` after `base` or `undefined` if it does not begin with - * the expected string. - */ -function stripBaseUrl(base, url) { - if (startsWith(url, base)) { - return url.substr(base.length); - } -} - -function stripHash(url) { - var index = url.indexOf('#'); - return index === -1 ? url : url.substr(0, index); -} - -function stripFile(url) { - return url.substr(0, stripHash(url).lastIndexOf('/') + 1); -} - -/* return the server only (scheme://host:port) */ -function serverBase(url) { - return url.substring(0, url.indexOf('/', url.indexOf('//') + 2)); -} - - -/** - * LocationHtml5Url represents a URL - * This object is exposed as $location service when HTML5 mode is enabled and supported - * - * @constructor - * @param {string} appBase application base URL - * @param {string} appBaseNoFile application base URL stripped of any filename - * @param {string} basePrefix URL path prefix - */ -function LocationHtml5Url(appBase, appBaseNoFile, basePrefix) { - this.$$html5 = true; - basePrefix = basePrefix || ''; - parseAbsoluteUrl(appBase, this); - - - /** - * Parse given HTML5 (regular) URL string into properties - * @param {string} url HTML5 URL - * @private - */ - this.$$parse = function(url) { - var pathUrl = stripBaseUrl(appBaseNoFile, url); - if (!isString(pathUrl)) { - throw $locationMinErr('ipthprfx', 'Invalid url "{0}", missing path prefix "{1}".', url, - appBaseNoFile); - } - - parseAppUrl(pathUrl, this, true); - - if (!this.$$path) { - this.$$path = '/'; - } - - this.$$compose(); - }; - - this.$$normalizeUrl = function(url) { - return appBaseNoFile + url.substr(1); // first char is always '/' - }; - - this.$$parseLinkUrl = function(url, relHref) { - if (relHref && relHref[0] === '#') { - // special case for links to hash fragments: - // keep the old url and only replace the hash fragment - this.hash(relHref.slice(1)); - return true; - } - var appUrl, prevAppUrl; - var rewrittenUrl; - - - if (isDefined(appUrl = stripBaseUrl(appBase, url))) { - prevAppUrl = appUrl; - if (basePrefix && isDefined(appUrl = stripBaseUrl(basePrefix, appUrl))) { - rewrittenUrl = appBaseNoFile + (stripBaseUrl('/', appUrl) || appUrl); - } else { - rewrittenUrl = appBase + prevAppUrl; - } - } else if (isDefined(appUrl = stripBaseUrl(appBaseNoFile, url))) { - rewrittenUrl = appBaseNoFile + appUrl; - } else if (appBaseNoFile === url + '/') { - rewrittenUrl = appBaseNoFile; - } - if (rewrittenUrl) { - this.$$parse(rewrittenUrl); - } - return !!rewrittenUrl; - }; -} - - -/** - * LocationHashbangUrl represents URL - * This object is exposed as $location service when developer doesn't opt into html5 mode. - * It also serves as the base class for html5 mode fallback on legacy browsers. - * - * @constructor - * @param {string} appBase application base URL - * @param {string} appBaseNoFile application base URL stripped of any filename - * @param {string} hashPrefix hashbang prefix - */ -function LocationHashbangUrl(appBase, appBaseNoFile, hashPrefix) { - - parseAbsoluteUrl(appBase, this); - - - /** - * Parse given hashbang URL into properties - * @param {string} url Hashbang URL - * @private - */ - this.$$parse = function(url) { - var withoutBaseUrl = stripBaseUrl(appBase, url) || stripBaseUrl(appBaseNoFile, url); - var withoutHashUrl; - - if (!isUndefined(withoutBaseUrl) && withoutBaseUrl.charAt(0) === '#') { - - // The rest of the URL starts with a hash so we have - // got either a hashbang path or a plain hash fragment - withoutHashUrl = stripBaseUrl(hashPrefix, withoutBaseUrl); - if (isUndefined(withoutHashUrl)) { - // There was no hashbang prefix so we just have a hash fragment - withoutHashUrl = withoutBaseUrl; - } - - } else { - // There was no hashbang path nor hash fragment: - // If we are in HTML5 mode we use what is left as the path; - // Otherwise we ignore what is left - if (this.$$html5) { - withoutHashUrl = withoutBaseUrl; - } else { - withoutHashUrl = ''; - if (isUndefined(withoutBaseUrl)) { - appBase = url; - /** @type {?} */ (this).replace(); - } - } - } - - parseAppUrl(withoutHashUrl, this, false); - - this.$$path = removeWindowsDriveName(this.$$path, withoutHashUrl, appBase); - - this.$$compose(); - - /* - * In Windows, on an anchor node on documents loaded from - * the filesystem, the browser will return a pathname - * prefixed with the drive name ('/C:/path') when a - * pathname without a drive is set: - * * a.setAttribute('href', '/foo') - * * a.pathname === '/C:/foo' //true - * - * Inside of AngularJS, we're always using pathnames that - * do not include drive names for routing. - */ - function removeWindowsDriveName(path, url, base) { - /* - Matches paths for file protocol on windows, - such as /C:/foo/bar, and captures only /foo/bar. - */ - var windowsFilePathExp = /^\/[A-Z]:(\/.*)/; - - var firstPathSegmentMatch; - - //Get the relative path from the input URL. - if (startsWith(url, base)) { - url = url.replace(base, ''); - } - - // The input URL intentionally contains a first path segment that ends with a colon. - if (windowsFilePathExp.exec(url)) { - return path; - } - - firstPathSegmentMatch = windowsFilePathExp.exec(path); - return firstPathSegmentMatch ? firstPathSegmentMatch[1] : path; - } - }; - - this.$$normalizeUrl = function(url) { - return appBase + (url ? hashPrefix + url : ''); - }; - - this.$$parseLinkUrl = function(url, relHref) { - if (stripHash(appBase) === stripHash(url)) { - this.$$parse(url); - return true; - } - return false; - }; -} - - -/** - * LocationHashbangUrl represents URL - * This object is exposed as $location service when html5 history api is enabled but the browser - * does not support it. - * - * @constructor - * @param {string} appBase application base URL - * @param {string} appBaseNoFile application base URL stripped of any filename - * @param {string} hashPrefix hashbang prefix - */ -function LocationHashbangInHtml5Url(appBase, appBaseNoFile, hashPrefix) { - this.$$html5 = true; - LocationHashbangUrl.apply(this, arguments); - - this.$$parseLinkUrl = function(url, relHref) { - if (relHref && relHref[0] === '#') { - // special case for links to hash fragments: - // keep the old url and only replace the hash fragment - this.hash(relHref.slice(1)); - return true; - } - - var rewrittenUrl; - var appUrl; - - if (appBase === stripHash(url)) { - rewrittenUrl = url; - } else if ((appUrl = stripBaseUrl(appBaseNoFile, url))) { - rewrittenUrl = appBase + hashPrefix + appUrl; - } else if (appBaseNoFile === url + '/') { - rewrittenUrl = appBaseNoFile; - } - if (rewrittenUrl) { - this.$$parse(rewrittenUrl); - } - return !!rewrittenUrl; - }; - - this.$$normalizeUrl = function(url) { - // include hashPrefix in $$absUrl when $$url is empty so IE9 does not reload page because of removal of '#' - return appBase + hashPrefix + url; - }; -} - - -var locationPrototype = { - - /** - * Ensure absolute URL is initialized. - * @private - */ - $$absUrl:'', - - /** - * Are we in html5 mode? - * @private - */ - $$html5: false, - - /** - * Has any change been replacing? - * @private - */ - $$replace: false, - - /** - * Compose url and update `url` and `absUrl` property - * @private - */ - $$compose: function() { - this.$$url = normalizePath(this.$$path, this.$$search, this.$$hash); - this.$$absUrl = this.$$normalizeUrl(this.$$url); - this.$$urlUpdatedByLocation = true; - }, - - /** - * @ngdoc method - * @name $location#absUrl - * - * @description - * This method is getter only. - * - * Return full URL representation with all segments encoded according to rules specified in - * [RFC 3986](http://www.ietf.org/rfc/rfc3986.txt). - * - * - * ```js - * // given URL http://example.com/#/some/path?foo=bar&baz=xoxo - * var absUrl = $location.absUrl(); - * // => "http://example.com/#/some/path?foo=bar&baz=xoxo" - * ``` - * - * @return {string} full URL - */ - absUrl: locationGetter('$$absUrl'), - - /** - * @ngdoc method - * @name $location#url - * - * @description - * This method is getter / setter. - * - * Return URL (e.g. `/path?a=b#hash`) when called without any parameter. - * - * Change path, search and hash, when called with parameter and return `$location`. - * - * - * ```js - * // given URL http://example.com/#/some/path?foo=bar&baz=xoxo - * var url = $location.url(); - * // => "/some/path?foo=bar&baz=xoxo" - * ``` - * - * @param {string=} url New URL without base prefix (e.g. `/path?a=b#hash`) - * @return {string} url - */ - url: function(url) { - if (isUndefined(url)) { - return this.$$url; - } - - var match = PATH_MATCH.exec(url); - if (match[1] || url === '') this.path(decodeURIComponent(match[1])); - if (match[2] || match[1] || url === '') this.search(match[3] || ''); - this.hash(match[5] || ''); - - return this; - }, - - /** - * @ngdoc method - * @name $location#protocol - * - * @description - * This method is getter only. - * - * Return protocol of current URL. - * - * - * ```js - * // given URL http://example.com/#/some/path?foo=bar&baz=xoxo - * var protocol = $location.protocol(); - * // => "http" - * ``` - * - * @return {string} protocol of current URL - */ - protocol: locationGetter('$$protocol'), - - /** - * @ngdoc method - * @name $location#host - * - * @description - * This method is getter only. - * - * Return host of current URL. - * - * Note: compared to the non-AngularJS version `location.host` which returns `hostname:port`, this returns the `hostname` portion only. - * - * - * ```js - * // given URL http://example.com/#/some/path?foo=bar&baz=xoxo - * var host = $location.host(); - * // => "example.com" - * - * // given URL http://user:password@example.com:8080/#/some/path?foo=bar&baz=xoxo - * host = $location.host(); - * // => "example.com" - * host = location.host; - * // => "example.com:8080" - * ``` - * - * @return {string} host of current URL. - */ - host: locationGetter('$$host'), - - /** - * @ngdoc method - * @name $location#port - * - * @description - * This method is getter only. - * - * Return port of current URL. - * - * - * ```js - * // given URL http://example.com/#/some/path?foo=bar&baz=xoxo - * var port = $location.port(); - * // => 80 - * ``` - * - * @return {Number} port - */ - port: locationGetter('$$port'), - - /** - * @ngdoc method - * @name $location#path - * - * @description - * This method is getter / setter. - * - * Return path of current URL when called without any parameter. - * - * Change path when called with parameter and return `$location`. - * - * Note: Path should always begin with forward slash (/), this method will add the forward slash - * if it is missing. - * - * - * ```js - * // given URL http://example.com/#/some/path?foo=bar&baz=xoxo - * var path = $location.path(); - * // => "/some/path" - * ``` - * - * @param {(string|number)=} path New path - * @return {(string|object)} path if called with no parameters, or `$location` if called with a parameter - */ - path: locationGetterSetter('$$path', function(path) { - path = path !== null ? path.toString() : ''; - return path.charAt(0) === '/' ? path : '/' + path; - }), - - /** - * @ngdoc method - * @name $location#search - * - * @description - * This method is getter / setter. - * - * Return search part (as object) of current URL when called without any parameter. - * - * Change search part when called with parameter and return `$location`. - * - * - * ```js - * // given URL http://example.com/#/some/path?foo=bar&baz=xoxo - * var searchObject = $location.search(); - * // => {foo: 'bar', baz: 'xoxo'} - * - * // set foo to 'yipee' - * $location.search('foo', 'yipee'); - * // $location.search() => {foo: 'yipee', baz: 'xoxo'} - * ``` - * - * @param {string|Object.|Object.>} search New search params - string or - * hash object. - * - * When called with a single argument the method acts as a setter, setting the `search` component - * of `$location` to the specified value. - * - * If the argument is a hash object containing an array of values, these values will be encoded - * as duplicate search parameters in the URL. - * - * @param {(string|Number|Array|boolean)=} paramValue If `search` is a string or number, then `paramValue` - * will override only a single search property. - * - * If `paramValue` is an array, it will override the property of the `search` component of - * `$location` specified via the first argument. - * - * If `paramValue` is `null`, the property specified via the first argument will be deleted. - * - * If `paramValue` is `true`, the property specified via the first argument will be added with no - * value nor trailing equal sign. - * - * @return {Object} If called with no arguments returns the parsed `search` object. If called with - * one or more arguments returns `$location` object itself. - */ - search: function(search, paramValue) { - switch (arguments.length) { - case 0: - return this.$$search; - case 1: - if (isString(search) || isNumber(search)) { - search = search.toString(); - this.$$search = parseKeyValue(search); - } else if (isObject(search)) { - search = copy(search, {}); - // remove object undefined or null properties - forEach(search, function(value, key) { - if (value == null) delete search[key]; - }); - - this.$$search = search; - } else { - throw $locationMinErr('isrcharg', - 'The first argument of the `$location#search()` call must be a string or an object.'); - } - break; - default: - if (isUndefined(paramValue) || paramValue === null) { - delete this.$$search[search]; - } else { - this.$$search[search] = paramValue; - } - } - - this.$$compose(); - return this; - }, - - /** - * @ngdoc method - * @name $location#hash - * - * @description - * This method is getter / setter. - * - * Returns the hash fragment when called without any parameters. - * - * Changes the hash fragment when called with a parameter and returns `$location`. - * - * - * ```js - * // given URL http://example.com/#/some/path?foo=bar&baz=xoxo#hashValue - * var hash = $location.hash(); - * // => "hashValue" - * ``` - * - * @param {(string|number)=} hash New hash fragment - * @return {string} hash - */ - hash: locationGetterSetter('$$hash', function(hash) { - return hash !== null ? hash.toString() : ''; - }), - - /** - * @ngdoc method - * @name $location#replace - * - * @description - * If called, all changes to $location during the current `$digest` will replace the current history - * record, instead of adding a new one. - */ - replace: function() { - this.$$replace = true; - return this; - } -}; - -forEach([LocationHashbangInHtml5Url, LocationHashbangUrl, LocationHtml5Url], function(Location) { - Location.prototype = Object.create(locationPrototype); - - /** - * @ngdoc method - * @name $location#state - * - * @description - * This method is getter / setter. - * - * Return the history state object when called without any parameter. - * - * Change the history state object when called with one parameter and return `$location`. - * The state object is later passed to `pushState` or `replaceState`. - * - * NOTE: This method is supported only in HTML5 mode and only in browsers supporting - * the HTML5 History API (i.e. methods `pushState` and `replaceState`). If you need to support - * older browsers (like IE9 or Android < 4.0), don't use this method. - * - * @param {object=} state State object for pushState or replaceState - * @return {object} state - */ - Location.prototype.state = function(state) { - if (!arguments.length) { - return this.$$state; - } - - if (Location !== LocationHtml5Url || !this.$$html5) { - throw $locationMinErr('nostate', 'History API state support is available only ' + - 'in HTML5 mode and only in browsers supporting HTML5 History API'); - } - // The user might modify `stateObject` after invoking `$location.state(stateObject)` - // but we're changing the $$state reference to $browser.state() during the $digest - // so the modification window is narrow. - this.$$state = isUndefined(state) ? null : state; - this.$$urlUpdatedByLocation = true; - - return this; - }; -}); - - -function locationGetter(property) { - return /** @this */ function() { - return this[property]; - }; -} - - -function locationGetterSetter(property, preprocess) { - return /** @this */ function(value) { - if (isUndefined(value)) { - return this[property]; - } - - this[property] = preprocess(value); - this.$$compose(); - - return this; - }; -} - - -/** - * @ngdoc service - * @name $location - * - * @requires $rootElement - * - * @description - * The $location service parses the URL in the browser address bar (based on the - * [window.location](https://developer.mozilla.org/en/window.location)) and makes the URL - * available to your application. Changes to the URL in the address bar are reflected into - * $location service and changes to $location are reflected into the browser address bar. - * - * **The $location service:** - * - * - Exposes the current URL in the browser address bar, so you can - * - Watch and observe the URL. - * - Change the URL. - * - Synchronizes the URL with the browser when the user - * - Changes the address bar. - * - Clicks the back or forward button (or clicks a History link). - * - Clicks on a link. - * - Represents the URL object as a set of methods (protocol, host, port, path, search, hash). - * - * For more information see {@link guide/$location Developer Guide: Using $location} - */ - -/** - * @ngdoc provider - * @name $locationProvider - * @this - * - * @description - * Use the `$locationProvider` to configure how the application deep linking paths are stored. - */ -function $LocationProvider() { - var hashPrefix = '!', - html5Mode = { - enabled: false, - requireBase: true, - rewriteLinks: true - }; - - /** - * @ngdoc method - * @name $locationProvider#hashPrefix - * @description - * The default value for the prefix is `'!'`. - * @param {string=} prefix Prefix for hash part (containing path and search) - * @returns {*} current value if used as getter or itself (chaining) if used as setter - */ - this.hashPrefix = function(prefix) { - if (isDefined(prefix)) { - hashPrefix = prefix; - return this; - } else { - return hashPrefix; - } - }; - - /** - * @ngdoc method - * @name $locationProvider#html5Mode - * @description - * @param {(boolean|Object)=} mode If boolean, sets `html5Mode.enabled` to value. - * If object, sets `enabled`, `requireBase` and `rewriteLinks` to respective values. Supported - * properties: - * - **enabled** – `{boolean}` – (default: false) If true, will rely on `history.pushState` to - * change urls where supported. Will fall back to hash-prefixed paths in browsers that do not - * support `pushState`. - * - **requireBase** - `{boolean}` - (default: `true`) When html5Mode is enabled, specifies - * whether or not a tag is required to be present. If `enabled` and `requireBase` are - * true, and a base tag is not present, an error will be thrown when `$location` is injected. - * See the {@link guide/$location $location guide for more information} - * - **rewriteLinks** - `{boolean|string}` - (default: `true`) When html5Mode is enabled, - * enables/disables URL rewriting for relative links. If set to a string, URL rewriting will - * only happen on links with an attribute that matches the given string. For example, if set - * to `'internal-link'`, then the URL will only be rewritten for `` links. - * Note that [attribute name normalization](guide/directive#normalization) does not apply - * here, so `'internalLink'` will **not** match `'internal-link'`. - * - * @returns {Object} html5Mode object if used as getter or itself (chaining) if used as setter - */ - this.html5Mode = function(mode) { - if (isBoolean(mode)) { - html5Mode.enabled = mode; - return this; - } else if (isObject(mode)) { - - if (isBoolean(mode.enabled)) { - html5Mode.enabled = mode.enabled; - } - - if (isBoolean(mode.requireBase)) { - html5Mode.requireBase = mode.requireBase; - } - - if (isBoolean(mode.rewriteLinks) || isString(mode.rewriteLinks)) { - html5Mode.rewriteLinks = mode.rewriteLinks; - } - - return this; - } else { - return html5Mode; - } - }; - - /** - * @ngdoc event - * @name $location#$locationChangeStart - * @eventType broadcast on root scope - * @description - * Broadcasted before a URL will change. - * - * This change can be prevented by calling - * `preventDefault` method of the event. See {@link ng.$rootScope.Scope#$on} for more - * details about event object. Upon successful change - * {@link ng.$location#$locationChangeSuccess $locationChangeSuccess} is fired. - * - * The `newState` and `oldState` parameters may be defined only in HTML5 mode and when - * the browser supports the HTML5 History API. - * - * @param {Object} angularEvent Synthetic event object. - * @param {string} newUrl New URL - * @param {string=} oldUrl URL that was before it was changed. - * @param {string=} newState New history state object - * @param {string=} oldState History state object that was before it was changed. - */ - - /** - * @ngdoc event - * @name $location#$locationChangeSuccess - * @eventType broadcast on root scope - * @description - * Broadcasted after a URL was changed. - * - * The `newState` and `oldState` parameters may be defined only in HTML5 mode and when - * the browser supports the HTML5 History API. - * - * @param {Object} angularEvent Synthetic event object. - * @param {string} newUrl New URL - * @param {string=} oldUrl URL that was before it was changed. - * @param {string=} newState New history state object - * @param {string=} oldState History state object that was before it was changed. - */ - - this.$get = ['$rootScope', '$browser', '$sniffer', '$rootElement', '$window', - function($rootScope, $browser, $sniffer, $rootElement, $window) { - var $location, - LocationMode, - baseHref = $browser.baseHref(), // if base[href] is undefined, it defaults to '' - initialUrl = $browser.url(), - appBase; - - if (html5Mode.enabled) { - if (!baseHref && html5Mode.requireBase) { - throw $locationMinErr('nobase', - '$location in HTML5 mode requires a tag to be present!'); - } - appBase = serverBase(initialUrl) + (baseHref || '/'); - LocationMode = $sniffer.history ? LocationHtml5Url : LocationHashbangInHtml5Url; - } else { - appBase = stripHash(initialUrl); - LocationMode = LocationHashbangUrl; - } - var appBaseNoFile = stripFile(appBase); - - $location = new LocationMode(appBase, appBaseNoFile, '#' + hashPrefix); - $location.$$parseLinkUrl(initialUrl, initialUrl); - - $location.$$state = $browser.state(); - - var IGNORE_URI_REGEXP = /^\s*(javascript|mailto):/i; - - // Determine if two URLs are equal despite potentially having different encoding/normalizing - // such as $location.absUrl() vs $browser.url() - // See https://github.com/angular/angular.js/issues/16592 - function urlsEqual(a, b) { - return a === b || urlResolve(a).href === urlResolve(b).href; - } - - function setBrowserUrlWithFallback(url, replace, state) { - var oldUrl = $location.url(); - var oldState = $location.$$state; - try { - $browser.url(url, replace, state); - - // Make sure $location.state() returns referentially identical (not just deeply equal) - // state object; this makes possible quick checking if the state changed in the digest - // loop. Checking deep equality would be too expensive. - $location.$$state = $browser.state(); - } catch (e) { - // Restore old values if pushState fails - $location.url(oldUrl); - $location.$$state = oldState; - - throw e; - } - } - - $rootElement.on('click', function(event) { - var rewriteLinks = html5Mode.rewriteLinks; - // TODO(vojta): rewrite link when opening in new tab/window (in legacy browser) - // currently we open nice url link and redirect then - - if (!rewriteLinks || event.ctrlKey || event.metaKey || event.shiftKey || event.which === 2 || event.button === 2) return; - - var elm = jqLite(event.target); - - // traverse the DOM up to find first A tag - while (nodeName_(elm[0]) !== 'a') { - // ignore rewriting if no A tag (reached root element, or no parent - removed from document) - if (elm[0] === $rootElement[0] || !(elm = elm.parent())[0]) return; - } - - if (isString(rewriteLinks) && isUndefined(elm.attr(rewriteLinks))) return; - - var absHref = elm.prop('href'); - // get the actual href attribute - see - // http://msdn.microsoft.com/en-us/library/ie/dd347148(v=vs.85).aspx - var relHref = elm.attr('href') || elm.attr('xlink:href'); - - if (isObject(absHref) && absHref.toString() === '[object SVGAnimatedString]') { - // SVGAnimatedString.animVal should be identical to SVGAnimatedString.baseVal, unless during - // an animation. - absHref = urlResolve(absHref.animVal).href; - } - - // Ignore when url is started with javascript: or mailto: - if (IGNORE_URI_REGEXP.test(absHref)) return; - - if (absHref && !elm.attr('target') && !event.isDefaultPrevented()) { - if ($location.$$parseLinkUrl(absHref, relHref)) { - // We do a preventDefault for all urls that are part of the AngularJS application, - // in html5mode and also without, so that we are able to abort navigation without - // getting double entries in the location history. - event.preventDefault(); - // update location manually - if ($location.absUrl() !== $browser.url()) { - $rootScope.$apply(); - } - } - } - }); - - - // rewrite hashbang url <> html5 url - if ($location.absUrl() !== initialUrl) { - $browser.url($location.absUrl(), true); - } - - var initializing = true; - - // update $location when $browser url changes - $browser.onUrlChange(function(newUrl, newState) { - - if (!startsWith(newUrl, appBaseNoFile)) { - // If we are navigating outside of the app then force a reload - $window.location.href = newUrl; - return; - } - - $rootScope.$evalAsync(function() { - var oldUrl = $location.absUrl(); - var oldState = $location.$$state; - var defaultPrevented; - $location.$$parse(newUrl); - $location.$$state = newState; - - defaultPrevented = $rootScope.$broadcast('$locationChangeStart', newUrl, oldUrl, - newState, oldState).defaultPrevented; - - // if the location was changed by a `$locationChangeStart` handler then stop - // processing this location change - if ($location.absUrl() !== newUrl) return; - - if (defaultPrevented) { - $location.$$parse(oldUrl); - $location.$$state = oldState; - setBrowserUrlWithFallback(oldUrl, false, oldState); - } else { - initializing = false; - afterLocationChange(oldUrl, oldState); - } - }); - if (!$rootScope.$$phase) $rootScope.$digest(); - }); - - // update browser - $rootScope.$watch(function $locationWatch() { - if (initializing || $location.$$urlUpdatedByLocation) { - $location.$$urlUpdatedByLocation = false; - - var oldUrl = $browser.url(); - var newUrl = $location.absUrl(); - var oldState = $browser.state(); - var currentReplace = $location.$$replace; - var urlOrStateChanged = !urlsEqual(oldUrl, newUrl) || - ($location.$$html5 && $sniffer.history && oldState !== $location.$$state); - - if (initializing || urlOrStateChanged) { - initializing = false; - - $rootScope.$evalAsync(function() { - var newUrl = $location.absUrl(); - var defaultPrevented = $rootScope.$broadcast('$locationChangeStart', newUrl, oldUrl, - $location.$$state, oldState).defaultPrevented; - - // if the location was changed by a `$locationChangeStart` handler then stop - // processing this location change - if ($location.absUrl() !== newUrl) return; - - if (defaultPrevented) { - $location.$$parse(oldUrl); - $location.$$state = oldState; - } else { - if (urlOrStateChanged) { - setBrowserUrlWithFallback(newUrl, currentReplace, - oldState === $location.$$state ? null : $location.$$state); - } - afterLocationChange(oldUrl, oldState); - } - }); - } - } - - $location.$$replace = false; - - // we don't need to return anything because $evalAsync will make the digest loop dirty when - // there is a change - }); - - return $location; - - function afterLocationChange(oldUrl, oldState) { - $rootScope.$broadcast('$locationChangeSuccess', $location.absUrl(), oldUrl, - $location.$$state, oldState); - } -}]; -} - -/** - * @ngdoc service - * @name $log - * @requires $window - * - * @description - * Simple service for logging. Default implementation safely writes the message - * into the browser's console (if present). - * - * The main purpose of this service is to simplify debugging and troubleshooting. - * - * To reveal the location of the calls to `$log` in the JavaScript console, - * you can "blackbox" the AngularJS source in your browser: - * - * [Mozilla description of blackboxing](https://developer.mozilla.org/en-US/docs/Tools/Debugger/How_to/Black_box_a_source). - * [Chrome description of blackboxing](https://developer.chrome.com/devtools/docs/blackboxing). - * - * Note: Not all browsers support blackboxing. - * - * The default is to log `debug` messages. You can use - * {@link ng.$logProvider ng.$logProvider#debugEnabled} to change this. - * - * @example - - - angular.module('logExample', []) - .controller('LogController', ['$scope', '$log', function($scope, $log) { - $scope.$log = $log; - $scope.message = 'Hello World!'; - }]); - - -
    -

    Reload this page with open console, enter text and hit the log button...

    - - - - - - -
    -
    -
    - */ - -/** - * @ngdoc provider - * @name $logProvider - * @this - * - * @description - * Use the `$logProvider` to configure how the application logs messages - */ -function $LogProvider() { - var debug = true, - self = this; - - /** - * @ngdoc method - * @name $logProvider#debugEnabled - * @description - * @param {boolean=} flag enable or disable debug level messages - * @returns {*} current value if used as getter or itself (chaining) if used as setter - */ - this.debugEnabled = function(flag) { - if (isDefined(flag)) { - debug = flag; - return this; - } else { - return debug; - } - }; - - this.$get = ['$window', function($window) { - // Support: IE 9-11, Edge 12-14+ - // IE/Edge display errors in such a way that it requires the user to click in 4 places - // to see the stack trace. There is no way to feature-detect it so there's a chance - // of the user agent sniffing to go wrong but since it's only about logging, this shouldn't - // break apps. Other browsers display errors in a sensible way and some of them map stack - // traces along source maps if available so it makes sense to let browsers display it - // as they want. - var formatStackTrace = msie || /\bEdge\//.test($window.navigator && $window.navigator.userAgent); - - return { - /** - * @ngdoc method - * @name $log#log - * - * @description - * Write a log message - */ - log: consoleLog('log'), - - /** - * @ngdoc method - * @name $log#info - * - * @description - * Write an information message - */ - info: consoleLog('info'), - - /** - * @ngdoc method - * @name $log#warn - * - * @description - * Write a warning message - */ - warn: consoleLog('warn'), - - /** - * @ngdoc method - * @name $log#error - * - * @description - * Write an error message - */ - error: consoleLog('error'), - - /** - * @ngdoc method - * @name $log#debug - * - * @description - * Write a debug message - */ - debug: (function() { - var fn = consoleLog('debug'); - - return function() { - if (debug) { - fn.apply(self, arguments); - } - }; - })() - }; - - function formatError(arg) { - if (isError(arg)) { - if (arg.stack && formatStackTrace) { - arg = (arg.message && arg.stack.indexOf(arg.message) === -1) - ? 'Error: ' + arg.message + '\n' + arg.stack - : arg.stack; - } else if (arg.sourceURL) { - arg = arg.message + '\n' + arg.sourceURL + ':' + arg.line; - } - } - return arg; - } - - function consoleLog(type) { - var console = $window.console || {}, - logFn = console[type] || console.log || noop; - - return function() { - var args = []; - forEach(arguments, function(arg) { - args.push(formatError(arg)); - }); - // Support: IE 9 only - // console methods don't inherit from Function.prototype in IE 9 so we can't - // call `logFn.apply(console, args)` directly. - return Function.prototype.apply.call(logFn, console, args); - }; - } - }]; -} - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Any commits to this file should be reviewed with security in mind. * - * Changes to this file can potentially create security vulnerabilities. * - * An approval from 2 Core members with history of modifying * - * this file is required. * - * * - * Does the change somehow allow for arbitrary javascript to be executed? * - * Or allows for someone to change the prototype of built-in objects? * - * Or gives undesired access to variables likes document or window? * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -var $parseMinErr = minErr('$parse'); - -var objectValueOf = {}.constructor.prototype.valueOf; - -// Sandboxing AngularJS Expressions -// ------------------------------ -// AngularJS expressions are no longer sandboxed. So it is now even easier to access arbitrary JS code by -// various means such as obtaining a reference to native JS functions like the Function constructor. -// -// As an example, consider the following AngularJS expression: -// -// {}.toString.constructor('alert("evil JS code")') -// -// It is important to realize that if you create an expression from a string that contains user provided -// content then it is possible that your application contains a security vulnerability to an XSS style attack. -// -// See https://docs.angularjs.org/guide/security - - -function getStringValue(name) { - // Property names must be strings. This means that non-string objects cannot be used - // as keys in an object. Any non-string object, including a number, is typecasted - // into a string via the toString method. - // -- MDN, https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Operators/Property_accessors#Property_names - // - // So, to ensure that we are checking the same `name` that JavaScript would use, we cast it - // to a string. It's not always possible. If `name` is an object and its `toString` method is - // 'broken' (doesn't return a string, isn't a function, etc.), an error will be thrown: - // - // TypeError: Cannot convert object to primitive value - // - // For performance reasons, we don't catch this error here and allow it to propagate up the call - // stack. Note that you'll get the same error in JavaScript if you try to access a property using - // such a 'broken' object as a key. - return name + ''; -} - - -var OPERATORS = createMap(); -forEach('+ - * / % === !== == != < > <= >= && || ! = |'.split(' '), function(operator) { OPERATORS[operator] = true; }); -var ESCAPE = {'n':'\n', 'f':'\f', 'r':'\r', 't':'\t', 'v':'\v', '\'':'\'', '"':'"'}; - - -///////////////////////////////////////// - - -/** - * @constructor - */ -var Lexer = function Lexer(options) { - this.options = options; -}; - -Lexer.prototype = { - constructor: Lexer, - - lex: function(text) { - this.text = text; - this.index = 0; - this.tokens = []; - - while (this.index < this.text.length) { - var ch = this.text.charAt(this.index); - if (ch === '"' || ch === '\'') { - this.readString(ch); - } else if (this.isNumber(ch) || ch === '.' && this.isNumber(this.peek())) { - this.readNumber(); - } else if (this.isIdentifierStart(this.peekMultichar())) { - this.readIdent(); - } else if (this.is(ch, '(){}[].,;:?')) { - this.tokens.push({index: this.index, text: ch}); - this.index++; - } else if (this.isWhitespace(ch)) { - this.index++; - } else { - var ch2 = ch + this.peek(); - var ch3 = ch2 + this.peek(2); - var op1 = OPERATORS[ch]; - var op2 = OPERATORS[ch2]; - var op3 = OPERATORS[ch3]; - if (op1 || op2 || op3) { - var token = op3 ? ch3 : (op2 ? ch2 : ch); - this.tokens.push({index: this.index, text: token, operator: true}); - this.index += token.length; - } else { - this.throwError('Unexpected next character ', this.index, this.index + 1); - } - } - } - return this.tokens; - }, - - is: function(ch, chars) { - return chars.indexOf(ch) !== -1; - }, - - peek: function(i) { - var num = i || 1; - return (this.index + num < this.text.length) ? this.text.charAt(this.index + num) : false; - }, - - isNumber: function(ch) { - return ('0' <= ch && ch <= '9') && typeof ch === 'string'; - }, - - isWhitespace: function(ch) { - // IE treats non-breaking space as \u00A0 - return (ch === ' ' || ch === '\r' || ch === '\t' || - ch === '\n' || ch === '\v' || ch === '\u00A0'); - }, - - isIdentifierStart: function(ch) { - return this.options.isIdentifierStart ? - this.options.isIdentifierStart(ch, this.codePointAt(ch)) : - this.isValidIdentifierStart(ch); - }, - - isValidIdentifierStart: function(ch) { - return ('a' <= ch && ch <= 'z' || - 'A' <= ch && ch <= 'Z' || - '_' === ch || ch === '$'); - }, - - isIdentifierContinue: function(ch) { - return this.options.isIdentifierContinue ? - this.options.isIdentifierContinue(ch, this.codePointAt(ch)) : - this.isValidIdentifierContinue(ch); - }, - - isValidIdentifierContinue: function(ch, cp) { - return this.isValidIdentifierStart(ch, cp) || this.isNumber(ch); - }, - - codePointAt: function(ch) { - if (ch.length === 1) return ch.charCodeAt(0); - // eslint-disable-next-line no-bitwise - return (ch.charCodeAt(0) << 10) + ch.charCodeAt(1) - 0x35FDC00; - }, - - peekMultichar: function() { - var ch = this.text.charAt(this.index); - var peek = this.peek(); - if (!peek) { - return ch; - } - var cp1 = ch.charCodeAt(0); - var cp2 = peek.charCodeAt(0); - if (cp1 >= 0xD800 && cp1 <= 0xDBFF && cp2 >= 0xDC00 && cp2 <= 0xDFFF) { - return ch + peek; - } - return ch; - }, - - isExpOperator: function(ch) { - return (ch === '-' || ch === '+' || this.isNumber(ch)); - }, - - throwError: function(error, start, end) { - end = end || this.index; - var colStr = (isDefined(start) - ? 's ' + start + '-' + this.index + ' [' + this.text.substring(start, end) + ']' - : ' ' + end); - throw $parseMinErr('lexerr', 'Lexer Error: {0} at column{1} in expression [{2}].', - error, colStr, this.text); - }, - - readNumber: function() { - var number = ''; - var start = this.index; - while (this.index < this.text.length) { - var ch = lowercase(this.text.charAt(this.index)); - if (ch === '.' || this.isNumber(ch)) { - number += ch; - } else { - var peekCh = this.peek(); - if (ch === 'e' && this.isExpOperator(peekCh)) { - number += ch; - } else if (this.isExpOperator(ch) && - peekCh && this.isNumber(peekCh) && - number.charAt(number.length - 1) === 'e') { - number += ch; - } else if (this.isExpOperator(ch) && - (!peekCh || !this.isNumber(peekCh)) && - number.charAt(number.length - 1) === 'e') { - this.throwError('Invalid exponent'); - } else { - break; - } - } - this.index++; - } - this.tokens.push({ - index: start, - text: number, - constant: true, - value: Number(number) - }); - }, - - readIdent: function() { - var start = this.index; - this.index += this.peekMultichar().length; - while (this.index < this.text.length) { - var ch = this.peekMultichar(); - if (!this.isIdentifierContinue(ch)) { - break; - } - this.index += ch.length; - } - this.tokens.push({ - index: start, - text: this.text.slice(start, this.index), - identifier: true - }); - }, - - readString: function(quote) { - var start = this.index; - this.index++; - var string = ''; - var rawString = quote; - var escape = false; - while (this.index < this.text.length) { - var ch = this.text.charAt(this.index); - rawString += ch; - if (escape) { - if (ch === 'u') { - var hex = this.text.substring(this.index + 1, this.index + 5); - if (!hex.match(/[\da-f]{4}/i)) { - this.throwError('Invalid unicode escape [\\u' + hex + ']'); - } - this.index += 4; - string += String.fromCharCode(parseInt(hex, 16)); - } else { - var rep = ESCAPE[ch]; - string = string + (rep || ch); - } - escape = false; - } else if (ch === '\\') { - escape = true; - } else if (ch === quote) { - this.index++; - this.tokens.push({ - index: start, - text: rawString, - constant: true, - value: string - }); - return; - } else { - string += ch; - } - this.index++; - } - this.throwError('Unterminated quote', start); - } -}; - -var AST = function AST(lexer, options) { - this.lexer = lexer; - this.options = options; -}; - -AST.Program = 'Program'; -AST.ExpressionStatement = 'ExpressionStatement'; -AST.AssignmentExpression = 'AssignmentExpression'; -AST.ConditionalExpression = 'ConditionalExpression'; -AST.LogicalExpression = 'LogicalExpression'; -AST.BinaryExpression = 'BinaryExpression'; -AST.UnaryExpression = 'UnaryExpression'; -AST.CallExpression = 'CallExpression'; -AST.MemberExpression = 'MemberExpression'; -AST.Identifier = 'Identifier'; -AST.Literal = 'Literal'; -AST.ArrayExpression = 'ArrayExpression'; -AST.Property = 'Property'; -AST.ObjectExpression = 'ObjectExpression'; -AST.ThisExpression = 'ThisExpression'; -AST.LocalsExpression = 'LocalsExpression'; - -// Internal use only -AST.NGValueParameter = 'NGValueParameter'; - -AST.prototype = { - ast: function(text) { - this.text = text; - this.tokens = this.lexer.lex(text); - - var value = this.program(); - - if (this.tokens.length !== 0) { - this.throwError('is an unexpected token', this.tokens[0]); - } - - return value; - }, - - program: function() { - var body = []; - while (true) { - if (this.tokens.length > 0 && !this.peek('}', ')', ';', ']')) - body.push(this.expressionStatement()); - if (!this.expect(';')) { - return { type: AST.Program, body: body}; - } - } - }, - - expressionStatement: function() { - return { type: AST.ExpressionStatement, expression: this.filterChain() }; - }, - - filterChain: function() { - var left = this.expression(); - while (this.expect('|')) { - left = this.filter(left); - } - return left; - }, - - expression: function() { - return this.assignment(); - }, - - assignment: function() { - var result = this.ternary(); - if (this.expect('=')) { - if (!isAssignable(result)) { - throw $parseMinErr('lval', 'Trying to assign a value to a non l-value'); - } - - result = { type: AST.AssignmentExpression, left: result, right: this.assignment(), operator: '='}; - } - return result; - }, - - ternary: function() { - var test = this.logicalOR(); - var alternate; - var consequent; - if (this.expect('?')) { - alternate = this.expression(); - if (this.consume(':')) { - consequent = this.expression(); - return { type: AST.ConditionalExpression, test: test, alternate: alternate, consequent: consequent}; - } - } - return test; - }, - - logicalOR: function() { - var left = this.logicalAND(); - while (this.expect('||')) { - left = { type: AST.LogicalExpression, operator: '||', left: left, right: this.logicalAND() }; - } - return left; - }, - - logicalAND: function() { - var left = this.equality(); - while (this.expect('&&')) { - left = { type: AST.LogicalExpression, operator: '&&', left: left, right: this.equality()}; - } - return left; - }, - - equality: function() { - var left = this.relational(); - var token; - while ((token = this.expect('==','!=','===','!=='))) { - left = { type: AST.BinaryExpression, operator: token.text, left: left, right: this.relational() }; - } - return left; - }, - - relational: function() { - var left = this.additive(); - var token; - while ((token = this.expect('<', '>', '<=', '>='))) { - left = { type: AST.BinaryExpression, operator: token.text, left: left, right: this.additive() }; - } - return left; - }, - - additive: function() { - var left = this.multiplicative(); - var token; - while ((token = this.expect('+','-'))) { - left = { type: AST.BinaryExpression, operator: token.text, left: left, right: this.multiplicative() }; - } - return left; - }, - - multiplicative: function() { - var left = this.unary(); - var token; - while ((token = this.expect('*','/','%'))) { - left = { type: AST.BinaryExpression, operator: token.text, left: left, right: this.unary() }; - } - return left; - }, - - unary: function() { - var token; - if ((token = this.expect('+', '-', '!'))) { - return { type: AST.UnaryExpression, operator: token.text, prefix: true, argument: this.unary() }; - } else { - return this.primary(); - } - }, - - primary: function() { - var primary; - if (this.expect('(')) { - primary = this.filterChain(); - this.consume(')'); - } else if (this.expect('[')) { - primary = this.arrayDeclaration(); - } else if (this.expect('{')) { - primary = this.object(); - } else if (this.selfReferential.hasOwnProperty(this.peek().text)) { - primary = copy(this.selfReferential[this.consume().text]); - } else if (this.options.literals.hasOwnProperty(this.peek().text)) { - primary = { type: AST.Literal, value: this.options.literals[this.consume().text]}; - } else if (this.peek().identifier) { - primary = this.identifier(); - } else if (this.peek().constant) { - primary = this.constant(); - } else { - this.throwError('not a primary expression', this.peek()); - } - - var next; - while ((next = this.expect('(', '[', '.'))) { - if (next.text === '(') { - primary = {type: AST.CallExpression, callee: primary, arguments: this.parseArguments() }; - this.consume(')'); - } else if (next.text === '[') { - primary = { type: AST.MemberExpression, object: primary, property: this.expression(), computed: true }; - this.consume(']'); - } else if (next.text === '.') { - primary = { type: AST.MemberExpression, object: primary, property: this.identifier(), computed: false }; - } else { - this.throwError('IMPOSSIBLE'); - } - } - return primary; - }, - - filter: function(baseExpression) { - var args = [baseExpression]; - var result = {type: AST.CallExpression, callee: this.identifier(), arguments: args, filter: true}; - - while (this.expect(':')) { - args.push(this.expression()); - } - - return result; - }, - - parseArguments: function() { - var args = []; - if (this.peekToken().text !== ')') { - do { - args.push(this.filterChain()); - } while (this.expect(',')); - } - return args; - }, - - identifier: function() { - var token = this.consume(); - if (!token.identifier) { - this.throwError('is not a valid identifier', token); - } - return { type: AST.Identifier, name: token.text }; - }, - - constant: function() { - // TODO check that it is a constant - return { type: AST.Literal, value: this.consume().value }; - }, - - arrayDeclaration: function() { - var elements = []; - if (this.peekToken().text !== ']') { - do { - if (this.peek(']')) { - // Support trailing commas per ES5.1. - break; - } - elements.push(this.expression()); - } while (this.expect(',')); - } - this.consume(']'); - - return { type: AST.ArrayExpression, elements: elements }; - }, - - object: function() { - var properties = [], property; - if (this.peekToken().text !== '}') { - do { - if (this.peek('}')) { - // Support trailing commas per ES5.1. - break; - } - property = {type: AST.Property, kind: 'init'}; - if (this.peek().constant) { - property.key = this.constant(); - property.computed = false; - this.consume(':'); - property.value = this.expression(); - } else if (this.peek().identifier) { - property.key = this.identifier(); - property.computed = false; - if (this.peek(':')) { - this.consume(':'); - property.value = this.expression(); - } else { - property.value = property.key; - } - } else if (this.peek('[')) { - this.consume('['); - property.key = this.expression(); - this.consume(']'); - property.computed = true; - this.consume(':'); - property.value = this.expression(); - } else { - this.throwError('invalid key', this.peek()); - } - properties.push(property); - } while (this.expect(',')); - } - this.consume('}'); - - return {type: AST.ObjectExpression, properties: properties }; - }, - - throwError: function(msg, token) { - throw $parseMinErr('syntax', - 'Syntax Error: Token \'{0}\' {1} at column {2} of the expression [{3}] starting at [{4}].', - token.text, msg, (token.index + 1), this.text, this.text.substring(token.index)); - }, - - consume: function(e1) { - if (this.tokens.length === 0) { - throw $parseMinErr('ueoe', 'Unexpected end of expression: {0}', this.text); - } - - var token = this.expect(e1); - if (!token) { - this.throwError('is unexpected, expecting [' + e1 + ']', this.peek()); - } - return token; - }, - - peekToken: function() { - if (this.tokens.length === 0) { - throw $parseMinErr('ueoe', 'Unexpected end of expression: {0}', this.text); - } - return this.tokens[0]; - }, - - peek: function(e1, e2, e3, e4) { - return this.peekAhead(0, e1, e2, e3, e4); - }, - - peekAhead: function(i, e1, e2, e3, e4) { - if (this.tokens.length > i) { - var token = this.tokens[i]; - var t = token.text; - if (t === e1 || t === e2 || t === e3 || t === e4 || - (!e1 && !e2 && !e3 && !e4)) { - return token; - } - } - return false; - }, - - expect: function(e1, e2, e3, e4) { - var token = this.peek(e1, e2, e3, e4); - if (token) { - this.tokens.shift(); - return token; - } - return false; - }, - - selfReferential: { - 'this': {type: AST.ThisExpression }, - '$locals': {type: AST.LocalsExpression } - } -}; - -function ifDefined(v, d) { - return typeof v !== 'undefined' ? v : d; -} - -function plusFn(l, r) { - if (typeof l === 'undefined') return r; - if (typeof r === 'undefined') return l; - return l + r; -} - -function isStateless($filter, filterName) { - var fn = $filter(filterName); - return !fn.$stateful; -} - -var PURITY_ABSOLUTE = 1; -var PURITY_RELATIVE = 2; - -// Detect nodes which could depend on non-shallow state of objects -function isPure(node, parentIsPure) { - switch (node.type) { - // Computed members might invoke a stateful toString() - case AST.MemberExpression: - if (node.computed) { - return false; - } - break; - - // Unary always convert to primative - case AST.UnaryExpression: - return PURITY_ABSOLUTE; - - // The binary + operator can invoke a stateful toString(). - case AST.BinaryExpression: - return node.operator !== '+' ? PURITY_ABSOLUTE : false; - - // Functions / filters probably read state from within objects - case AST.CallExpression: - return false; - } - - return (undefined === parentIsPure) ? PURITY_RELATIVE : parentIsPure; -} - -function findConstantAndWatchExpressions(ast, $filter, parentIsPure) { - var allConstants; - var argsToWatch; - var isStatelessFilter; - - var astIsPure = ast.isPure = isPure(ast, parentIsPure); - - switch (ast.type) { - case AST.Program: - allConstants = true; - forEach(ast.body, function(expr) { - findConstantAndWatchExpressions(expr.expression, $filter, astIsPure); - allConstants = allConstants && expr.expression.constant; - }); - ast.constant = allConstants; - break; - case AST.Literal: - ast.constant = true; - ast.toWatch = []; - break; - case AST.UnaryExpression: - findConstantAndWatchExpressions(ast.argument, $filter, astIsPure); - ast.constant = ast.argument.constant; - ast.toWatch = ast.argument.toWatch; - break; - case AST.BinaryExpression: - findConstantAndWatchExpressions(ast.left, $filter, astIsPure); - findConstantAndWatchExpressions(ast.right, $filter, astIsPure); - ast.constant = ast.left.constant && ast.right.constant; - ast.toWatch = ast.left.toWatch.concat(ast.right.toWatch); - break; - case AST.LogicalExpression: - findConstantAndWatchExpressions(ast.left, $filter, astIsPure); - findConstantAndWatchExpressions(ast.right, $filter, astIsPure); - ast.constant = ast.left.constant && ast.right.constant; - ast.toWatch = ast.constant ? [] : [ast]; - break; - case AST.ConditionalExpression: - findConstantAndWatchExpressions(ast.test, $filter, astIsPure); - findConstantAndWatchExpressions(ast.alternate, $filter, astIsPure); - findConstantAndWatchExpressions(ast.consequent, $filter, astIsPure); - ast.constant = ast.test.constant && ast.alternate.constant && ast.consequent.constant; - ast.toWatch = ast.constant ? [] : [ast]; - break; - case AST.Identifier: - ast.constant = false; - ast.toWatch = [ast]; - break; - case AST.MemberExpression: - findConstantAndWatchExpressions(ast.object, $filter, astIsPure); - if (ast.computed) { - findConstantAndWatchExpressions(ast.property, $filter, astIsPure); - } - ast.constant = ast.object.constant && (!ast.computed || ast.property.constant); - ast.toWatch = ast.constant ? [] : [ast]; - break; - case AST.CallExpression: - isStatelessFilter = ast.filter ? isStateless($filter, ast.callee.name) : false; - allConstants = isStatelessFilter; - argsToWatch = []; - forEach(ast.arguments, function(expr) { - findConstantAndWatchExpressions(expr, $filter, astIsPure); - allConstants = allConstants && expr.constant; - argsToWatch.push.apply(argsToWatch, expr.toWatch); - }); - ast.constant = allConstants; - ast.toWatch = isStatelessFilter ? argsToWatch : [ast]; - break; - case AST.AssignmentExpression: - findConstantAndWatchExpressions(ast.left, $filter, astIsPure); - findConstantAndWatchExpressions(ast.right, $filter, astIsPure); - ast.constant = ast.left.constant && ast.right.constant; - ast.toWatch = [ast]; - break; - case AST.ArrayExpression: - allConstants = true; - argsToWatch = []; - forEach(ast.elements, function(expr) { - findConstantAndWatchExpressions(expr, $filter, astIsPure); - allConstants = allConstants && expr.constant; - argsToWatch.push.apply(argsToWatch, expr.toWatch); - }); - ast.constant = allConstants; - ast.toWatch = argsToWatch; - break; - case AST.ObjectExpression: - allConstants = true; - argsToWatch = []; - forEach(ast.properties, function(property) { - findConstantAndWatchExpressions(property.value, $filter, astIsPure); - allConstants = allConstants && property.value.constant; - argsToWatch.push.apply(argsToWatch, property.value.toWatch); - if (property.computed) { - //`{[key]: value}` implicitly does `key.toString()` which may be non-pure - findConstantAndWatchExpressions(property.key, $filter, /*parentIsPure=*/false); - allConstants = allConstants && property.key.constant; - argsToWatch.push.apply(argsToWatch, property.key.toWatch); - } - }); - ast.constant = allConstants; - ast.toWatch = argsToWatch; - break; - case AST.ThisExpression: - ast.constant = false; - ast.toWatch = []; - break; - case AST.LocalsExpression: - ast.constant = false; - ast.toWatch = []; - break; - } -} - -function getInputs(body) { - if (body.length !== 1) return; - var lastExpression = body[0].expression; - var candidate = lastExpression.toWatch; - if (candidate.length !== 1) return candidate; - return candidate[0] !== lastExpression ? candidate : undefined; -} - -function isAssignable(ast) { - return ast.type === AST.Identifier || ast.type === AST.MemberExpression; -} - -function assignableAST(ast) { - if (ast.body.length === 1 && isAssignable(ast.body[0].expression)) { - return {type: AST.AssignmentExpression, left: ast.body[0].expression, right: {type: AST.NGValueParameter}, operator: '='}; - } -} - -function isLiteral(ast) { - return ast.body.length === 0 || - ast.body.length === 1 && ( - ast.body[0].expression.type === AST.Literal || - ast.body[0].expression.type === AST.ArrayExpression || - ast.body[0].expression.type === AST.ObjectExpression); -} - -function isConstant(ast) { - return ast.constant; -} - -function ASTCompiler($filter) { - this.$filter = $filter; -} - -ASTCompiler.prototype = { - compile: function(ast) { - var self = this; - this.state = { - nextId: 0, - filters: {}, - fn: {vars: [], body: [], own: {}}, - assign: {vars: [], body: [], own: {}}, - inputs: [] - }; - findConstantAndWatchExpressions(ast, self.$filter); - var extra = ''; - var assignable; - this.stage = 'assign'; - if ((assignable = assignableAST(ast))) { - this.state.computing = 'assign'; - var result = this.nextId(); - this.recurse(assignable, result); - this.return_(result); - extra = 'fn.assign=' + this.generateFunction('assign', 's,v,l'); - } - var toWatch = getInputs(ast.body); - self.stage = 'inputs'; - forEach(toWatch, function(watch, key) { - var fnKey = 'fn' + key; - self.state[fnKey] = {vars: [], body: [], own: {}}; - self.state.computing = fnKey; - var intoId = self.nextId(); - self.recurse(watch, intoId); - self.return_(intoId); - self.state.inputs.push({name: fnKey, isPure: watch.isPure}); - watch.watchId = key; - }); - this.state.computing = 'fn'; - this.stage = 'main'; - this.recurse(ast); - var fnString = - // The build and minification steps remove the string "use strict" from the code, but this is done using a regex. - // This is a workaround for this until we do a better job at only removing the prefix only when we should. - '"' + this.USE + ' ' + this.STRICT + '";\n' + - this.filterPrefix() + - 'var fn=' + this.generateFunction('fn', 's,l,a,i') + - extra + - this.watchFns() + - 'return fn;'; - - // eslint-disable-next-line no-new-func - var fn = (new Function('$filter', - 'getStringValue', - 'ifDefined', - 'plus', - fnString))( - this.$filter, - getStringValue, - ifDefined, - plusFn); - this.state = this.stage = undefined; - return fn; - }, - - USE: 'use', - - STRICT: 'strict', - - watchFns: function() { - var result = []; - var inputs = this.state.inputs; - var self = this; - forEach(inputs, function(input) { - result.push('var ' + input.name + '=' + self.generateFunction(input.name, 's')); - if (input.isPure) { - result.push(input.name, '.isPure=' + JSON.stringify(input.isPure) + ';'); - } - }); - if (inputs.length) { - result.push('fn.inputs=[' + inputs.map(function(i) { return i.name; }).join(',') + '];'); - } - return result.join(''); - }, - - generateFunction: function(name, params) { - return 'function(' + params + '){' + - this.varsPrefix(name) + - this.body(name) + - '};'; - }, - - filterPrefix: function() { - var parts = []; - var self = this; - forEach(this.state.filters, function(id, filter) { - parts.push(id + '=$filter(' + self.escape(filter) + ')'); - }); - if (parts.length) return 'var ' + parts.join(',') + ';'; - return ''; - }, - - varsPrefix: function(section) { - return this.state[section].vars.length ? 'var ' + this.state[section].vars.join(',') + ';' : ''; - }, - - body: function(section) { - return this.state[section].body.join(''); - }, - - recurse: function(ast, intoId, nameId, recursionFn, create, skipWatchIdCheck) { - var left, right, self = this, args, expression, computed; - recursionFn = recursionFn || noop; - if (!skipWatchIdCheck && isDefined(ast.watchId)) { - intoId = intoId || this.nextId(); - this.if_('i', - this.lazyAssign(intoId, this.computedMember('i', ast.watchId)), - this.lazyRecurse(ast, intoId, nameId, recursionFn, create, true) - ); - return; - } - switch (ast.type) { - case AST.Program: - forEach(ast.body, function(expression, pos) { - self.recurse(expression.expression, undefined, undefined, function(expr) { right = expr; }); - if (pos !== ast.body.length - 1) { - self.current().body.push(right, ';'); - } else { - self.return_(right); - } - }); - break; - case AST.Literal: - expression = this.escape(ast.value); - this.assign(intoId, expression); - recursionFn(intoId || expression); - break; - case AST.UnaryExpression: - this.recurse(ast.argument, undefined, undefined, function(expr) { right = expr; }); - expression = ast.operator + '(' + this.ifDefined(right, 0) + ')'; - this.assign(intoId, expression); - recursionFn(expression); - break; - case AST.BinaryExpression: - this.recurse(ast.left, undefined, undefined, function(expr) { left = expr; }); - this.recurse(ast.right, undefined, undefined, function(expr) { right = expr; }); - if (ast.operator === '+') { - expression = this.plus(left, right); - } else if (ast.operator === '-') { - expression = this.ifDefined(left, 0) + ast.operator + this.ifDefined(right, 0); - } else { - expression = '(' + left + ')' + ast.operator + '(' + right + ')'; - } - this.assign(intoId, expression); - recursionFn(expression); - break; - case AST.LogicalExpression: - intoId = intoId || this.nextId(); - self.recurse(ast.left, intoId); - self.if_(ast.operator === '&&' ? intoId : self.not(intoId), self.lazyRecurse(ast.right, intoId)); - recursionFn(intoId); - break; - case AST.ConditionalExpression: - intoId = intoId || this.nextId(); - self.recurse(ast.test, intoId); - self.if_(intoId, self.lazyRecurse(ast.alternate, intoId), self.lazyRecurse(ast.consequent, intoId)); - recursionFn(intoId); - break; - case AST.Identifier: - intoId = intoId || this.nextId(); - if (nameId) { - nameId.context = self.stage === 'inputs' ? 's' : this.assign(this.nextId(), this.getHasOwnProperty('l', ast.name) + '?l:s'); - nameId.computed = false; - nameId.name = ast.name; - } - self.if_(self.stage === 'inputs' || self.not(self.getHasOwnProperty('l', ast.name)), - function() { - self.if_(self.stage === 'inputs' || 's', function() { - if (create && create !== 1) { - self.if_( - self.isNull(self.nonComputedMember('s', ast.name)), - self.lazyAssign(self.nonComputedMember('s', ast.name), '{}')); - } - self.assign(intoId, self.nonComputedMember('s', ast.name)); - }); - }, intoId && self.lazyAssign(intoId, self.nonComputedMember('l', ast.name)) - ); - recursionFn(intoId); - break; - case AST.MemberExpression: - left = nameId && (nameId.context = this.nextId()) || this.nextId(); - intoId = intoId || this.nextId(); - self.recurse(ast.object, left, undefined, function() { - self.if_(self.notNull(left), function() { - if (ast.computed) { - right = self.nextId(); - self.recurse(ast.property, right); - self.getStringValue(right); - if (create && create !== 1) { - self.if_(self.not(self.computedMember(left, right)), self.lazyAssign(self.computedMember(left, right), '{}')); - } - expression = self.computedMember(left, right); - self.assign(intoId, expression); - if (nameId) { - nameId.computed = true; - nameId.name = right; - } - } else { - if (create && create !== 1) { - self.if_(self.isNull(self.nonComputedMember(left, ast.property.name)), self.lazyAssign(self.nonComputedMember(left, ast.property.name), '{}')); - } - expression = self.nonComputedMember(left, ast.property.name); - self.assign(intoId, expression); - if (nameId) { - nameId.computed = false; - nameId.name = ast.property.name; - } - } - }, function() { - self.assign(intoId, 'undefined'); - }); - recursionFn(intoId); - }, !!create); - break; - case AST.CallExpression: - intoId = intoId || this.nextId(); - if (ast.filter) { - right = self.filter(ast.callee.name); - args = []; - forEach(ast.arguments, function(expr) { - var argument = self.nextId(); - self.recurse(expr, argument); - args.push(argument); - }); - expression = right + '(' + args.join(',') + ')'; - self.assign(intoId, expression); - recursionFn(intoId); - } else { - right = self.nextId(); - left = {}; - args = []; - self.recurse(ast.callee, right, left, function() { - self.if_(self.notNull(right), function() { - forEach(ast.arguments, function(expr) { - self.recurse(expr, ast.constant ? undefined : self.nextId(), undefined, function(argument) { - args.push(argument); - }); - }); - if (left.name) { - expression = self.member(left.context, left.name, left.computed) + '(' + args.join(',') + ')'; - } else { - expression = right + '(' + args.join(',') + ')'; - } - self.assign(intoId, expression); - }, function() { - self.assign(intoId, 'undefined'); - }); - recursionFn(intoId); - }); - } - break; - case AST.AssignmentExpression: - right = this.nextId(); - left = {}; - this.recurse(ast.left, undefined, left, function() { - self.if_(self.notNull(left.context), function() { - self.recurse(ast.right, right); - expression = self.member(left.context, left.name, left.computed) + ast.operator + right; - self.assign(intoId, expression); - recursionFn(intoId || expression); - }); - }, 1); - break; - case AST.ArrayExpression: - args = []; - forEach(ast.elements, function(expr) { - self.recurse(expr, ast.constant ? undefined : self.nextId(), undefined, function(argument) { - args.push(argument); - }); - }); - expression = '[' + args.join(',') + ']'; - this.assign(intoId, expression); - recursionFn(intoId || expression); - break; - case AST.ObjectExpression: - args = []; - computed = false; - forEach(ast.properties, function(property) { - if (property.computed) { - computed = true; - } - }); - if (computed) { - intoId = intoId || this.nextId(); - this.assign(intoId, '{}'); - forEach(ast.properties, function(property) { - if (property.computed) { - left = self.nextId(); - self.recurse(property.key, left); - } else { - left = property.key.type === AST.Identifier ? - property.key.name : - ('' + property.key.value); - } - right = self.nextId(); - self.recurse(property.value, right); - self.assign(self.member(intoId, left, property.computed), right); - }); - } else { - forEach(ast.properties, function(property) { - self.recurse(property.value, ast.constant ? undefined : self.nextId(), undefined, function(expr) { - args.push(self.escape( - property.key.type === AST.Identifier ? property.key.name : - ('' + property.key.value)) + - ':' + expr); - }); - }); - expression = '{' + args.join(',') + '}'; - this.assign(intoId, expression); - } - recursionFn(intoId || expression); - break; - case AST.ThisExpression: - this.assign(intoId, 's'); - recursionFn(intoId || 's'); - break; - case AST.LocalsExpression: - this.assign(intoId, 'l'); - recursionFn(intoId || 'l'); - break; - case AST.NGValueParameter: - this.assign(intoId, 'v'); - recursionFn(intoId || 'v'); - break; - } - }, - - getHasOwnProperty: function(element, property) { - var key = element + '.' + property; - var own = this.current().own; - if (!own.hasOwnProperty(key)) { - own[key] = this.nextId(false, element + '&&(' + this.escape(property) + ' in ' + element + ')'); - } - return own[key]; - }, - - assign: function(id, value) { - if (!id) return; - this.current().body.push(id, '=', value, ';'); - return id; - }, - - filter: function(filterName) { - if (!this.state.filters.hasOwnProperty(filterName)) { - this.state.filters[filterName] = this.nextId(true); - } - return this.state.filters[filterName]; - }, - - ifDefined: function(id, defaultValue) { - return 'ifDefined(' + id + ',' + this.escape(defaultValue) + ')'; - }, - - plus: function(left, right) { - return 'plus(' + left + ',' + right + ')'; - }, - - return_: function(id) { - this.current().body.push('return ', id, ';'); - }, - - if_: function(test, alternate, consequent) { - if (test === true) { - alternate(); - } else { - var body = this.current().body; - body.push('if(', test, '){'); - alternate(); - body.push('}'); - if (consequent) { - body.push('else{'); - consequent(); - body.push('}'); - } - } - }, - - not: function(expression) { - return '!(' + expression + ')'; - }, - - isNull: function(expression) { - return expression + '==null'; - }, - - notNull: function(expression) { - return expression + '!=null'; - }, - - nonComputedMember: function(left, right) { - var SAFE_IDENTIFIER = /^[$_a-zA-Z][$_a-zA-Z0-9]*$/; - var UNSAFE_CHARACTERS = /[^$_a-zA-Z0-9]/g; - if (SAFE_IDENTIFIER.test(right)) { - return left + '.' + right; - } else { - return left + '["' + right.replace(UNSAFE_CHARACTERS, this.stringEscapeFn) + '"]'; - } - }, - - computedMember: function(left, right) { - return left + '[' + right + ']'; - }, - - member: function(left, right, computed) { - if (computed) return this.computedMember(left, right); - return this.nonComputedMember(left, right); - }, - - getStringValue: function(item) { - this.assign(item, 'getStringValue(' + item + ')'); - }, - - lazyRecurse: function(ast, intoId, nameId, recursionFn, create, skipWatchIdCheck) { - var self = this; - return function() { - self.recurse(ast, intoId, nameId, recursionFn, create, skipWatchIdCheck); - }; - }, - - lazyAssign: function(id, value) { - var self = this; - return function() { - self.assign(id, value); - }; - }, - - stringEscapeRegex: /[^ a-zA-Z0-9]/g, - - stringEscapeFn: function(c) { - return '\\u' + ('0000' + c.charCodeAt(0).toString(16)).slice(-4); - }, - - escape: function(value) { - if (isString(value)) return '\'' + value.replace(this.stringEscapeRegex, this.stringEscapeFn) + '\''; - if (isNumber(value)) return value.toString(); - if (value === true) return 'true'; - if (value === false) return 'false'; - if (value === null) return 'null'; - if (typeof value === 'undefined') return 'undefined'; - - throw $parseMinErr('esc', 'IMPOSSIBLE'); - }, - - nextId: function(skip, init) { - var id = 'v' + (this.state.nextId++); - if (!skip) { - this.current().vars.push(id + (init ? '=' + init : '')); - } - return id; - }, - - current: function() { - return this.state[this.state.computing]; - } -}; - - -function ASTInterpreter($filter) { - this.$filter = $filter; -} - -ASTInterpreter.prototype = { - compile: function(ast) { - var self = this; - findConstantAndWatchExpressions(ast, self.$filter); - var assignable; - var assign; - if ((assignable = assignableAST(ast))) { - assign = this.recurse(assignable); - } - var toWatch = getInputs(ast.body); - var inputs; - if (toWatch) { - inputs = []; - forEach(toWatch, function(watch, key) { - var input = self.recurse(watch); - input.isPure = watch.isPure; - watch.input = input; - inputs.push(input); - watch.watchId = key; - }); - } - var expressions = []; - forEach(ast.body, function(expression) { - expressions.push(self.recurse(expression.expression)); - }); - var fn = ast.body.length === 0 ? noop : - ast.body.length === 1 ? expressions[0] : - function(scope, locals) { - var lastValue; - forEach(expressions, function(exp) { - lastValue = exp(scope, locals); - }); - return lastValue; - }; - if (assign) { - fn.assign = function(scope, value, locals) { - return assign(scope, locals, value); - }; - } - if (inputs) { - fn.inputs = inputs; - } - return fn; - }, - - recurse: function(ast, context, create) { - var left, right, self = this, args; - if (ast.input) { - return this.inputs(ast.input, ast.watchId); - } - switch (ast.type) { - case AST.Literal: - return this.value(ast.value, context); - case AST.UnaryExpression: - right = this.recurse(ast.argument); - return this['unary' + ast.operator](right, context); - case AST.BinaryExpression: - left = this.recurse(ast.left); - right = this.recurse(ast.right); - return this['binary' + ast.operator](left, right, context); - case AST.LogicalExpression: - left = this.recurse(ast.left); - right = this.recurse(ast.right); - return this['binary' + ast.operator](left, right, context); - case AST.ConditionalExpression: - return this['ternary?:']( - this.recurse(ast.test), - this.recurse(ast.alternate), - this.recurse(ast.consequent), - context - ); - case AST.Identifier: - return self.identifier(ast.name, context, create); - case AST.MemberExpression: - left = this.recurse(ast.object, false, !!create); - if (!ast.computed) { - right = ast.property.name; - } - if (ast.computed) right = this.recurse(ast.property); - return ast.computed ? - this.computedMember(left, right, context, create) : - this.nonComputedMember(left, right, context, create); - case AST.CallExpression: - args = []; - forEach(ast.arguments, function(expr) { - args.push(self.recurse(expr)); - }); - if (ast.filter) right = this.$filter(ast.callee.name); - if (!ast.filter) right = this.recurse(ast.callee, true); - return ast.filter ? - function(scope, locals, assign, inputs) { - var values = []; - for (var i = 0; i < args.length; ++i) { - values.push(args[i](scope, locals, assign, inputs)); - } - var value = right.apply(undefined, values, inputs); - return context ? {context: undefined, name: undefined, value: value} : value; - } : - function(scope, locals, assign, inputs) { - var rhs = right(scope, locals, assign, inputs); - var value; - if (rhs.value != null) { - var values = []; - for (var i = 0; i < args.length; ++i) { - values.push(args[i](scope, locals, assign, inputs)); - } - value = rhs.value.apply(rhs.context, values); - } - return context ? {value: value} : value; - }; - case AST.AssignmentExpression: - left = this.recurse(ast.left, true, 1); - right = this.recurse(ast.right); - return function(scope, locals, assign, inputs) { - var lhs = left(scope, locals, assign, inputs); - var rhs = right(scope, locals, assign, inputs); - lhs.context[lhs.name] = rhs; - return context ? {value: rhs} : rhs; - }; - case AST.ArrayExpression: - args = []; - forEach(ast.elements, function(expr) { - args.push(self.recurse(expr)); - }); - return function(scope, locals, assign, inputs) { - var value = []; - for (var i = 0; i < args.length; ++i) { - value.push(args[i](scope, locals, assign, inputs)); - } - return context ? {value: value} : value; - }; - case AST.ObjectExpression: - args = []; - forEach(ast.properties, function(property) { - if (property.computed) { - args.push({key: self.recurse(property.key), - computed: true, - value: self.recurse(property.value) - }); - } else { - args.push({key: property.key.type === AST.Identifier ? - property.key.name : - ('' + property.key.value), - computed: false, - value: self.recurse(property.value) - }); - } - }); - return function(scope, locals, assign, inputs) { - var value = {}; - for (var i = 0; i < args.length; ++i) { - if (args[i].computed) { - value[args[i].key(scope, locals, assign, inputs)] = args[i].value(scope, locals, assign, inputs); - } else { - value[args[i].key] = args[i].value(scope, locals, assign, inputs); - } - } - return context ? {value: value} : value; - }; - case AST.ThisExpression: - return function(scope) { - return context ? {value: scope} : scope; - }; - case AST.LocalsExpression: - return function(scope, locals) { - return context ? {value: locals} : locals; - }; - case AST.NGValueParameter: - return function(scope, locals, assign) { - return context ? {value: assign} : assign; - }; - } - }, - - 'unary+': function(argument, context) { - return function(scope, locals, assign, inputs) { - var arg = argument(scope, locals, assign, inputs); - if (isDefined(arg)) { - arg = +arg; - } else { - arg = 0; - } - return context ? {value: arg} : arg; - }; - }, - 'unary-': function(argument, context) { - return function(scope, locals, assign, inputs) { - var arg = argument(scope, locals, assign, inputs); - if (isDefined(arg)) { - arg = -arg; - } else { - arg = -0; - } - return context ? {value: arg} : arg; - }; - }, - 'unary!': function(argument, context) { - return function(scope, locals, assign, inputs) { - var arg = !argument(scope, locals, assign, inputs); - return context ? {value: arg} : arg; - }; - }, - 'binary+': function(left, right, context) { - return function(scope, locals, assign, inputs) { - var lhs = left(scope, locals, assign, inputs); - var rhs = right(scope, locals, assign, inputs); - var arg = plusFn(lhs, rhs); - return context ? {value: arg} : arg; - }; - }, - 'binary-': function(left, right, context) { - return function(scope, locals, assign, inputs) { - var lhs = left(scope, locals, assign, inputs); - var rhs = right(scope, locals, assign, inputs); - var arg = (isDefined(lhs) ? lhs : 0) - (isDefined(rhs) ? rhs : 0); - return context ? {value: arg} : arg; - }; - }, - 'binary*': function(left, right, context) { - return function(scope, locals, assign, inputs) { - var arg = left(scope, locals, assign, inputs) * right(scope, locals, assign, inputs); - return context ? {value: arg} : arg; - }; - }, - 'binary/': function(left, right, context) { - return function(scope, locals, assign, inputs) { - var arg = left(scope, locals, assign, inputs) / right(scope, locals, assign, inputs); - return context ? {value: arg} : arg; - }; - }, - 'binary%': function(left, right, context) { - return function(scope, locals, assign, inputs) { - var arg = left(scope, locals, assign, inputs) % right(scope, locals, assign, inputs); - return context ? {value: arg} : arg; - }; - }, - 'binary===': function(left, right, context) { - return function(scope, locals, assign, inputs) { - var arg = left(scope, locals, assign, inputs) === right(scope, locals, assign, inputs); - return context ? {value: arg} : arg; - }; - }, - 'binary!==': function(left, right, context) { - return function(scope, locals, assign, inputs) { - var arg = left(scope, locals, assign, inputs) !== right(scope, locals, assign, inputs); - return context ? {value: arg} : arg; - }; - }, - 'binary==': function(left, right, context) { - return function(scope, locals, assign, inputs) { - // eslint-disable-next-line eqeqeq - var arg = left(scope, locals, assign, inputs) == right(scope, locals, assign, inputs); - return context ? {value: arg} : arg; - }; - }, - 'binary!=': function(left, right, context) { - return function(scope, locals, assign, inputs) { - // eslint-disable-next-line eqeqeq - var arg = left(scope, locals, assign, inputs) != right(scope, locals, assign, inputs); - return context ? {value: arg} : arg; - }; - }, - 'binary<': function(left, right, context) { - return function(scope, locals, assign, inputs) { - var arg = left(scope, locals, assign, inputs) < right(scope, locals, assign, inputs); - return context ? {value: arg} : arg; - }; - }, - 'binary>': function(left, right, context) { - return function(scope, locals, assign, inputs) { - var arg = left(scope, locals, assign, inputs) > right(scope, locals, assign, inputs); - return context ? {value: arg} : arg; - }; - }, - 'binary<=': function(left, right, context) { - return function(scope, locals, assign, inputs) { - var arg = left(scope, locals, assign, inputs) <= right(scope, locals, assign, inputs); - return context ? {value: arg} : arg; - }; - }, - 'binary>=': function(left, right, context) { - return function(scope, locals, assign, inputs) { - var arg = left(scope, locals, assign, inputs) >= right(scope, locals, assign, inputs); - return context ? {value: arg} : arg; - }; - }, - 'binary&&': function(left, right, context) { - return function(scope, locals, assign, inputs) { - var arg = left(scope, locals, assign, inputs) && right(scope, locals, assign, inputs); - return context ? {value: arg} : arg; - }; - }, - 'binary||': function(left, right, context) { - return function(scope, locals, assign, inputs) { - var arg = left(scope, locals, assign, inputs) || right(scope, locals, assign, inputs); - return context ? {value: arg} : arg; - }; - }, - 'ternary?:': function(test, alternate, consequent, context) { - return function(scope, locals, assign, inputs) { - var arg = test(scope, locals, assign, inputs) ? alternate(scope, locals, assign, inputs) : consequent(scope, locals, assign, inputs); - return context ? {value: arg} : arg; - }; - }, - value: function(value, context) { - return function() { return context ? {context: undefined, name: undefined, value: value} : value; }; - }, - identifier: function(name, context, create) { - return function(scope, locals, assign, inputs) { - var base = locals && (name in locals) ? locals : scope; - if (create && create !== 1 && base && base[name] == null) { - base[name] = {}; - } - var value = base ? base[name] : undefined; - if (context) { - return {context: base, name: name, value: value}; - } else { - return value; - } - }; - }, - computedMember: function(left, right, context, create) { - return function(scope, locals, assign, inputs) { - var lhs = left(scope, locals, assign, inputs); - var rhs; - var value; - if (lhs != null) { - rhs = right(scope, locals, assign, inputs); - rhs = getStringValue(rhs); - if (create && create !== 1) { - if (lhs && !(lhs[rhs])) { - lhs[rhs] = {}; - } - } - value = lhs[rhs]; - } - if (context) { - return {context: lhs, name: rhs, value: value}; - } else { - return value; - } - }; - }, - nonComputedMember: function(left, right, context, create) { - return function(scope, locals, assign, inputs) { - var lhs = left(scope, locals, assign, inputs); - if (create && create !== 1) { - if (lhs && lhs[right] == null) { - lhs[right] = {}; - } - } - var value = lhs != null ? lhs[right] : undefined; - if (context) { - return {context: lhs, name: right, value: value}; - } else { - return value; - } - }; - }, - inputs: function(input, watchId) { - return function(scope, value, locals, inputs) { - if (inputs) return inputs[watchId]; - return input(scope, value, locals); - }; - } -}; - -/** - * @constructor - */ -function Parser(lexer, $filter, options) { - this.ast = new AST(lexer, options); - this.astCompiler = options.csp ? new ASTInterpreter($filter) : - new ASTCompiler($filter); -} - -Parser.prototype = { - constructor: Parser, - - parse: function(text) { - var ast = this.getAst(text); - var fn = this.astCompiler.compile(ast.ast); - fn.literal = isLiteral(ast.ast); - fn.constant = isConstant(ast.ast); - fn.oneTime = ast.oneTime; - return fn; - }, - - getAst: function(exp) { - var oneTime = false; - exp = exp.trim(); - - if (exp.charAt(0) === ':' && exp.charAt(1) === ':') { - oneTime = true; - exp = exp.substring(2); - } - return { - ast: this.ast.ast(exp), - oneTime: oneTime - }; - } -}; - -function getValueOf(value) { - return isFunction(value.valueOf) ? value.valueOf() : objectValueOf.call(value); -} - -/////////////////////////////////// - -/** - * @ngdoc service - * @name $parse - * @kind function - * - * @description - * - * Converts AngularJS {@link guide/expression expression} into a function. - * - * ```js - * var getter = $parse('user.name'); - * var setter = getter.assign; - * var context = {user:{name:'AngularJS'}}; - * var locals = {user:{name:'local'}}; - * - * expect(getter(context)).toEqual('AngularJS'); - * setter(context, 'newValue'); - * expect(context.user.name).toEqual('newValue'); - * expect(getter(context, locals)).toEqual('local'); - * ``` - * - * - * @param {string} expression String expression to compile. - * @returns {function(context, locals)} a function which represents the compiled expression: - * - * * `context` – `{object}` – an object against which any expressions embedded in the strings - * are evaluated against (typically a scope object). - * * `locals` – `{object=}` – local variables context object, useful for overriding values in - * `context`. - * - * The returned function also has the following properties: - * * `literal` – `{boolean}` – whether the expression's top-level node is a JavaScript - * literal. - * * `constant` – `{boolean}` – whether the expression is made entirely of JavaScript - * constant literals. - * * `assign` – `{?function(context, value)}` – if the expression is assignable, this will be - * set to a function to change its value on the given context. - * - */ - - -/** - * @ngdoc provider - * @name $parseProvider - * @this - * - * @description - * `$parseProvider` can be used for configuring the default behavior of the {@link ng.$parse $parse} - * service. - */ -function $ParseProvider() { - var cache = createMap(); - var literals = { - 'true': true, - 'false': false, - 'null': null, - 'undefined': undefined - }; - var identStart, identContinue; - - /** - * @ngdoc method - * @name $parseProvider#addLiteral - * @description - * - * Configure $parse service to add literal values that will be present as literal at expressions. - * - * @param {string} literalName Token for the literal value. The literal name value must be a valid literal name. - * @param {*} literalValue Value for this literal. All literal values must be primitives or `undefined`. - * - **/ - this.addLiteral = function(literalName, literalValue) { - literals[literalName] = literalValue; - }; - - /** - * @ngdoc method - * @name $parseProvider#setIdentifierFns - * - * @description - * - * Allows defining the set of characters that are allowed in AngularJS expressions. The function - * `identifierStart` will get called to know if a given character is a valid character to be the - * first character for an identifier. The function `identifierContinue` will get called to know if - * a given character is a valid character to be a follow-up identifier character. The functions - * `identifierStart` and `identifierContinue` will receive as arguments the single character to be - * identifier and the character code point. These arguments will be `string` and `numeric`. Keep in - * mind that the `string` parameter can be two characters long depending on the character - * representation. It is expected for the function to return `true` or `false`, whether that - * character is allowed or not. - * - * Since this function will be called extensively, keep the implementation of these functions fast, - * as the performance of these functions have a direct impact on the expressions parsing speed. - * - * @param {function=} identifierStart The function that will decide whether the given character is - * a valid identifier start character. - * @param {function=} identifierContinue The function that will decide whether the given character is - * a valid identifier continue character. - */ - this.setIdentifierFns = function(identifierStart, identifierContinue) { - identStart = identifierStart; - identContinue = identifierContinue; - return this; - }; - - this.$get = ['$filter', function($filter) { - var noUnsafeEval = csp().noUnsafeEval; - var $parseOptions = { - csp: noUnsafeEval, - literals: copy(literals), - isIdentifierStart: isFunction(identStart) && identStart, - isIdentifierContinue: isFunction(identContinue) && identContinue - }; - $parse.$$getAst = $$getAst; - return $parse; - - function $parse(exp, interceptorFn) { - var parsedExpression, cacheKey; - - switch (typeof exp) { - case 'string': - exp = exp.trim(); - cacheKey = exp; - - parsedExpression = cache[cacheKey]; - - if (!parsedExpression) { - var lexer = new Lexer($parseOptions); - var parser = new Parser(lexer, $filter, $parseOptions); - parsedExpression = parser.parse(exp); - - cache[cacheKey] = addWatchDelegate(parsedExpression); - } - return addInterceptor(parsedExpression, interceptorFn); - - case 'function': - return addInterceptor(exp, interceptorFn); - - default: - return addInterceptor(noop, interceptorFn); - } - } - - function $$getAst(exp) { - var lexer = new Lexer($parseOptions); - var parser = new Parser(lexer, $filter, $parseOptions); - return parser.getAst(exp).ast; - } - - function expressionInputDirtyCheck(newValue, oldValueOfValue, compareObjectIdentity) { - - if (newValue == null || oldValueOfValue == null) { // null/undefined - return newValue === oldValueOfValue; - } - - if (typeof newValue === 'object') { - - // attempt to convert the value to a primitive type - // TODO(docs): add a note to docs that by implementing valueOf even objects and arrays can - // be cheaply dirty-checked - newValue = getValueOf(newValue); - - if (typeof newValue === 'object' && !compareObjectIdentity) { - // objects/arrays are not supported - deep-watching them would be too expensive - return false; - } - - // fall-through to the primitive equality check - } - - //Primitive or NaN - // eslint-disable-next-line no-self-compare - return newValue === oldValueOfValue || (newValue !== newValue && oldValueOfValue !== oldValueOfValue); - } - - function inputsWatchDelegate(scope, listener, objectEquality, parsedExpression, prettyPrintExpression) { - var inputExpressions = parsedExpression.inputs; - var lastResult; - - if (inputExpressions.length === 1) { - var oldInputValueOf = expressionInputDirtyCheck; // init to something unique so that equals check fails - inputExpressions = inputExpressions[0]; - return scope.$watch(function expressionInputWatch(scope) { - var newInputValue = inputExpressions(scope); - if (!expressionInputDirtyCheck(newInputValue, oldInputValueOf, inputExpressions.isPure)) { - lastResult = parsedExpression(scope, undefined, undefined, [newInputValue]); - oldInputValueOf = newInputValue && getValueOf(newInputValue); - } - return lastResult; - }, listener, objectEquality, prettyPrintExpression); - } - - var oldInputValueOfValues = []; - var oldInputValues = []; - for (var i = 0, ii = inputExpressions.length; i < ii; i++) { - oldInputValueOfValues[i] = expressionInputDirtyCheck; // init to something unique so that equals check fails - oldInputValues[i] = null; - } - - return scope.$watch(function expressionInputsWatch(scope) { - var changed = false; - - for (var i = 0, ii = inputExpressions.length; i < ii; i++) { - var newInputValue = inputExpressions[i](scope); - if (changed || (changed = !expressionInputDirtyCheck(newInputValue, oldInputValueOfValues[i], inputExpressions[i].isPure))) { - oldInputValues[i] = newInputValue; - oldInputValueOfValues[i] = newInputValue && getValueOf(newInputValue); - } - } - - if (changed) { - lastResult = parsedExpression(scope, undefined, undefined, oldInputValues); - } - - return lastResult; - }, listener, objectEquality, prettyPrintExpression); - } - - function oneTimeWatchDelegate(scope, listener, objectEquality, parsedExpression, prettyPrintExpression) { - var isDone = parsedExpression.literal ? isAllDefined : isDefined; - var unwatch, lastValue; - - var exp = parsedExpression.$$intercepted || parsedExpression; - var post = parsedExpression.$$interceptor || identity; - - var useInputs = parsedExpression.inputs && !exp.inputs; - - // Propogate the literal/inputs/constant attributes - // ... but not oneTime since we are handling it - oneTimeWatch.literal = parsedExpression.literal; - oneTimeWatch.constant = parsedExpression.constant; - oneTimeWatch.inputs = parsedExpression.inputs; - - // Allow other delegates to run on this wrapped expression - addWatchDelegate(oneTimeWatch); - - unwatch = scope.$watch(oneTimeWatch, listener, objectEquality, prettyPrintExpression); - - return unwatch; - - function unwatchIfDone() { - if (isDone(lastValue)) { - unwatch(); - } - } - - function oneTimeWatch(scope, locals, assign, inputs) { - lastValue = useInputs && inputs ? inputs[0] : exp(scope, locals, assign, inputs); - if (isDone(lastValue)) { - scope.$$postDigest(unwatchIfDone); - } - return post(lastValue); - } - } - - function isAllDefined(value) { - var allDefined = true; - forEach(value, function(val) { - if (!isDefined(val)) allDefined = false; - }); - return allDefined; - } - - function constantWatchDelegate(scope, listener, objectEquality, parsedExpression) { - var unwatch = scope.$watch(function constantWatch(scope) { - unwatch(); - return parsedExpression(scope); - }, listener, objectEquality); - return unwatch; - } - - function addWatchDelegate(parsedExpression) { - if (parsedExpression.constant) { - parsedExpression.$$watchDelegate = constantWatchDelegate; - } else if (parsedExpression.oneTime) { - parsedExpression.$$watchDelegate = oneTimeWatchDelegate; - } else if (parsedExpression.inputs) { - parsedExpression.$$watchDelegate = inputsWatchDelegate; - } - - return parsedExpression; - } - - function chainInterceptors(first, second) { - function chainedInterceptor(value) { - return second(first(value)); - } - chainedInterceptor.$stateful = first.$stateful || second.$stateful; - chainedInterceptor.$$pure = first.$$pure && second.$$pure; - - return chainedInterceptor; - } - - function addInterceptor(parsedExpression, interceptorFn) { - if (!interceptorFn) return parsedExpression; - - // Extract any existing interceptors out of the parsedExpression - // to ensure the original parsedExpression is always the $$intercepted - if (parsedExpression.$$interceptor) { - interceptorFn = chainInterceptors(parsedExpression.$$interceptor, interceptorFn); - parsedExpression = parsedExpression.$$intercepted; - } - - var useInputs = false; - - var fn = function interceptedExpression(scope, locals, assign, inputs) { - var value = useInputs && inputs ? inputs[0] : parsedExpression(scope, locals, assign, inputs); - return interceptorFn(value); - }; - - // Maintain references to the interceptor/intercepted - fn.$$intercepted = parsedExpression; - fn.$$interceptor = interceptorFn; - - // Propogate the literal/oneTime/constant attributes - fn.literal = parsedExpression.literal; - fn.oneTime = parsedExpression.oneTime; - fn.constant = parsedExpression.constant; - - // Treat the interceptor like filters. - // If it is not $stateful then only watch its inputs. - // If the expression itself has no inputs then use the full expression as an input. - if (!interceptorFn.$stateful) { - useInputs = !parsedExpression.inputs; - fn.inputs = parsedExpression.inputs ? parsedExpression.inputs : [parsedExpression]; - - if (!interceptorFn.$$pure) { - fn.inputs = fn.inputs.map(function(e) { - // Remove the isPure flag of inputs when it is not absolute because they are now wrapped in a - // non-pure interceptor function. - if (e.isPure === PURITY_RELATIVE) { - return function depurifier(s) { return e(s); }; - } - return e; - }); - } - } - - return addWatchDelegate(fn); - } - }]; -} - -/** - * @ngdoc service - * @name $q - * @requires $rootScope - * - * @description - * A service that helps you run functions asynchronously, and use their return values (or exceptions) - * when they are done processing. - * - * This is a [Promises/A+](https://promisesaplus.com/)-compliant implementation of promises/deferred - * objects inspired by [Kris Kowal's Q](https://github.com/kriskowal/q). - * - * $q can be used in two fashions --- one which is more similar to Kris Kowal's Q or jQuery's Deferred - * implementations, and the other which resembles ES6 (ES2015) promises to some degree. - * - * ## $q constructor - * - * The streamlined ES6 style promise is essentially just using $q as a constructor which takes a `resolver` - * function as the first argument. This is similar to the native Promise implementation from ES6, - * see [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise). - * - * While the constructor-style use is supported, not all of the supporting methods from ES6 promises are - * available yet. - * - * It can be used like so: - * - * ```js - * // for the purpose of this example let's assume that variables `$q` and `okToGreet` - * // are available in the current lexical scope (they could have been injected or passed in). - * - * function asyncGreet(name) { - * // perform some asynchronous operation, resolve or reject the promise when appropriate. - * return $q(function(resolve, reject) { - * setTimeout(function() { - * if (okToGreet(name)) { - * resolve('Hello, ' + name + '!'); - * } else { - * reject('Greeting ' + name + ' is not allowed.'); - * } - * }, 1000); - * }); - * } - * - * var promise = asyncGreet('Robin Hood'); - * promise.then(function(greeting) { - * alert('Success: ' + greeting); - * }, function(reason) { - * alert('Failed: ' + reason); - * }); - * ``` - * - * Note: progress/notify callbacks are not currently supported via the ES6-style interface. - * - * Note: unlike ES6 behavior, an exception thrown in the constructor function will NOT implicitly reject the promise. - * - * However, the more traditional CommonJS-style usage is still available, and documented below. - * - * [The CommonJS Promise proposal](http://wiki.commonjs.org/wiki/Promises) describes a promise as an - * interface for interacting with an object that represents the result of an action that is - * performed asynchronously, and may or may not be finished at any given point in time. - * - * From the perspective of dealing with error handling, deferred and promise APIs are to - * asynchronous programming what `try`, `catch` and `throw` keywords are to synchronous programming. - * - * ```js - * // for the purpose of this example let's assume that variables `$q` and `okToGreet` - * // are available in the current lexical scope (they could have been injected or passed in). - * - * function asyncGreet(name) { - * var deferred = $q.defer(); - * - * setTimeout(function() { - * deferred.notify('About to greet ' + name + '.'); - * - * if (okToGreet(name)) { - * deferred.resolve('Hello, ' + name + '!'); - * } else { - * deferred.reject('Greeting ' + name + ' is not allowed.'); - * } - * }, 1000); - * - * return deferred.promise; - * } - * - * var promise = asyncGreet('Robin Hood'); - * promise.then(function(greeting) { - * alert('Success: ' + greeting); - * }, function(reason) { - * alert('Failed: ' + reason); - * }, function(update) { - * alert('Got notification: ' + update); - * }); - * ``` - * - * At first it might not be obvious why this extra complexity is worth the trouble. The payoff - * comes in the way of guarantees that promise and deferred APIs make, see - * https://github.com/kriskowal/uncommonjs/blob/master/promises/specification.md. - * - * Additionally the promise api allows for composition that is very hard to do with the - * traditional callback ([CPS](http://en.wikipedia.org/wiki/Continuation-passing_style)) approach. - * For more on this please see the [Q documentation](https://github.com/kriskowal/q) especially the - * section on serial or parallel joining of promises. - * - * ## The Deferred API - * - * A new instance of deferred is constructed by calling `$q.defer()`. - * - * The purpose of the deferred object is to expose the associated Promise instance as well as APIs - * that can be used for signaling the successful or unsuccessful completion, as well as the status - * of the task. - * - * **Methods** - * - * - `resolve(value)` – resolves the derived promise with the `value`. If the value is a rejection - * constructed via `$q.reject`, the promise will be rejected instead. - * - `reject(reason)` – rejects the derived promise with the `reason`. This is equivalent to - * resolving it with a rejection constructed via `$q.reject`. - * - `notify(value)` - provides updates on the status of the promise's execution. This may be called - * multiple times before the promise is either resolved or rejected. - * - * **Properties** - * - * - promise – `{Promise}` – promise object associated with this deferred. - * - * - * ## The Promise API - * - * A new promise instance is created when a deferred instance is created and can be retrieved by - * calling `deferred.promise`. - * - * The purpose of the promise object is to allow for interested parties to get access to the result - * of the deferred task when it completes. - * - * **Methods** - * - * - `then(successCallback, [errorCallback], [notifyCallback])` – regardless of when the promise was or - * will be resolved or rejected, `then` calls one of the success or error callbacks asynchronously - * as soon as the result is available. The callbacks are called with a single argument: the result - * or rejection reason. Additionally, the notify callback may be called zero or more times to - * provide a progress indication, before the promise is resolved or rejected. - * - * This method *returns a new promise* which is resolved or rejected via the return value of the - * `successCallback`, `errorCallback` (unless that value is a promise, in which case it is resolved - * with the value which is resolved in that promise using - * [promise chaining](http://www.html5rocks.com/en/tutorials/es6/promises/#toc-promises-queues)). - * It also notifies via the return value of the `notifyCallback` method. The promise cannot be - * resolved or rejected from the notifyCallback method. The errorCallback and notifyCallback - * arguments are optional. - * - * - `catch(errorCallback)` – shorthand for `promise.then(null, errorCallback)` - * - * - `finally(callback, notifyCallback)` – allows you to observe either the fulfillment or rejection of a promise, - * but to do so without modifying the final value. This is useful to release resources or do some - * clean-up that needs to be done whether the promise was rejected or resolved. See the [full - * specification](https://github.com/kriskowal/q/wiki/API-Reference#promisefinallycallback) for - * more information. - * - * ## Chaining promises - * - * Because calling the `then` method of a promise returns a new derived promise, it is easily - * possible to create a chain of promises: - * - * ```js - * promiseB = promiseA.then(function(result) { - * return result + 1; - * }); - * - * // promiseB will be resolved immediately after promiseA is resolved and its value - * // will be the result of promiseA incremented by 1 - * ``` - * - * It is possible to create chains of any length and since a promise can be resolved with another - * promise (which will defer its resolution further), it is possible to pause/defer resolution of - * the promises at any point in the chain. This makes it possible to implement powerful APIs like - * $http's response interceptors. - * - * - * ## Differences between Kris Kowal's Q and $q - * - * There are two main differences: - * - * - $q is integrated with the {@link ng.$rootScope.Scope} Scope model observation - * mechanism in AngularJS, which means faster propagation of resolution or rejection into your - * models and avoiding unnecessary browser repaints, which would result in flickering UI. - * - Q has many more features than $q, but that comes at a cost of bytes. $q is tiny, but contains - * all the important functionality needed for common async tasks. - * - * ## Testing - * - * ```js - * it('should simulate promise', inject(function($q, $rootScope) { - * var deferred = $q.defer(); - * var promise = deferred.promise; - * var resolvedValue; - * - * promise.then(function(value) { resolvedValue = value; }); - * expect(resolvedValue).toBeUndefined(); - * - * // Simulate resolving of promise - * deferred.resolve(123); - * // Note that the 'then' function does not get called synchronously. - * // This is because we want the promise API to always be async, whether or not - * // it got called synchronously or asynchronously. - * expect(resolvedValue).toBeUndefined(); - * - * // Propagate promise resolution to 'then' functions using $apply(). - * $rootScope.$apply(); - * expect(resolvedValue).toEqual(123); - * })); - * ``` - * - * @param {function(function, function)} resolver Function which is responsible for resolving or - * rejecting the newly created promise. The first parameter is a function which resolves the - * promise, the second parameter is a function which rejects the promise. - * - * @returns {Promise} The newly created promise. - */ -/** - * @ngdoc provider - * @name $qProvider - * @this - * - * @description - */ -function $QProvider() { - var errorOnUnhandledRejections = true; - this.$get = ['$rootScope', '$exceptionHandler', function($rootScope, $exceptionHandler) { - return qFactory(function(callback) { - $rootScope.$evalAsync(callback); - }, $exceptionHandler, errorOnUnhandledRejections); - }]; - - /** - * @ngdoc method - * @name $qProvider#errorOnUnhandledRejections - * @kind function - * - * @description - * Retrieves or overrides whether to generate an error when a rejected promise is not handled. - * This feature is enabled by default. - * - * @param {boolean=} value Whether to generate an error when a rejected promise is not handled. - * @returns {boolean|ng.$qProvider} Current value when called without a new value or self for - * chaining otherwise. - */ - this.errorOnUnhandledRejections = function(value) { - if (isDefined(value)) { - errorOnUnhandledRejections = value; - return this; - } else { - return errorOnUnhandledRejections; - } - }; -} - -/** @this */ -function $$QProvider() { - var errorOnUnhandledRejections = true; - this.$get = ['$browser', '$exceptionHandler', function($browser, $exceptionHandler) { - return qFactory(function(callback) { - $browser.defer(callback); - }, $exceptionHandler, errorOnUnhandledRejections); - }]; - - this.errorOnUnhandledRejections = function(value) { - if (isDefined(value)) { - errorOnUnhandledRejections = value; - return this; - } else { - return errorOnUnhandledRejections; - } - }; -} - -/** - * Constructs a promise manager. - * - * @param {function(function)} nextTick Function for executing functions in the next turn. - * @param {function(...*)} exceptionHandler Function into which unexpected exceptions are passed for - * debugging purposes. - * @param {boolean=} errorOnUnhandledRejections Whether an error should be generated on unhandled - * promises rejections. - * @returns {object} Promise manager. - */ -function qFactory(nextTick, exceptionHandler, errorOnUnhandledRejections) { - var $qMinErr = minErr('$q', TypeError); - var queueSize = 0; - var checkQueue = []; - - /** - * @ngdoc method - * @name ng.$q#defer - * @kind function - * - * @description - * Creates a `Deferred` object which represents a task which will finish in the future. - * - * @returns {Deferred} Returns a new instance of deferred. - */ - function defer() { - return new Deferred(); - } - - function Deferred() { - var promise = this.promise = new Promise(); - //Non prototype methods necessary to support unbound execution :/ - this.resolve = function(val) { resolvePromise(promise, val); }; - this.reject = function(reason) { rejectPromise(promise, reason); }; - this.notify = function(progress) { notifyPromise(promise, progress); }; - } - - - function Promise() { - this.$$state = { status: 0 }; - } - - extend(Promise.prototype, { - then: function(onFulfilled, onRejected, progressBack) { - if (isUndefined(onFulfilled) && isUndefined(onRejected) && isUndefined(progressBack)) { - return this; - } - var result = new Promise(); - - this.$$state.pending = this.$$state.pending || []; - this.$$state.pending.push([result, onFulfilled, onRejected, progressBack]); - if (this.$$state.status > 0) scheduleProcessQueue(this.$$state); - - return result; - }, - - 'catch': function(callback) { - return this.then(null, callback); - }, - - 'finally': function(callback, progressBack) { - return this.then(function(value) { - return handleCallback(value, resolve, callback); - }, function(error) { - return handleCallback(error, reject, callback); - }, progressBack); - } - }); - - function processQueue(state) { - var fn, promise, pending; - - pending = state.pending; - state.processScheduled = false; - state.pending = undefined; - try { - for (var i = 0, ii = pending.length; i < ii; ++i) { - markQStateExceptionHandled(state); - promise = pending[i][0]; - fn = pending[i][state.status]; - try { - if (isFunction(fn)) { - resolvePromise(promise, fn(state.value)); - } else if (state.status === 1) { - resolvePromise(promise, state.value); - } else { - rejectPromise(promise, state.value); - } - } catch (e) { - rejectPromise(promise, e); - // This error is explicitly marked for being passed to the $exceptionHandler - if (e && e.$$passToExceptionHandler === true) { - exceptionHandler(e); - } - } - } - } finally { - --queueSize; - if (errorOnUnhandledRejections && queueSize === 0) { - nextTick(processChecks); - } - } - } - - function processChecks() { - // eslint-disable-next-line no-unmodified-loop-condition - while (!queueSize && checkQueue.length) { - var toCheck = checkQueue.shift(); - if (!isStateExceptionHandled(toCheck)) { - markQStateExceptionHandled(toCheck); - var errorMessage = 'Possibly unhandled rejection: ' + toDebugString(toCheck.value); - if (isError(toCheck.value)) { - exceptionHandler(toCheck.value, errorMessage); - } else { - exceptionHandler(errorMessage); - } - } - } - } - - function scheduleProcessQueue(state) { - if (errorOnUnhandledRejections && !state.pending && state.status === 2 && !isStateExceptionHandled(state)) { - if (queueSize === 0 && checkQueue.length === 0) { - nextTick(processChecks); - } - checkQueue.push(state); - } - if (state.processScheduled || !state.pending) return; - state.processScheduled = true; - ++queueSize; - nextTick(function() { processQueue(state); }); - } - - function resolvePromise(promise, val) { - if (promise.$$state.status) return; - if (val === promise) { - $$reject(promise, $qMinErr( - 'qcycle', - 'Expected promise to be resolved with value other than itself \'{0}\'', - val)); - } else { - $$resolve(promise, val); - } - - } - - function $$resolve(promise, val) { - var then; - var done = false; - try { - if (isObject(val) || isFunction(val)) then = val.then; - if (isFunction(then)) { - promise.$$state.status = -1; - then.call(val, doResolve, doReject, doNotify); - } else { - promise.$$state.value = val; - promise.$$state.status = 1; - scheduleProcessQueue(promise.$$state); - } - } catch (e) { - doReject(e); - } - - function doResolve(val) { - if (done) return; - done = true; - $$resolve(promise, val); - } - function doReject(val) { - if (done) return; - done = true; - $$reject(promise, val); - } - function doNotify(progress) { - notifyPromise(promise, progress); - } - } - - function rejectPromise(promise, reason) { - if (promise.$$state.status) return; - $$reject(promise, reason); - } - - function $$reject(promise, reason) { - promise.$$state.value = reason; - promise.$$state.status = 2; - scheduleProcessQueue(promise.$$state); - } - - function notifyPromise(promise, progress) { - var callbacks = promise.$$state.pending; - - if ((promise.$$state.status <= 0) && callbacks && callbacks.length) { - nextTick(function() { - var callback, result; - for (var i = 0, ii = callbacks.length; i < ii; i++) { - result = callbacks[i][0]; - callback = callbacks[i][3]; - try { - notifyPromise(result, isFunction(callback) ? callback(progress) : progress); - } catch (e) { - exceptionHandler(e); - } - } - }); - } - } - - /** - * @ngdoc method - * @name $q#reject - * @kind function - * - * @description - * Creates a promise that is resolved as rejected with the specified `reason`. This api should be - * used to forward rejection in a chain of promises. If you are dealing with the last promise in - * a promise chain, you don't need to worry about it. - * - * When comparing deferreds/promises to the familiar behavior of try/catch/throw, think of - * `reject` as the `throw` keyword in JavaScript. This also means that if you "catch" an error via - * a promise error callback and you want to forward the error to the promise derived from the - * current promise, you have to "rethrow" the error by returning a rejection constructed via - * `reject`. - * - * ```js - * promiseB = promiseA.then(function(result) { - * // success: do something and resolve promiseB - * // with the old or a new result - * return result; - * }, function(reason) { - * // error: handle the error if possible and - * // resolve promiseB with newPromiseOrValue, - * // otherwise forward the rejection to promiseB - * if (canHandle(reason)) { - * // handle the error and recover - * return newPromiseOrValue; - * } - * return $q.reject(reason); - * }); - * ``` - * - * @param {*} reason Constant, message, exception or an object representing the rejection reason. - * @returns {Promise} Returns a promise that was already resolved as rejected with the `reason`. - */ - function reject(reason) { - var result = new Promise(); - rejectPromise(result, reason); - return result; - } - - function handleCallback(value, resolver, callback) { - var callbackOutput = null; - try { - if (isFunction(callback)) callbackOutput = callback(); - } catch (e) { - return reject(e); - } - if (isPromiseLike(callbackOutput)) { - return callbackOutput.then(function() { - return resolver(value); - }, reject); - } else { - return resolver(value); - } - } - - /** - * @ngdoc method - * @name $q#when - * @kind function - * - * @description - * Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. - * This is useful when you are dealing with an object that might or might not be a promise, or if - * the promise comes from a source that can't be trusted. - * - * @param {*} value Value or a promise - * @param {Function=} successCallback - * @param {Function=} errorCallback - * @param {Function=} progressCallback - * @returns {Promise} Returns a promise of the passed value or promise - */ - - - function when(value, callback, errback, progressBack) { - var result = new Promise(); - resolvePromise(result, value); - return result.then(callback, errback, progressBack); - } - - /** - * @ngdoc method - * @name $q#resolve - * @kind function - * - * @description - * Alias of {@link ng.$q#when when} to maintain naming consistency with ES6. - * - * @param {*} value Value or a promise - * @param {Function=} successCallback - * @param {Function=} errorCallback - * @param {Function=} progressCallback - * @returns {Promise} Returns a promise of the passed value or promise - */ - var resolve = when; - - /** - * @ngdoc method - * @name $q#all - * @kind function - * - * @description - * Combines multiple promises into a single promise that is resolved when all of the input - * promises are resolved. - * - * @param {Array.|Object.} promises An array or hash of promises. - * @returns {Promise} Returns a single promise that will be resolved with an array/hash of values, - * each value corresponding to the promise at the same index/key in the `promises` array/hash. - * If any of the promises is resolved with a rejection, this resulting promise will be rejected - * with the same rejection value. - */ - - function all(promises) { - var result = new Promise(), - counter = 0, - results = isArray(promises) ? [] : {}; - - forEach(promises, function(promise, key) { - counter++; - when(promise).then(function(value) { - results[key] = value; - if (!(--counter)) resolvePromise(result, results); - }, function(reason) { - rejectPromise(result, reason); - }); - }); - - if (counter === 0) { - resolvePromise(result, results); - } - - return result; - } - - /** - * @ngdoc method - * @name $q#race - * @kind function - * - * @description - * Returns a promise that resolves or rejects as soon as one of those promises - * resolves or rejects, with the value or reason from that promise. - * - * @param {Array.|Object.} promises An array or hash of promises. - * @returns {Promise} a promise that resolves or rejects as soon as one of the `promises` - * resolves or rejects, with the value or reason from that promise. - */ - - function race(promises) { - var deferred = defer(); - - forEach(promises, function(promise) { - when(promise).then(deferred.resolve, deferred.reject); - }); - - return deferred.promise; - } - - function $Q(resolver) { - if (!isFunction(resolver)) { - throw $qMinErr('norslvr', 'Expected resolverFn, got \'{0}\'', resolver); - } - - var promise = new Promise(); - - function resolveFn(value) { - resolvePromise(promise, value); - } - - function rejectFn(reason) { - rejectPromise(promise, reason); - } - - resolver(resolveFn, rejectFn); - - return promise; - } - - // Let's make the instanceof operator work for promises, so that - // `new $q(fn) instanceof $q` would evaluate to true. - $Q.prototype = Promise.prototype; - - $Q.defer = defer; - $Q.reject = reject; - $Q.when = when; - $Q.resolve = resolve; - $Q.all = all; - $Q.race = race; - - return $Q; -} - -function isStateExceptionHandled(state) { - return !!state.pur; -} -function markQStateExceptionHandled(state) { - state.pur = true; -} -function markQExceptionHandled(q) { - // Built-in `$q` promises will always have a `$$state` property. This check is to allow - // overwriting `$q` with a different promise library (e.g. Bluebird + angular-bluebird-promises). - // (Currently, this is the only method that might be called with a promise, even if it is not - // created by the built-in `$q`.) - if (q.$$state) { - markQStateExceptionHandled(q.$$state); - } -} - -/** @this */ -function $$RAFProvider() { //rAF - this.$get = ['$window', '$timeout', function($window, $timeout) { - var requestAnimationFrame = $window.requestAnimationFrame || - $window.webkitRequestAnimationFrame; - - var cancelAnimationFrame = $window.cancelAnimationFrame || - $window.webkitCancelAnimationFrame || - $window.webkitCancelRequestAnimationFrame; - - var rafSupported = !!requestAnimationFrame; - var raf = rafSupported - ? function(fn) { - var id = requestAnimationFrame(fn); - return function() { - cancelAnimationFrame(id); - }; - } - : function(fn) { - var timer = $timeout(fn, 16.66, false); // 1000 / 60 = 16.666 - return function() { - $timeout.cancel(timer); - }; - }; - - raf.supported = rafSupported; - - return raf; - }]; -} - -/** - * DESIGN NOTES - * - * The design decisions behind the scope are heavily favored for speed and memory consumption. - * - * The typical use of scope is to watch the expressions, which most of the time return the same - * value as last time so we optimize the operation. - * - * Closures construction is expensive in terms of speed as well as memory: - * - No closures, instead use prototypical inheritance for API - * - Internal state needs to be stored on scope directly, which means that private state is - * exposed as $$____ properties - * - * Loop operations are optimized by using while(count--) { ... } - * - This means that in order to keep the same order of execution as addition we have to add - * items to the array at the beginning (unshift) instead of at the end (push) - * - * Child scopes are created and removed often - * - Using an array would be slow since inserts in the middle are expensive; so we use linked lists - * - * There are fewer watches than observers. This is why you don't want the observer to be implemented - * in the same way as watch. Watch requires return of the initialization function which is expensive - * to construct. - */ - - -/** - * @ngdoc provider - * @name $rootScopeProvider - * @description - * - * Provider for the $rootScope service. - */ - -/** - * @ngdoc method - * @name $rootScopeProvider#digestTtl - * @description - * - * Sets the number of `$digest` iterations the scope should attempt to execute before giving up and - * assuming that the model is unstable. - * - * The current default is 10 iterations. - * - * In complex applications it's possible that the dependencies between `$watch`s will result in - * several digest iterations. However if an application needs more than the default 10 digest - * iterations for its model to stabilize then you should investigate what is causing the model to - * continuously change during the digest. - * - * Increasing the TTL could have performance implications, so you should not change it without - * proper justification. - * - * @param {number} limit The number of digest iterations. - */ - - -/** - * @ngdoc service - * @name $rootScope - * @this - * - * @description - * - * Every application has a single root {@link ng.$rootScope.Scope scope}. - * All other scopes are descendant scopes of the root scope. Scopes provide separation - * between the model and the view, via a mechanism for watching the model for changes. - * They also provide event emission/broadcast and subscription facility. See the - * {@link guide/scope developer guide on scopes}. - */ -function $RootScopeProvider() { - var TTL = 10; - var $rootScopeMinErr = minErr('$rootScope'); - var lastDirtyWatch = null; - var applyAsyncId = null; - - this.digestTtl = function(value) { - if (arguments.length) { - TTL = value; - } - return TTL; - }; - - function createChildScopeClass(parent) { - function ChildScope() { - this.$$watchers = this.$$nextSibling = - this.$$childHead = this.$$childTail = null; - this.$$listeners = {}; - this.$$listenerCount = {}; - this.$$watchersCount = 0; - this.$id = nextUid(); - this.$$ChildScope = null; - this.$$suspended = false; - } - ChildScope.prototype = parent; - return ChildScope; - } - - this.$get = ['$exceptionHandler', '$parse', '$browser', - function($exceptionHandler, $parse, $browser) { - - function destroyChildScope($event) { - $event.currentScope.$$destroyed = true; - } - - function cleanUpScope($scope) { - - // Support: IE 9 only - if (msie === 9) { - // There is a memory leak in IE9 if all child scopes are not disconnected - // completely when a scope is destroyed. So this code will recurse up through - // all this scopes children - // - // See issue https://github.com/angular/angular.js/issues/10706 - if ($scope.$$childHead) { - cleanUpScope($scope.$$childHead); - } - if ($scope.$$nextSibling) { - cleanUpScope($scope.$$nextSibling); - } - } - - // The code below works around IE9 and V8's memory leaks - // - // See: - // - https://code.google.com/p/v8/issues/detail?id=2073#c26 - // - https://github.com/angular/angular.js/issues/6794#issuecomment-38648909 - // - https://github.com/angular/angular.js/issues/1313#issuecomment-10378451 - - $scope.$parent = $scope.$$nextSibling = $scope.$$prevSibling = $scope.$$childHead = - $scope.$$childTail = $scope.$root = $scope.$$watchers = null; - } - - /** - * @ngdoc type - * @name $rootScope.Scope - * - * @description - * A root scope can be retrieved using the {@link ng.$rootScope $rootScope} key from the - * {@link auto.$injector $injector}. Child scopes are created using the - * {@link ng.$rootScope.Scope#$new $new()} method. (Most scopes are created automatically when - * compiled HTML template is executed.) See also the {@link guide/scope Scopes guide} for - * an in-depth introduction and usage examples. - * - * - * ## Inheritance - * A scope can inherit from a parent scope, as in this example: - * ```js - var parent = $rootScope; - var child = parent.$new(); - - parent.salutation = "Hello"; - expect(child.salutation).toEqual('Hello'); - - child.salutation = "Welcome"; - expect(child.salutation).toEqual('Welcome'); - expect(parent.salutation).toEqual('Hello'); - * ``` - * - * When interacting with `Scope` in tests, additional helper methods are available on the - * instances of `Scope` type. See {@link ngMock.$rootScope.Scope ngMock Scope} for additional - * details. - * - * - * @param {Object.=} providers Map of service factory which need to be - * provided for the current scope. Defaults to {@link ng}. - * @param {Object.=} instanceCache Provides pre-instantiated services which should - * append/override services provided by `providers`. This is handy - * when unit-testing and having the need to override a default - * service. - * @returns {Object} Newly created scope. - * - */ - function Scope() { - this.$id = nextUid(); - this.$$phase = this.$parent = this.$$watchers = - this.$$nextSibling = this.$$prevSibling = - this.$$childHead = this.$$childTail = null; - this.$root = this; - this.$$destroyed = false; - this.$$suspended = false; - this.$$listeners = {}; - this.$$listenerCount = {}; - this.$$watchersCount = 0; - this.$$isolateBindings = null; - } - - /** - * @ngdoc property - * @name $rootScope.Scope#$id - * - * @description - * Unique scope ID (monotonically increasing) useful for debugging. - */ - - /** - * @ngdoc property - * @name $rootScope.Scope#$parent - * - * @description - * Reference to the parent scope. - */ - - /** - * @ngdoc property - * @name $rootScope.Scope#$root - * - * @description - * Reference to the root scope. - */ - - Scope.prototype = { - constructor: Scope, - /** - * @ngdoc method - * @name $rootScope.Scope#$new - * @kind function - * - * @description - * Creates a new child {@link ng.$rootScope.Scope scope}. - * - * The parent scope will propagate the {@link ng.$rootScope.Scope#$digest $digest()} event. - * The scope can be removed from the scope hierarchy using {@link ng.$rootScope.Scope#$destroy $destroy()}. - * - * {@link ng.$rootScope.Scope#$destroy $destroy()} must be called on a scope when it is - * desired for the scope and its child scopes to be permanently detached from the parent and - * thus stop participating in model change detection and listener notification by invoking. - * - * @param {boolean} isolate If true, then the scope does not prototypically inherit from the - * parent scope. The scope is isolated, as it can not see parent scope properties. - * When creating widgets, it is useful for the widget to not accidentally read parent - * state. - * - * @param {Scope} [parent=this] The {@link ng.$rootScope.Scope `Scope`} that will be the `$parent` - * of the newly created scope. Defaults to `this` scope if not provided. - * This is used when creating a transclude scope to correctly place it - * in the scope hierarchy while maintaining the correct prototypical - * inheritance. - * - * @returns {Object} The newly created child scope. - * - */ - $new: function(isolate, parent) { - var child; - - parent = parent || this; - - if (isolate) { - child = new Scope(); - child.$root = this.$root; - } else { - // Only create a child scope class if somebody asks for one, - // but cache it to allow the VM to optimize lookups. - if (!this.$$ChildScope) { - this.$$ChildScope = createChildScopeClass(this); - } - child = new this.$$ChildScope(); - } - child.$parent = parent; - child.$$prevSibling = parent.$$childTail; - if (parent.$$childHead) { - parent.$$childTail.$$nextSibling = child; - parent.$$childTail = child; - } else { - parent.$$childHead = parent.$$childTail = child; - } - - // When the new scope is not isolated or we inherit from `this`, and - // the parent scope is destroyed, the property `$$destroyed` is inherited - // prototypically. In all other cases, this property needs to be set - // when the parent scope is destroyed. - // The listener needs to be added after the parent is set - if (isolate || parent !== this) child.$on('$destroy', destroyChildScope); - - return child; - }, - - /** - * @ngdoc method - * @name $rootScope.Scope#$watch - * @kind function - * - * @description - * Registers a `listener` callback to be executed whenever the `watchExpression` changes. - * - * - The `watchExpression` is called on every call to {@link ng.$rootScope.Scope#$digest - * $digest()} and should return the value that will be watched. (`watchExpression` should not change - * its value when executed multiple times with the same input because it may be executed multiple - * times by {@link ng.$rootScope.Scope#$digest $digest()}. That is, `watchExpression` should be - * [idempotent](http://en.wikipedia.org/wiki/Idempotence).) - * - The `listener` is called only when the value from the current `watchExpression` and the - * previous call to `watchExpression` are not equal (with the exception of the initial run, - * see below). Inequality is determined according to reference inequality, - * [strict comparison](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators) - * via the `!==` Javascript operator, unless `objectEquality == true` - * (see next point) - * - When `objectEquality == true`, inequality of the `watchExpression` is determined - * according to the {@link angular.equals} function. To save the value of the object for - * later comparison, the {@link angular.copy} function is used. This therefore means that - * watching complex objects will have adverse memory and performance implications. - * - This should not be used to watch for changes in objects that are (or contain) - * [File](https://developer.mozilla.org/docs/Web/API/File) objects due to limitations with {@link angular.copy `angular.copy`}. - * - The watch `listener` may change the model, which may trigger other `listener`s to fire. - * This is achieved by rerunning the watchers until no changes are detected. The rerun - * iteration limit is 10 to prevent an infinite loop deadlock. - * - * - * If you want to be notified whenever {@link ng.$rootScope.Scope#$digest $digest} is called, - * you can register a `watchExpression` function with no `listener`. (Be prepared for - * multiple calls to your `watchExpression` because it will execute multiple times in a - * single {@link ng.$rootScope.Scope#$digest $digest} cycle if a change is detected.) - * - * After a watcher is registered with the scope, the `listener` fn is called asynchronously - * (via {@link ng.$rootScope.Scope#$evalAsync $evalAsync}) to initialize the - * watcher. In rare cases, this is undesirable because the listener is called when the result - * of `watchExpression` didn't change. To detect this scenario within the `listener` fn, you - * can compare the `newVal` and `oldVal`. If these two values are identical (`===`) then the - * listener was called due to initialization. - * - * - * - * @example - * ```js - // let's assume that scope was dependency injected as the $rootScope - var scope = $rootScope; - scope.name = 'misko'; - scope.counter = 0; - - expect(scope.counter).toEqual(0); - scope.$watch('name', function(newValue, oldValue) { - scope.counter = scope.counter + 1; - }); - expect(scope.counter).toEqual(0); - - scope.$digest(); - // the listener is always called during the first $digest loop after it was registered - expect(scope.counter).toEqual(1); - - scope.$digest(); - // but now it will not be called unless the value changes - expect(scope.counter).toEqual(1); - - scope.name = 'adam'; - scope.$digest(); - expect(scope.counter).toEqual(2); - - - - // Using a function as a watchExpression - var food; - scope.foodCounter = 0; - expect(scope.foodCounter).toEqual(0); - scope.$watch( - // This function returns the value being watched. It is called for each turn of the $digest loop - function() { return food; }, - // This is the change listener, called when the value returned from the above function changes - function(newValue, oldValue) { - if ( newValue !== oldValue ) { - // Only increment the counter if the value changed - scope.foodCounter = scope.foodCounter + 1; - } - } - ); - // No digest has been run so the counter will be zero - expect(scope.foodCounter).toEqual(0); - - // Run the digest but since food has not changed count will still be zero - scope.$digest(); - expect(scope.foodCounter).toEqual(0); - - // Update food and run digest. Now the counter will increment - food = 'cheeseburger'; - scope.$digest(); - expect(scope.foodCounter).toEqual(1); - - * ``` - * - * - * - * @param {(function()|string)} watchExpression Expression that is evaluated on each - * {@link ng.$rootScope.Scope#$digest $digest} cycle. A change in the return value triggers - * a call to the `listener`. - * - * - `string`: Evaluated as {@link guide/expression expression} - * - `function(scope)`: called with current `scope` as a parameter. - * @param {function(newVal, oldVal, scope)} listener Callback called whenever the value - * of `watchExpression` changes. - * - * - `newVal` contains the current value of the `watchExpression` - * - `oldVal` contains the previous value of the `watchExpression` - * - `scope` refers to the current scope - * @param {boolean=} [objectEquality=false] Compare for object equality using {@link angular.equals} instead of - * comparing for reference equality. - * @returns {function()} Returns a deregistration function for this listener. - */ - $watch: function(watchExp, listener, objectEquality, prettyPrintExpression) { - var get = $parse(watchExp); - var fn = isFunction(listener) ? listener : noop; - - if (get.$$watchDelegate) { - return get.$$watchDelegate(this, fn, objectEquality, get, watchExp); - } - var scope = this, - array = scope.$$watchers, - watcher = { - fn: fn, - last: initWatchVal, - get: get, - exp: prettyPrintExpression || watchExp, - eq: !!objectEquality - }; - - lastDirtyWatch = null; - - if (!array) { - array = scope.$$watchers = []; - array.$$digestWatchIndex = -1; - } - // we use unshift since we use a while loop in $digest for speed. - // the while loop reads in reverse order. - array.unshift(watcher); - array.$$digestWatchIndex++; - incrementWatchersCount(this, 1); - - return function deregisterWatch() { - var index = arrayRemove(array, watcher); - if (index >= 0) { - incrementWatchersCount(scope, -1); - if (index < array.$$digestWatchIndex) { - array.$$digestWatchIndex--; - } - } - lastDirtyWatch = null; - }; - }, - - /** - * @ngdoc method - * @name $rootScope.Scope#$watchGroup - * @kind function - * - * @description - * A variant of {@link ng.$rootScope.Scope#$watch $watch()} where it watches an array of `watchExpressions`. - * If any one expression in the collection changes the `listener` is executed. - * - * - The items in the `watchExpressions` array are observed via the standard `$watch` operation. Their return - * values are examined for changes on every call to `$digest`. - * - The `listener` is called whenever any expression in the `watchExpressions` array changes. - * - * @param {Array.} watchExpressions Array of expressions that will be individually - * watched using {@link ng.$rootScope.Scope#$watch $watch()} - * - * @param {function(newValues, oldValues, scope)} listener Callback called whenever the return value of any - * expression in `watchExpressions` changes - * The `newValues` array contains the current values of the `watchExpressions`, with the indexes matching - * those of `watchExpression` - * and the `oldValues` array contains the previous values of the `watchExpressions`, with the indexes matching - * those of `watchExpression` - * The `scope` refers to the current scope. - * @returns {function()} Returns a de-registration function for all listeners. - */ - $watchGroup: function(watchExpressions, listener) { - var oldValues = new Array(watchExpressions.length); - var newValues = new Array(watchExpressions.length); - var deregisterFns = []; - var self = this; - var changeReactionScheduled = false; - var firstRun = true; - - if (!watchExpressions.length) { - // No expressions means we call the listener ASAP - var shouldCall = true; - self.$evalAsync(function() { - if (shouldCall) listener(newValues, newValues, self); - }); - return function deregisterWatchGroup() { - shouldCall = false; - }; - } - - if (watchExpressions.length === 1) { - // Special case size of one - return this.$watch(watchExpressions[0], function watchGroupAction(value, oldValue, scope) { - newValues[0] = value; - oldValues[0] = oldValue; - listener(newValues, (value === oldValue) ? newValues : oldValues, scope); - }); - } - - forEach(watchExpressions, function(expr, i) { - var unwatchFn = self.$watch(expr, function watchGroupSubAction(value) { - newValues[i] = value; - if (!changeReactionScheduled) { - changeReactionScheduled = true; - self.$evalAsync(watchGroupAction); - } - }); - deregisterFns.push(unwatchFn); - }); - - function watchGroupAction() { - changeReactionScheduled = false; - - try { - if (firstRun) { - firstRun = false; - listener(newValues, newValues, self); - } else { - listener(newValues, oldValues, self); - } - } finally { - for (var i = 0; i < watchExpressions.length; i++) { - oldValues[i] = newValues[i]; - } - } - } - - return function deregisterWatchGroup() { - while (deregisterFns.length) { - deregisterFns.shift()(); - } - }; - }, - - - /** - * @ngdoc method - * @name $rootScope.Scope#$watchCollection - * @kind function - * - * @description - * Shallow watches the properties of an object and fires whenever any of the properties change - * (for arrays, this implies watching the array items; for object maps, this implies watching - * the properties). If a change is detected, the `listener` callback is fired. - * - * - The `obj` collection is observed via standard $watch operation and is examined on every - * call to $digest() to see if any items have been added, removed, or moved. - * - The `listener` is called whenever anything within the `obj` has changed. Examples include - * adding, removing, and moving items belonging to an object or array. - * - * - * @example - * ```js - $scope.names = ['igor', 'matias', 'misko', 'james']; - $scope.dataCount = 4; - - $scope.$watchCollection('names', function(newNames, oldNames) { - $scope.dataCount = newNames.length; - }); - - expect($scope.dataCount).toEqual(4); - $scope.$digest(); - - //still at 4 ... no changes - expect($scope.dataCount).toEqual(4); - - $scope.names.pop(); - $scope.$digest(); - - //now there's been a change - expect($scope.dataCount).toEqual(3); - * ``` - * - * - * @param {string|function(scope)} obj Evaluated as {@link guide/expression expression}. The - * expression value should evaluate to an object or an array which is observed on each - * {@link ng.$rootScope.Scope#$digest $digest} cycle. Any shallow change within the - * collection will trigger a call to the `listener`. - * - * @param {function(newCollection, oldCollection, scope)} listener a callback function called - * when a change is detected. - * - The `newCollection` object is the newly modified data obtained from the `obj` expression - * - The `oldCollection` object is a copy of the former collection data. - * Due to performance considerations, the`oldCollection` value is computed only if the - * `listener` function declares two or more arguments. - * - The `scope` argument refers to the current scope. - * - * @returns {function()} Returns a de-registration function for this listener. When the - * de-registration function is executed, the internal watch operation is terminated. - */ - $watchCollection: function(obj, listener) { - // Mark the interceptor as - // ... $$pure when literal since the instance will change when any input changes - $watchCollectionInterceptor.$$pure = $parse(obj).literal; - // ... $stateful when non-literal since we must read the state of the collection - $watchCollectionInterceptor.$stateful = !$watchCollectionInterceptor.$$pure; - - var self = this; - // the current value, updated on each dirty-check run - var newValue; - // a shallow copy of the newValue from the last dirty-check run, - // updated to match newValue during dirty-check run - var oldValue; - // a shallow copy of the newValue from when the last change happened - var veryOldValue; - // only track veryOldValue if the listener is asking for it - var trackVeryOldValue = (listener.length > 1); - var changeDetected = 0; - var changeDetector = $parse(obj, $watchCollectionInterceptor); - var internalArray = []; - var internalObject = {}; - var initRun = true; - var oldLength = 0; - - function $watchCollectionInterceptor(_value) { - newValue = _value; - var newLength, key, bothNaN, newItem, oldItem; - - // If the new value is undefined, then return undefined as the watch may be a one-time watch - if (isUndefined(newValue)) return; - - if (!isObject(newValue)) { // if primitive - if (oldValue !== newValue) { - oldValue = newValue; - changeDetected++; - } - } else if (isArrayLike(newValue)) { - if (oldValue !== internalArray) { - // we are transitioning from something which was not an array into array. - oldValue = internalArray; - oldLength = oldValue.length = 0; - changeDetected++; - } - - newLength = newValue.length; - - if (oldLength !== newLength) { - // if lengths do not match we need to trigger change notification - changeDetected++; - oldValue.length = oldLength = newLength; - } - // copy the items to oldValue and look for changes. - for (var i = 0; i < newLength; i++) { - oldItem = oldValue[i]; - newItem = newValue[i]; - - // eslint-disable-next-line no-self-compare - bothNaN = (oldItem !== oldItem) && (newItem !== newItem); - if (!bothNaN && (oldItem !== newItem)) { - changeDetected++; - oldValue[i] = newItem; - } - } - } else { - if (oldValue !== internalObject) { - // we are transitioning from something which was not an object into object. - oldValue = internalObject = {}; - oldLength = 0; - changeDetected++; - } - // copy the items to oldValue and look for changes. - newLength = 0; - for (key in newValue) { - if (hasOwnProperty.call(newValue, key)) { - newLength++; - newItem = newValue[key]; - oldItem = oldValue[key]; - - if (key in oldValue) { - // eslint-disable-next-line no-self-compare - bothNaN = (oldItem !== oldItem) && (newItem !== newItem); - if (!bothNaN && (oldItem !== newItem)) { - changeDetected++; - oldValue[key] = newItem; - } - } else { - oldLength++; - oldValue[key] = newItem; - changeDetected++; - } - } - } - if (oldLength > newLength) { - // we used to have more keys, need to find them and destroy them. - changeDetected++; - for (key in oldValue) { - if (!hasOwnProperty.call(newValue, key)) { - oldLength--; - delete oldValue[key]; - } - } - } - } - return changeDetected; - } - - function $watchCollectionAction() { - if (initRun) { - initRun = false; - listener(newValue, newValue, self); - } else { - listener(newValue, veryOldValue, self); - } - - // make a copy for the next time a collection is changed - if (trackVeryOldValue) { - if (!isObject(newValue)) { - //primitive - veryOldValue = newValue; - } else if (isArrayLike(newValue)) { - veryOldValue = new Array(newValue.length); - for (var i = 0; i < newValue.length; i++) { - veryOldValue[i] = newValue[i]; - } - } else { // if object - veryOldValue = {}; - for (var key in newValue) { - if (hasOwnProperty.call(newValue, key)) { - veryOldValue[key] = newValue[key]; - } - } - } - } - } - - return this.$watch(changeDetector, $watchCollectionAction); - }, - - /** - * @ngdoc method - * @name $rootScope.Scope#$digest - * @kind function - * - * @description - * Processes all of the {@link ng.$rootScope.Scope#$watch watchers} of the current scope and - * its children. Because a {@link ng.$rootScope.Scope#$watch watcher}'s listener can change - * the model, the `$digest()` keeps calling the {@link ng.$rootScope.Scope#$watch watchers} - * until no more listeners are firing. This means that it is possible to get into an infinite - * loop. This function will throw `'Maximum iteration limit exceeded.'` if the number of - * iterations exceeds 10. - * - * Usually, you don't call `$digest()` directly in - * {@link ng.directive:ngController controllers} or in - * {@link ng.$compileProvider#directive directives}. - * Instead, you should call {@link ng.$rootScope.Scope#$apply $apply()} (typically from within - * a {@link ng.$compileProvider#directive directive}), which will force a `$digest()`. - * - * If you want to be notified whenever `$digest()` is called, - * you can register a `watchExpression` function with - * {@link ng.$rootScope.Scope#$watch $watch()} with no `listener`. - * - * In unit tests, you may need to call `$digest()` to simulate the scope life cycle. - * - * @example - * ```js - var scope = ...; - scope.name = 'misko'; - scope.counter = 0; - - expect(scope.counter).toEqual(0); - scope.$watch('name', function(newValue, oldValue) { - scope.counter = scope.counter + 1; - }); - expect(scope.counter).toEqual(0); - - scope.$digest(); - // the listener is always called during the first $digest loop after it was registered - expect(scope.counter).toEqual(1); - - scope.$digest(); - // but now it will not be called unless the value changes - expect(scope.counter).toEqual(1); - - scope.name = 'adam'; - scope.$digest(); - expect(scope.counter).toEqual(2); - * ``` - * - */ - $digest: function() { - var watch, value, last, fn, get, - watchers, - dirty, ttl = TTL, - next, current, target = asyncQueue.length ? $rootScope : this, - watchLog = [], - logIdx, asyncTask; - - beginPhase('$digest'); - // Check for changes to browser url that happened in sync before the call to $digest - $browser.$$checkUrlChange(); - - if (this === $rootScope && applyAsyncId !== null) { - // If this is the root scope, and $applyAsync has scheduled a deferred $apply(), then - // cancel the scheduled $apply and flush the queue of expressions to be evaluated. - $browser.defer.cancel(applyAsyncId); - flushApplyAsync(); - } - - lastDirtyWatch = null; - - do { // "while dirty" loop - dirty = false; - current = target; - - // It's safe for asyncQueuePosition to be a local variable here because this loop can't - // be reentered recursively. Calling $digest from a function passed to $evalAsync would - // lead to a '$digest already in progress' error. - for (var asyncQueuePosition = 0; asyncQueuePosition < asyncQueue.length; asyncQueuePosition++) { - try { - asyncTask = asyncQueue[asyncQueuePosition]; - fn = asyncTask.fn; - fn(asyncTask.scope, asyncTask.locals); - } catch (e) { - $exceptionHandler(e); - } - lastDirtyWatch = null; - } - asyncQueue.length = 0; - - traverseScopesLoop: - do { // "traverse the scopes" loop - if ((watchers = !current.$$suspended && current.$$watchers)) { - // process our watches - watchers.$$digestWatchIndex = watchers.length; - while (watchers.$$digestWatchIndex--) { - try { - watch = watchers[watchers.$$digestWatchIndex]; - // Most common watches are on primitives, in which case we can short - // circuit it with === operator, only when === fails do we use .equals - if (watch) { - get = watch.get; - if ((value = get(current)) !== (last = watch.last) && - !(watch.eq - ? equals(value, last) - : (isNumberNaN(value) && isNumberNaN(last)))) { - dirty = true; - lastDirtyWatch = watch; - watch.last = watch.eq ? copy(value, null) : value; - fn = watch.fn; - fn(value, ((last === initWatchVal) ? value : last), current); - if (ttl < 5) { - logIdx = 4 - ttl; - if (!watchLog[logIdx]) watchLog[logIdx] = []; - watchLog[logIdx].push({ - msg: isFunction(watch.exp) ? 'fn: ' + (watch.exp.name || watch.exp.toString()) : watch.exp, - newVal: value, - oldVal: last - }); - } - } else if (watch === lastDirtyWatch) { - // If the most recently dirty watcher is now clean, short circuit since the remaining watchers - // have already been tested. - dirty = false; - break traverseScopesLoop; - } - } - } catch (e) { - $exceptionHandler(e); - } - } - } - - // Insanity Warning: scope depth-first traversal - // yes, this code is a bit crazy, but it works and we have tests to prove it! - // this piece should be kept in sync with the traversal in $broadcast - // (though it differs due to having the extra check for $$suspended and does not - // check $$listenerCount) - if (!(next = ((!current.$$suspended && current.$$watchersCount && current.$$childHead) || - (current !== target && current.$$nextSibling)))) { - while (current !== target && !(next = current.$$nextSibling)) { - current = current.$parent; - } - } - } while ((current = next)); - - // `break traverseScopesLoop;` takes us to here - - if ((dirty || asyncQueue.length) && !(ttl--)) { - clearPhase(); - throw $rootScopeMinErr('infdig', - '{0} $digest() iterations reached. Aborting!\n' + - 'Watchers fired in the last 5 iterations: {1}', - TTL, watchLog); - } - - } while (dirty || asyncQueue.length); - - clearPhase(); - - // postDigestQueuePosition isn't local here because this loop can be reentered recursively. - while (postDigestQueuePosition < postDigestQueue.length) { - try { - postDigestQueue[postDigestQueuePosition++](); - } catch (e) { - $exceptionHandler(e); - } - } - postDigestQueue.length = postDigestQueuePosition = 0; - - // Check for changes to browser url that happened during the $digest - // (for which no event is fired; e.g. via `history.pushState()`) - $browser.$$checkUrlChange(); - }, - - /** - * @ngdoc method - * @name $rootScope.Scope#$suspend - * @kind function - * - * @description - * Suspend watchers of this scope subtree so that they will not be invoked during digest. - * - * This can be used to optimize your application when you know that running those watchers - * is redundant. - * - * **Warning** - * - * Suspending scopes from the digest cycle can have unwanted and difficult to debug results. - * Only use this approach if you are confident that you know what you are doing and have - * ample tests to ensure that bindings get updated as you expect. - * - * Some of the things to consider are: - * - * * Any external event on a directive/component will not trigger a digest while the hosting - * scope is suspended - even if the event handler calls `$apply()` or `$rootScope.$digest()`. - * * Transcluded content exists on a scope that inherits from outside a directive but exists - * as a child of the directive's containing scope. If the containing scope is suspended the - * transcluded scope will also be suspended, even if the scope from which the transcluded - * scope inherits is not suspended. - * * Multiple directives trying to manage the suspended status of a scope can confuse each other: - * * A call to `$suspend()` on an already suspended scope is a no-op. - * * A call to `$resume()` on a non-suspended scope is a no-op. - * * If two directives suspend a scope, then one of them resumes the scope, the scope will no - * longer be suspended. This could result in the other directive believing a scope to be - * suspended when it is not. - * * If a parent scope is suspended then all its descendants will be also excluded from future - * digests whether or not they have been suspended themselves. Note that this also applies to - * isolate child scopes. - * * Calling `$digest()` directly on a descendant of a suspended scope will still run the watchers - * for that scope and its descendants. When digesting we only check whether the current scope is - * locally suspended, rather than checking whether it has a suspended ancestor. - * * Calling `$resume()` on a scope that has a suspended ancestor will not cause the scope to be - * included in future digests until all its ancestors have been resumed. - * * Resolved promises, e.g. from explicit `$q` deferreds and `$http` calls, trigger `$apply()` - * against the `$rootScope` and so will still trigger a global digest even if the promise was - * initiated by a component that lives on a suspended scope. - */ - $suspend: function() { - this.$$suspended = true; - }, - - /** - * @ngdoc method - * @name $rootScope.Scope#$isSuspended - * @kind function - * - * @description - * Call this method to determine if this scope has been explicitly suspended. It will not - * tell you whether an ancestor has been suspended. - * To determine if this scope will be excluded from a digest triggered at the $rootScope, - * for example, you must check all its ancestors: - * - * ``` - * function isExcludedFromDigest(scope) { - * while(scope) { - * if (scope.$isSuspended()) return true; - * scope = scope.$parent; - * } - * return false; - * ``` - * - * Be aware that a scope may not be included in digests if it has a suspended ancestor, - * even if `$isSuspended()` returns false. - * - * @returns true if the current scope has been suspended. - */ - $isSuspended: function() { - return this.$$suspended; - }, - - /** - * @ngdoc method - * @name $rootScope.Scope#$resume - * @kind function - * - * @description - * Resume watchers of this scope subtree in case it was suspended. - * - * See {@link $rootScope.Scope#$suspend} for information about the dangers of using this approach. - */ - $resume: function() { - this.$$suspended = false; - }, - - /** - * @ngdoc event - * @name $rootScope.Scope#$destroy - * @eventType broadcast on scope being destroyed - * - * @description - * Broadcasted when a scope and its children are being destroyed. - * - * Note that, in AngularJS, there is also a `$destroy` jQuery event, which can be used to - * clean up DOM bindings before an element is removed from the DOM. - */ - - /** - * @ngdoc method - * @name $rootScope.Scope#$destroy - * @kind function - * - * @description - * Removes the current scope (and all of its children) from the parent scope. Removal implies - * that calls to {@link ng.$rootScope.Scope#$digest $digest()} will no longer - * propagate to the current scope and its children. Removal also implies that the current - * scope is eligible for garbage collection. - * - * The `$destroy()` is usually used by directives such as - * {@link ng.directive:ngRepeat ngRepeat} for managing the - * unrolling of the loop. - * - * Just before a scope is destroyed, a `$destroy` event is broadcasted on this scope. - * Application code can register a `$destroy` event handler that will give it a chance to - * perform any necessary cleanup. - * - * Note that, in AngularJS, there is also a `$destroy` jQuery event, which can be used to - * clean up DOM bindings before an element is removed from the DOM. - */ - $destroy: function() { - // We can't destroy a scope that has been already destroyed. - if (this.$$destroyed) return; - var parent = this.$parent; - - this.$broadcast('$destroy'); - this.$$destroyed = true; - - if (this === $rootScope) { - //Remove handlers attached to window when $rootScope is removed - $browser.$$applicationDestroyed(); - } - - incrementWatchersCount(this, -this.$$watchersCount); - for (var eventName in this.$$listenerCount) { - decrementListenerCount(this, this.$$listenerCount[eventName], eventName); - } - - // sever all the references to parent scopes (after this cleanup, the current scope should - // not be retained by any of our references and should be eligible for garbage collection) - if (parent && parent.$$childHead === this) parent.$$childHead = this.$$nextSibling; - if (parent && parent.$$childTail === this) parent.$$childTail = this.$$prevSibling; - if (this.$$prevSibling) this.$$prevSibling.$$nextSibling = this.$$nextSibling; - if (this.$$nextSibling) this.$$nextSibling.$$prevSibling = this.$$prevSibling; - - // Disable listeners, watchers and apply/digest methods - this.$destroy = this.$digest = this.$apply = this.$evalAsync = this.$applyAsync = noop; - this.$on = this.$watch = this.$watchGroup = function() { return noop; }; - this.$$listeners = {}; - - // Disconnect the next sibling to prevent `cleanUpScope` destroying those too - this.$$nextSibling = null; - cleanUpScope(this); - }, - - /** - * @ngdoc method - * @name $rootScope.Scope#$eval - * @kind function - * - * @description - * Executes the `expression` on the current scope and returns the result. Any exceptions in - * the expression are propagated (uncaught). This is useful when evaluating AngularJS - * expressions. - * - * @example - * ```js - var scope = ng.$rootScope.Scope(); - scope.a = 1; - scope.b = 2; - - expect(scope.$eval('a+b')).toEqual(3); - expect(scope.$eval(function(scope){ return scope.a + scope.b; })).toEqual(3); - * ``` - * - * @param {(string|function())=} expression An AngularJS expression to be executed. - * - * - `string`: execute using the rules as defined in {@link guide/expression expression}. - * - `function(scope)`: execute the function with the current `scope` parameter. - * - * @param {(object)=} locals Local variables object, useful for overriding values in scope. - * @returns {*} The result of evaluating the expression. - */ - $eval: function(expr, locals) { - return $parse(expr)(this, locals); - }, - - /** - * @ngdoc method - * @name $rootScope.Scope#$evalAsync - * @kind function - * - * @description - * Executes the expression on the current scope at a later point in time. - * - * The `$evalAsync` makes no guarantees as to when the `expression` will be executed, only - * that: - * - * - it will execute after the function that scheduled the evaluation (preferably before DOM - * rendering). - * - at least one {@link ng.$rootScope.Scope#$digest $digest cycle} will be performed after - * `expression` execution. - * - * Any exceptions from the execution of the expression are forwarded to the - * {@link ng.$exceptionHandler $exceptionHandler} service. - * - * __Note:__ if this function is called outside of a `$digest` cycle, a new `$digest` cycle - * will be scheduled. However, it is encouraged to always call code that changes the model - * from within an `$apply` call. That includes code evaluated via `$evalAsync`. - * - * @param {(string|function())=} expression An AngularJS expression to be executed. - * - * - `string`: execute using the rules as defined in {@link guide/expression expression}. - * - `function(scope)`: execute the function with the current `scope` parameter. - * - * @param {(object)=} locals Local variables object, useful for overriding values in scope. - */ - $evalAsync: function(expr, locals) { - // if we are outside of an $digest loop and this is the first time we are scheduling async - // task also schedule async auto-flush - if (!$rootScope.$$phase && !asyncQueue.length) { - $browser.defer(function() { - if (asyncQueue.length) { - $rootScope.$digest(); - } - }, null, '$evalAsync'); - } - - asyncQueue.push({scope: this, fn: $parse(expr), locals: locals}); - }, - - $$postDigest: function(fn) { - postDigestQueue.push(fn); - }, - - /** - * @ngdoc method - * @name $rootScope.Scope#$apply - * @kind function - * - * @description - * `$apply()` is used to execute an expression in AngularJS from outside of the AngularJS - * framework. (For example from browser DOM events, setTimeout, XHR or third party libraries). - * Because we are calling into the AngularJS framework we need to perform proper scope life - * cycle of {@link ng.$exceptionHandler exception handling}, - * {@link ng.$rootScope.Scope#$digest executing watches}. - * - * **Life cycle: Pseudo-Code of `$apply()`** - * - * ```js - function $apply(expr) { - try { - return $eval(expr); - } catch (e) { - $exceptionHandler(e); - } finally { - $root.$digest(); - } - } - * ``` - * - * - * Scope's `$apply()` method transitions through the following stages: - * - * 1. The {@link guide/expression expression} is executed using the - * {@link ng.$rootScope.Scope#$eval $eval()} method. - * 2. Any exceptions from the execution of the expression are forwarded to the - * {@link ng.$exceptionHandler $exceptionHandler} service. - * 3. The {@link ng.$rootScope.Scope#$watch watch} listeners are fired immediately after the - * expression was executed using the {@link ng.$rootScope.Scope#$digest $digest()} method. - * - * - * @param {(string|function())=} exp An AngularJS expression to be executed. - * - * - `string`: execute using the rules as defined in {@link guide/expression expression}. - * - `function(scope)`: execute the function with current `scope` parameter. - * - * @returns {*} The result of evaluating the expression. - */ - $apply: function(expr) { - try { - beginPhase('$apply'); - try { - return this.$eval(expr); - } finally { - clearPhase(); - } - } catch (e) { - $exceptionHandler(e); - } finally { - try { - $rootScope.$digest(); - } catch (e) { - $exceptionHandler(e); - // eslint-disable-next-line no-unsafe-finally - throw e; - } - } - }, - - /** - * @ngdoc method - * @name $rootScope.Scope#$applyAsync - * @kind function - * - * @description - * Schedule the invocation of $apply to occur at a later time. The actual time difference - * varies across browsers, but is typically around ~10 milliseconds. - * - * This can be used to queue up multiple expressions which need to be evaluated in the same - * digest. - * - * @param {(string|function())=} exp An AngularJS expression to be executed. - * - * - `string`: execute using the rules as defined in {@link guide/expression expression}. - * - `function(scope)`: execute the function with current `scope` parameter. - */ - $applyAsync: function(expr) { - var scope = this; - if (expr) { - applyAsyncQueue.push($applyAsyncExpression); - } - expr = $parse(expr); - scheduleApplyAsync(); - - function $applyAsyncExpression() { - scope.$eval(expr); - } - }, - - /** - * @ngdoc method - * @name $rootScope.Scope#$on - * @kind function - * - * @description - * Listens on events of a given type. See {@link ng.$rootScope.Scope#$emit $emit} for - * discussion of event life cycle. - * - * The event listener function format is: `function(event, args...)`. The `event` object - * passed into the listener has the following attributes: - * - * - `targetScope` - `{Scope}`: the scope on which the event was `$emit`-ed or - * `$broadcast`-ed. - * - `currentScope` - `{Scope}`: the scope that is currently handling the event. Once the - * event propagates through the scope hierarchy, this property is set to null. - * - `name` - `{string}`: name of the event. - * - `stopPropagation` - `{function=}`: calling `stopPropagation` function will cancel - * further event propagation (available only for events that were `$emit`-ed). - * - `preventDefault` - `{function}`: calling `preventDefault` sets `defaultPrevented` flag - * to true. - * - `defaultPrevented` - `{boolean}`: true if `preventDefault` was called. - * - * @param {string} name Event name to listen on. - * @param {function(event, ...args)} listener Function to call when the event is emitted. - * @returns {function()} Returns a deregistration function for this listener. - */ - $on: function(name, listener) { - var namedListeners = this.$$listeners[name]; - if (!namedListeners) { - this.$$listeners[name] = namedListeners = []; - } - namedListeners.push(listener); - - var current = this; - do { - if (!current.$$listenerCount[name]) { - current.$$listenerCount[name] = 0; - } - current.$$listenerCount[name]++; - } while ((current = current.$parent)); - - var self = this; - return function() { - var indexOfListener = namedListeners.indexOf(listener); - if (indexOfListener !== -1) { - // Use delete in the hope of the browser deallocating the memory for the array entry, - // while not shifting the array indexes of other listeners. - // See issue https://github.com/angular/angular.js/issues/16135 - delete namedListeners[indexOfListener]; - decrementListenerCount(self, 1, name); - } - }; - }, - - - /** - * @ngdoc method - * @name $rootScope.Scope#$emit - * @kind function - * - * @description - * Dispatches an event `name` upwards through the scope hierarchy notifying the - * registered {@link ng.$rootScope.Scope#$on} listeners. - * - * The event life cycle starts at the scope on which `$emit` was called. All - * {@link ng.$rootScope.Scope#$on listeners} listening for `name` event on this scope get - * notified. Afterwards, the event traverses upwards toward the root scope and calls all - * registered listeners along the way. The event will stop propagating if one of the listeners - * cancels it. - * - * Any exception emitted from the {@link ng.$rootScope.Scope#$on listeners} will be passed - * onto the {@link ng.$exceptionHandler $exceptionHandler} service. - * - * @param {string} name Event name to emit. - * @param {...*} args Optional one or more arguments which will be passed onto the event listeners. - * @return {Object} Event object (see {@link ng.$rootScope.Scope#$on}). - */ - $emit: function(name, args) { - var empty = [], - namedListeners, - scope = this, - stopPropagation = false, - event = { - name: name, - targetScope: scope, - stopPropagation: function() {stopPropagation = true;}, - preventDefault: function() { - event.defaultPrevented = true; - }, - defaultPrevented: false - }, - listenerArgs = concat([event], arguments, 1), - i, length; - - do { - namedListeners = scope.$$listeners[name] || empty; - event.currentScope = scope; - for (i = 0, length = namedListeners.length; i < length; i++) { - - // if listeners were deregistered, defragment the array - if (!namedListeners[i]) { - namedListeners.splice(i, 1); - i--; - length--; - continue; - } - try { - //allow all listeners attached to the current scope to run - namedListeners[i].apply(null, listenerArgs); - } catch (e) { - $exceptionHandler(e); - } - } - //if any listener on the current scope stops propagation, prevent bubbling - if (stopPropagation) { - break; - } - //traverse upwards - scope = scope.$parent; - } while (scope); - - event.currentScope = null; - - return event; - }, - - - /** - * @ngdoc method - * @name $rootScope.Scope#$broadcast - * @kind function - * - * @description - * Dispatches an event `name` downwards to all child scopes (and their children) notifying the - * registered {@link ng.$rootScope.Scope#$on} listeners. - * - * The event life cycle starts at the scope on which `$broadcast` was called. All - * {@link ng.$rootScope.Scope#$on listeners} listening for `name` event on this scope get - * notified. Afterwards, the event propagates to all direct and indirect scopes of the current - * scope and calls all registered listeners along the way. The event cannot be canceled. - * - * Any exception emitted from the {@link ng.$rootScope.Scope#$on listeners} will be passed - * onto the {@link ng.$exceptionHandler $exceptionHandler} service. - * - * @param {string} name Event name to broadcast. - * @param {...*} args Optional one or more arguments which will be passed onto the event listeners. - * @return {Object} Event object, see {@link ng.$rootScope.Scope#$on} - */ - $broadcast: function(name, args) { - var target = this, - current = target, - next = target, - event = { - name: name, - targetScope: target, - preventDefault: function() { - event.defaultPrevented = true; - }, - defaultPrevented: false - }; - - if (!target.$$listenerCount[name]) return event; - - var listenerArgs = concat([event], arguments, 1), - listeners, i, length; - - //down while you can, then up and next sibling or up and next sibling until back at root - while ((current = next)) { - event.currentScope = current; - listeners = current.$$listeners[name] || []; - for (i = 0, length = listeners.length; i < length; i++) { - // if listeners were deregistered, defragment the array - if (!listeners[i]) { - listeners.splice(i, 1); - i--; - length--; - continue; - } - - try { - listeners[i].apply(null, listenerArgs); - } catch (e) { - $exceptionHandler(e); - } - } - - // Insanity Warning: scope depth-first traversal - // yes, this code is a bit crazy, but it works and we have tests to prove it! - // this piece should be kept in sync with the traversal in $digest - // (though it differs due to having the extra check for $$listenerCount and - // does not check $$suspended) - if (!(next = ((current.$$listenerCount[name] && current.$$childHead) || - (current !== target && current.$$nextSibling)))) { - while (current !== target && !(next = current.$$nextSibling)) { - current = current.$parent; - } - } - } - - event.currentScope = null; - return event; - } - }; - - var $rootScope = new Scope(); - - //The internal queues. Expose them on the $rootScope for debugging/testing purposes. - var asyncQueue = $rootScope.$$asyncQueue = []; - var postDigestQueue = $rootScope.$$postDigestQueue = []; - var applyAsyncQueue = $rootScope.$$applyAsyncQueue = []; - - var postDigestQueuePosition = 0; - - return $rootScope; - - - function beginPhase(phase) { - if ($rootScope.$$phase) { - throw $rootScopeMinErr('inprog', '{0} already in progress', $rootScope.$$phase); - } - - $rootScope.$$phase = phase; - } - - function clearPhase() { - $rootScope.$$phase = null; - } - - function incrementWatchersCount(current, count) { - do { - current.$$watchersCount += count; - } while ((current = current.$parent)); - } - - function decrementListenerCount(current, count, name) { - do { - current.$$listenerCount[name] -= count; - - if (current.$$listenerCount[name] === 0) { - delete current.$$listenerCount[name]; - } - } while ((current = current.$parent)); - } - - /** - * function used as an initial value for watchers. - * because it's unique we can easily tell it apart from other values - */ - function initWatchVal() {} - - function flushApplyAsync() { - while (applyAsyncQueue.length) { - try { - applyAsyncQueue.shift()(); - } catch (e) { - $exceptionHandler(e); - } - } - applyAsyncId = null; - } - - function scheduleApplyAsync() { - if (applyAsyncId === null) { - applyAsyncId = $browser.defer(function() { - $rootScope.$apply(flushApplyAsync); - }, null, '$applyAsync'); - } - } - }]; -} - -/** - * @ngdoc service - * @name $rootElement - * - * @description - * The root element of AngularJS application. This is either the element where {@link - * ng.directive:ngApp ngApp} was declared or the element passed into - * {@link angular.bootstrap}. The element represents the root element of application. It is also the - * location where the application's {@link auto.$injector $injector} service gets - * published, and can be retrieved using `$rootElement.injector()`. - */ - - -// the implementation is in angular.bootstrap - -/** - * @this - * @description - * Private service to sanitize uris for links and images. Used by $compile and $sanitize. - */ -function $$SanitizeUriProvider() { - - var aHrefSanitizationWhitelist = /^\s*(https?|s?ftp|mailto|tel|file):/, - imgSrcSanitizationWhitelist = /^\s*((https?|ftp|file|blob):|data:image\/)/; - - /** - * @description - * Retrieves or overrides the default regular expression that is used for whitelisting of safe - * urls during a[href] sanitization. - * - * The sanitization is a security measure aimed at prevent XSS attacks via HTML anchor links. - * - * Any url due to be assigned to an `a[href]` attribute via interpolation is marked as requiring - * the $sce.URL security context. When interpolation occurs a call is made to `$sce.trustAsUrl(url)` - * which in turn may call `$$sanitizeUri(url, isMedia)` to sanitize the potentially malicious URL. - * - * If the URL matches the `aHrefSanitizationWhitelist` regular expression, it is returned unchanged. - * - * If there is no match the URL is returned prefixed with `'unsafe:'` to ensure that when it is written - * to the DOM it is inactive and potentially malicious code will not be executed. - * - * @param {RegExp=} regexp New regexp to whitelist urls with. - * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for - * chaining otherwise. - */ - this.aHrefSanitizationWhitelist = function(regexp) { - if (isDefined(regexp)) { - aHrefSanitizationWhitelist = regexp; - return this; - } - return aHrefSanitizationWhitelist; - }; - - - /** - * @description - * Retrieves or overrides the default regular expression that is used for whitelisting of safe - * urls during img[src] sanitization. - * - * The sanitization is a security measure aimed at prevent XSS attacks via HTML image src links. - * - * Any URL due to be assigned to an `img[src]` attribute via interpolation is marked as requiring - * the $sce.MEDIA_URL security context. When interpolation occurs a call is made to - * `$sce.trustAsMediaUrl(url)` which in turn may call `$$sanitizeUri(url, isMedia)` to sanitize - * the potentially malicious URL. - * - * If the URL matches the `aImgSanitizationWhitelist` regular expression, it is returned unchanged. - * - * If there is no match the URL is returned prefixed with `'unsafe:'` to ensure that when it is written - * to the DOM it is inactive and potentially malicious code will not be executed. - * - * @param {RegExp=} regexp New regexp to whitelist urls with. - * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for - * chaining otherwise. - */ - this.imgSrcSanitizationWhitelist = function(regexp) { - if (isDefined(regexp)) { - imgSrcSanitizationWhitelist = regexp; - return this; - } - return imgSrcSanitizationWhitelist; - }; - - this.$get = function() { - return function sanitizeUri(uri, isMediaUrl) { - // if (!uri) return uri; - var regex = isMediaUrl ? imgSrcSanitizationWhitelist : aHrefSanitizationWhitelist; - var normalizedVal = urlResolve(uri && uri.trim()).href; - if (normalizedVal !== '' && !normalizedVal.match(regex)) { - return 'unsafe:' + normalizedVal; - } - return uri; - }; - }; -} - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Any commits to this file should be reviewed with security in mind. * - * Changes to this file can potentially create security vulnerabilities. * - * An approval from 2 Core members with history of modifying * - * this file is required. * - * * - * Does the change somehow allow for arbitrary javascript to be executed? * - * Or allows for someone to change the prototype of built-in objects? * - * Or gives undesired access to variables likes document or window? * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* exported $SceProvider, $SceDelegateProvider */ - -var $sceMinErr = minErr('$sce'); - -var SCE_CONTEXTS = { - // HTML is used when there's HTML rendered (e.g. ng-bind-html, iframe srcdoc binding). - HTML: 'html', - - // Style statements or stylesheets. Currently unused in AngularJS. - CSS: 'css', - - // An URL used in a context where it refers to the source of media, which are not expected to be run - // as scripts, such as an image, audio, video, etc. - MEDIA_URL: 'mediaUrl', - - // An URL used in a context where it does not refer to a resource that loads code. - // A value that can be trusted as a URL can also trusted as a MEDIA_URL. - URL: 'url', - - // RESOURCE_URL is a subtype of URL used where the referred-to resource could be interpreted as - // code. (e.g. ng-include, script src binding, templateUrl) - // A value that can be trusted as a RESOURCE_URL, can also trusted as a URL and a MEDIA_URL. - RESOURCE_URL: 'resourceUrl', - - // Script. Currently unused in AngularJS. - JS: 'js' -}; - -// Helper functions follow. - -var UNDERSCORE_LOWERCASE_REGEXP = /_([a-z])/g; - -function snakeToCamel(name) { - return name - .replace(UNDERSCORE_LOWERCASE_REGEXP, fnCamelCaseReplace); -} - -function adjustMatcher(matcher) { - if (matcher === 'self') { - return matcher; - } else if (isString(matcher)) { - // Strings match exactly except for 2 wildcards - '*' and '**'. - // '*' matches any character except those from the set ':/.?&'. - // '**' matches any character (like .* in a RegExp). - // More than 2 *'s raises an error as it's ill defined. - if (matcher.indexOf('***') > -1) { - throw $sceMinErr('iwcard', - 'Illegal sequence *** in string matcher. String: {0}', matcher); - } - matcher = escapeForRegexp(matcher). - replace(/\\\*\\\*/g, '.*'). - replace(/\\\*/g, '[^:/.?&;]*'); - return new RegExp('^' + matcher + '$'); - } else if (isRegExp(matcher)) { - // The only other type of matcher allowed is a Regexp. - // Match entire URL / disallow partial matches. - // Flags are reset (i.e. no global, ignoreCase or multiline) - return new RegExp('^' + matcher.source + '$'); - } else { - throw $sceMinErr('imatcher', - 'Matchers may only be "self", string patterns or RegExp objects'); - } -} - - -function adjustMatchers(matchers) { - var adjustedMatchers = []; - if (isDefined(matchers)) { - forEach(matchers, function(matcher) { - adjustedMatchers.push(adjustMatcher(matcher)); - }); - } - return adjustedMatchers; -} - - -/** - * @ngdoc service - * @name $sceDelegate - * @kind function - * - * @description - * - * `$sceDelegate` is a service that is used by the `$sce` service to provide {@link ng.$sce Strict - * Contextual Escaping (SCE)} services to AngularJS. - * - * For an overview of this service and the functionnality it provides in AngularJS, see the main - * page for {@link ng.$sce SCE}. The current page is targeted for developers who need to alter how - * SCE works in their application, which shouldn't be needed in most cases. - * - *
    - * AngularJS strongly relies on contextual escaping for the security of bindings: disabling or - * modifying this might cause cross site scripting (XSS) vulnerabilities. For libraries owners, - * changes to this service will also influence users, so be extra careful and document your changes. - *
    - * - * Typically, you would configure or override the {@link ng.$sceDelegate $sceDelegate} instead of - * the `$sce` service to customize the way Strict Contextual Escaping works in AngularJS. This is - * because, while the `$sce` provides numerous shorthand methods, etc., you really only need to - * override 3 core functions (`trustAs`, `getTrusted` and `valueOf`) to replace the way things - * work because `$sce` delegates to `$sceDelegate` for these operations. - * - * Refer {@link ng.$sceDelegateProvider $sceDelegateProvider} to configure this service. - * - * The default instance of `$sceDelegate` should work out of the box with little pain. While you - * can override it completely to change the behavior of `$sce`, the common case would - * involve configuring the {@link ng.$sceDelegateProvider $sceDelegateProvider} instead by setting - * your own whitelists and blacklists for trusting URLs used for loading AngularJS resources such as - * templates. Refer {@link ng.$sceDelegateProvider#resourceUrlWhitelist - * $sceDelegateProvider.resourceUrlWhitelist} and {@link - * ng.$sceDelegateProvider#resourceUrlBlacklist $sceDelegateProvider.resourceUrlBlacklist} - */ - -/** - * @ngdoc provider - * @name $sceDelegateProvider - * @this - * - * @description - * - * The `$sceDelegateProvider` provider allows developers to configure the {@link ng.$sceDelegate - * $sceDelegate service}, used as a delegate for {@link ng.$sce Strict Contextual Escaping (SCE)}. - * - * The `$sceDelegateProvider` allows one to get/set the whitelists and blacklists used to ensure - * that the URLs used for sourcing AngularJS templates and other script-running URLs are safe (all - * places that use the `$sce.RESOURCE_URL` context). See - * {@link ng.$sceDelegateProvider#resourceUrlWhitelist $sceDelegateProvider.resourceUrlWhitelist} - * and - * {@link ng.$sceDelegateProvider#resourceUrlBlacklist $sceDelegateProvider.resourceUrlBlacklist}, - * - * For the general details about this service in AngularJS, read the main page for {@link ng.$sce - * Strict Contextual Escaping (SCE)}. - * - * **Example**: Consider the following case.
    - * - * - your app is hosted at url `http://myapp.example.com/` - * - but some of your templates are hosted on other domains you control such as - * `http://srv01.assets.example.com/`, `http://srv02.assets.example.com/`, etc. - * - and you have an open redirect at `http://myapp.example.com/clickThru?...`. - * - * Here is what a secure configuration for this scenario might look like: - * - * ``` - * angular.module('myApp', []).config(function($sceDelegateProvider) { - * $sceDelegateProvider.resourceUrlWhitelist([ - * // Allow same origin resource loads. - * 'self', - * // Allow loading from our assets domain. Notice the difference between * and **. - * 'http://srv*.assets.example.com/**' - * ]); - * - * // The blacklist overrides the whitelist so the open redirect here is blocked. - * $sceDelegateProvider.resourceUrlBlacklist([ - * 'http://myapp.example.com/clickThru**' - * ]); - * }); - * ``` - * Note that an empty whitelist will block every resource URL from being loaded, and will require - * you to manually mark each one as trusted with `$sce.trustAsResourceUrl`. However, templates - * requested by {@link ng.$templateRequest $templateRequest} that are present in - * {@link ng.$templateCache $templateCache} will not go through this check. If you have a mechanism - * to populate your templates in that cache at config time, then it is a good idea to remove 'self' - * from that whitelist. This helps to mitigate the security impact of certain types of issues, like - * for instance attacker-controlled `ng-includes`. - */ - -function $SceDelegateProvider() { - this.SCE_CONTEXTS = SCE_CONTEXTS; - - // Resource URLs can also be trusted by policy. - var resourceUrlWhitelist = ['self'], - resourceUrlBlacklist = []; - - /** - * @ngdoc method - * @name $sceDelegateProvider#resourceUrlWhitelist - * @kind function - * - * @param {Array=} whitelist When provided, replaces the resourceUrlWhitelist with the value - * provided. This must be an array or null. A snapshot of this array is used so further - * changes to the array are ignored. - * Follow {@link ng.$sce#resourceUrlPatternItem this link} for a description of the items - * allowed in this array. - * - * @return {Array} The currently set whitelist array. - * - * @description - * Sets/Gets the whitelist of trusted resource URLs. - * - * The **default value** when no whitelist has been explicitly set is `['self']` allowing only - * same origin resource requests. - * - *
    - * **Note:** the default whitelist of 'self' is not recommended if your app shares its origin - * with other apps! It is a good idea to limit it to only your application's directory. - *
    - */ - this.resourceUrlWhitelist = function(value) { - if (arguments.length) { - resourceUrlWhitelist = adjustMatchers(value); - } - return resourceUrlWhitelist; - }; - - /** - * @ngdoc method - * @name $sceDelegateProvider#resourceUrlBlacklist - * @kind function - * - * @param {Array=} blacklist When provided, replaces the resourceUrlBlacklist with the value - * provided. This must be an array or null. A snapshot of this array is used so further - * changes to the array are ignored.

    - * Follow {@link ng.$sce#resourceUrlPatternItem this link} for a description of the items - * allowed in this array.

    - * The typical usage for the blacklist is to **block - * [open redirects](http://cwe.mitre.org/data/definitions/601.html)** served by your domain as - * these would otherwise be trusted but actually return content from the redirected domain. - *

    - * Finally, **the blacklist overrides the whitelist** and has the final say. - * - * @return {Array} The currently set blacklist array. - * - * @description - * Sets/Gets the blacklist of trusted resource URLs. - * - * The **default value** when no whitelist has been explicitly set is the empty array (i.e. there - * is no blacklist.) - */ - - this.resourceUrlBlacklist = function(value) { - if (arguments.length) { - resourceUrlBlacklist = adjustMatchers(value); - } - return resourceUrlBlacklist; - }; - - this.$get = ['$injector', '$$sanitizeUri', function($injector, $$sanitizeUri) { - - var htmlSanitizer = function htmlSanitizer(html) { - throw $sceMinErr('unsafe', 'Attempting to use an unsafe value in a safe context.'); - }; - - if ($injector.has('$sanitize')) { - htmlSanitizer = $injector.get('$sanitize'); - } - - - function matchUrl(matcher, parsedUrl) { - if (matcher === 'self') { - return urlIsSameOrigin(parsedUrl) || urlIsSameOriginAsBaseUrl(parsedUrl); - } else { - // definitely a regex. See adjustMatchers() - return !!matcher.exec(parsedUrl.href); - } - } - - function isResourceUrlAllowedByPolicy(url) { - var parsedUrl = urlResolve(url.toString()); - var i, n, allowed = false; - // Ensure that at least one item from the whitelist allows this url. - for (i = 0, n = resourceUrlWhitelist.length; i < n; i++) { - if (matchUrl(resourceUrlWhitelist[i], parsedUrl)) { - allowed = true; - break; - } - } - if (allowed) { - // Ensure that no item from the blacklist blocked this url. - for (i = 0, n = resourceUrlBlacklist.length; i < n; i++) { - if (matchUrl(resourceUrlBlacklist[i], parsedUrl)) { - allowed = false; - break; - } - } - } - return allowed; - } - - function generateHolderType(Base) { - var holderType = function TrustedValueHolderType(trustedValue) { - this.$$unwrapTrustedValue = function() { - return trustedValue; - }; - }; - if (Base) { - holderType.prototype = new Base(); - } - holderType.prototype.valueOf = function sceValueOf() { - return this.$$unwrapTrustedValue(); - }; - holderType.prototype.toString = function sceToString() { - return this.$$unwrapTrustedValue().toString(); - }; - return holderType; - } - - var trustedValueHolderBase = generateHolderType(), - byType = {}; - - byType[SCE_CONTEXTS.HTML] = generateHolderType(trustedValueHolderBase); - byType[SCE_CONTEXTS.CSS] = generateHolderType(trustedValueHolderBase); - byType[SCE_CONTEXTS.MEDIA_URL] = generateHolderType(trustedValueHolderBase); - byType[SCE_CONTEXTS.URL] = generateHolderType(byType[SCE_CONTEXTS.MEDIA_URL]); - byType[SCE_CONTEXTS.JS] = generateHolderType(trustedValueHolderBase); - byType[SCE_CONTEXTS.RESOURCE_URL] = generateHolderType(byType[SCE_CONTEXTS.URL]); - - /** - * @ngdoc method - * @name $sceDelegate#trustAs - * - * @description - * Returns a trusted representation of the parameter for the specified context. This trusted - * object will later on be used as-is, without any security check, by bindings or directives - * that require this security context. - * For instance, marking a string as trusted for the `$sce.HTML` context will entirely bypass - * the potential `$sanitize` call in corresponding `$sce.HTML` bindings or directives, such as - * `ng-bind-html`. Note that in most cases you won't need to call this function: if you have the - * sanitizer loaded, passing the value itself will render all the HTML that does not pose a - * security risk. - * - * See {@link ng.$sceDelegate#getTrusted getTrusted} for the function that will consume those - * trusted values, and {@link ng.$sce $sce} for general documentation about strict contextual - * escaping. - * - * @param {string} type The context in which this value is safe for use, e.g. `$sce.URL`, - * `$sce.RESOURCE_URL`, `$sce.HTML`, `$sce.JS` or `$sce.CSS`. - * - * @param {*} value The value that should be considered trusted. - * @return {*} A trusted representation of value, that can be used in the given context. - */ - function trustAs(type, trustedValue) { - var Constructor = (byType.hasOwnProperty(type) ? byType[type] : null); - if (!Constructor) { - throw $sceMinErr('icontext', - 'Attempted to trust a value in invalid context. Context: {0}; Value: {1}', - type, trustedValue); - } - if (trustedValue === null || isUndefined(trustedValue) || trustedValue === '') { - return trustedValue; - } - // All the current contexts in SCE_CONTEXTS happen to be strings. In order to avoid trusting - // mutable objects, we ensure here that the value passed in is actually a string. - if (typeof trustedValue !== 'string') { - throw $sceMinErr('itype', - 'Attempted to trust a non-string value in a content requiring a string: Context: {0}', - type); - } - return new Constructor(trustedValue); - } - - /** - * @ngdoc method - * @name $sceDelegate#valueOf - * - * @description - * If the passed parameter had been returned by a prior call to {@link ng.$sceDelegate#trustAs - * `$sceDelegate.trustAs`}, returns the value that had been passed to {@link - * ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}. - * - * If the passed parameter is not a value that had been returned by {@link - * ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}, it must be returned as-is. - * - * @param {*} value The result of a prior {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs`} - * call or anything else. - * @return {*} The `value` that was originally provided to {@link ng.$sceDelegate#trustAs - * `$sceDelegate.trustAs`} if `value` is the result of such a call. Otherwise, returns - * `value` unchanged. - */ - function valueOf(maybeTrusted) { - if (maybeTrusted instanceof trustedValueHolderBase) { - return maybeTrusted.$$unwrapTrustedValue(); - } else { - return maybeTrusted; - } - } - - /** - * @ngdoc method - * @name $sceDelegate#getTrusted - * - * @description - * Given an object and a security context in which to assign it, returns a value that's safe to - * use in this context, which was represented by the parameter. To do so, this function either - * unwraps the safe type it has been given (for instance, a {@link ng.$sceDelegate#trustAs - * `$sceDelegate.trustAs`} result), or it might try to sanitize the value given, depending on - * the context and sanitizer availablility. - * - * The contexts that can be sanitized are $sce.MEDIA_URL, $sce.URL and $sce.HTML. The first two are available - * by default, and the third one relies on the `$sanitize` service (which may be loaded through - * the `ngSanitize` module). Furthermore, for $sce.RESOURCE_URL context, a plain string may be - * accepted if the resource url policy defined by {@link ng.$sceDelegateProvider#resourceUrlWhitelist - * `$sceDelegateProvider.resourceUrlWhitelist`} and {@link ng.$sceDelegateProvider#resourceUrlBlacklist - * `$sceDelegateProvider.resourceUrlBlacklist`} accepts that resource. - * - * This function will throw if the safe type isn't appropriate for this context, or if the - * value given cannot be accepted in the context (which might be caused by sanitization not - * being available, or the value not being recognized as safe). - * - *

    - * Disabling auto-escaping is extremely dangerous, it usually creates a Cross Site Scripting - * (XSS) vulnerability in your application. - *
    - * - * @param {string} type The context in which this value is to be used (such as `$sce.HTML`). - * @param {*} maybeTrusted The result of a prior {@link ng.$sceDelegate#trustAs - * `$sceDelegate.trustAs`} call, or anything else (which will not be considered trusted.) - * @return {*} A version of the value that's safe to use in the given context, or throws an - * exception if this is impossible. - */ - function getTrusted(type, maybeTrusted) { - if (maybeTrusted === null || isUndefined(maybeTrusted) || maybeTrusted === '') { - return maybeTrusted; - } - var constructor = (byType.hasOwnProperty(type) ? byType[type] : null); - // If maybeTrusted is a trusted class instance or subclass instance, then unwrap and return - // as-is. - if (constructor && maybeTrusted instanceof constructor) { - return maybeTrusted.$$unwrapTrustedValue(); - } - - // If maybeTrusted is a trusted class instance but not of the correct trusted type - // then unwrap it and allow it to pass through to the rest of the checks - if (isFunction(maybeTrusted.$$unwrapTrustedValue)) { - maybeTrusted = maybeTrusted.$$unwrapTrustedValue(); - } - - // If we get here, then we will either sanitize the value or throw an exception. - if (type === SCE_CONTEXTS.MEDIA_URL || type === SCE_CONTEXTS.URL) { - // we attempt to sanitize non-resource URLs - return $$sanitizeUri(maybeTrusted.toString(), type === SCE_CONTEXTS.MEDIA_URL); - } else if (type === SCE_CONTEXTS.RESOURCE_URL) { - if (isResourceUrlAllowedByPolicy(maybeTrusted)) { - return maybeTrusted; - } else { - throw $sceMinErr('insecurl', - 'Blocked loading resource from url not allowed by $sceDelegate policy. URL: {0}', - maybeTrusted.toString()); - } - } else if (type === SCE_CONTEXTS.HTML) { - // htmlSanitizer throws its own error when no sanitizer is available. - return htmlSanitizer(maybeTrusted); - } - // Default error when the $sce service has no way to make the input safe. - throw $sceMinErr('unsafe', 'Attempting to use an unsafe value in a safe context.'); - } - - return { trustAs: trustAs, - getTrusted: getTrusted, - valueOf: valueOf }; - }]; -} - - -/** - * @ngdoc provider - * @name $sceProvider - * @this - * - * @description - * - * The $sceProvider provider allows developers to configure the {@link ng.$sce $sce} service. - * - enable/disable Strict Contextual Escaping (SCE) in a module - * - override the default implementation with a custom delegate - * - * Read more about {@link ng.$sce Strict Contextual Escaping (SCE)}. - */ - -/** - * @ngdoc service - * @name $sce - * @kind function - * - * @description - * - * `$sce` is a service that provides Strict Contextual Escaping services to AngularJS. - * - * ## Strict Contextual Escaping - * - * Strict Contextual Escaping (SCE) is a mode in which AngularJS constrains bindings to only render - * trusted values. Its goal is to assist in writing code in a way that (a) is secure by default, and - * (b) makes auditing for security vulnerabilities such as XSS, clickjacking, etc. a lot easier. - * - * ### Overview - * - * To systematically block XSS security bugs, AngularJS treats all values as untrusted by default in - * HTML or sensitive URL bindings. When binding untrusted values, AngularJS will automatically - * run security checks on them (sanitizations, whitelists, depending on context), or throw when it - * cannot guarantee the security of the result. That behavior depends strongly on contexts: HTML - * can be sanitized, but template URLs cannot, for instance. - * - * To illustrate this, consider the `ng-bind-html` directive. It renders its value directly as HTML: - * we call that the *context*. When given an untrusted input, AngularJS will attempt to sanitize it - * before rendering if a sanitizer is available, and throw otherwise. To bypass sanitization and - * render the input as-is, you will need to mark it as trusted for that context before attempting - * to bind it. - * - * As of version 1.2, AngularJS ships with SCE enabled by default. - * - * ### In practice - * - * Here's an example of a binding in a privileged context: - * - * ``` - * - *
    - * ``` - * - * Notice that `ng-bind-html` is bound to `userHtml` controlled by the user. With SCE - * disabled, this application allows the user to render arbitrary HTML into the DIV, which would - * be an XSS security bug. In a more realistic example, one may be rendering user comments, blog - * articles, etc. via bindings. (HTML is just one example of a context where rendering user - * controlled input creates security vulnerabilities.) - * - * For the case of HTML, you might use a library, either on the client side, or on the server side, - * to sanitize unsafe HTML before binding to the value and rendering it in the document. - * - * How would you ensure that every place that used these types of bindings was bound to a value that - * was sanitized by your library (or returned as safe for rendering by your server?) How can you - * ensure that you didn't accidentally delete the line that sanitized the value, or renamed some - * properties/fields and forgot to update the binding to the sanitized value? - * - * To be secure by default, AngularJS makes sure bindings go through that sanitization, or - * any similar validation process, unless there's a good reason to trust the given value in this - * context. That trust is formalized with a function call. This means that as a developer, you - * can assume all untrusted bindings are safe. Then, to audit your code for binding security issues, - * you just need to ensure the values you mark as trusted indeed are safe - because they were - * received from your server, sanitized by your library, etc. You can organize your codebase to - * help with this - perhaps allowing only the files in a specific directory to do this. - * Ensuring that the internal API exposed by that code doesn't markup arbitrary values as safe then - * becomes a more manageable task. - * - * In the case of AngularJS' SCE service, one uses {@link ng.$sce#trustAs $sce.trustAs} - * (and shorthand methods such as {@link ng.$sce#trustAsHtml $sce.trustAsHtml}, etc.) to - * build the trusted versions of your values. - * - * ### How does it work? - * - * In privileged contexts, directives and code will bind to the result of {@link ng.$sce#getTrusted - * $sce.getTrusted(context, value)} rather than to the value directly. Think of this function as - * a way to enforce the required security context in your data sink. Directives use {@link - * ng.$sce#parseAs $sce.parseAs} rather than `$parse` to watch attribute bindings, which performs - * the {@link ng.$sce#getTrusted $sce.getTrusted} behind the scenes on non-constant literals. Also, - * when binding without directives, AngularJS will understand the context of your bindings - * automatically. - * - * As an example, {@link ng.directive:ngBindHtml ngBindHtml} uses {@link - * ng.$sce#parseAsHtml $sce.parseAsHtml(binding expression)}. Here's the actual code (slightly - * simplified): - * - * ``` - * var ngBindHtmlDirective = ['$sce', function($sce) { - * return function(scope, element, attr) { - * scope.$watch($sce.parseAsHtml(attr.ngBindHtml), function(value) { - * element.html(value || ''); - * }); - * }; - * }]; - * ``` - * - * ### Impact on loading templates - * - * This applies both to the {@link ng.directive:ngInclude `ng-include`} directive as well as - * `templateUrl`'s specified by {@link guide/directive directives}. - * - * By default, AngularJS only loads templates from the same domain and protocol as the application - * document. This is done by calling {@link ng.$sce#getTrustedResourceUrl - * $sce.getTrustedResourceUrl} on the template URL. To load templates from other domains and/or - * protocols, you may either {@link ng.$sceDelegateProvider#resourceUrlWhitelist whitelist - * them} or {@link ng.$sce#trustAsResourceUrl wrap it} into a trusted value. - * - * *Please note*: - * The browser's - * [Same Origin Policy](https://code.google.com/p/browsersec/wiki/Part2#Same-origin_policy_for_XMLHttpRequest) - * and [Cross-Origin Resource Sharing (CORS)](http://www.w3.org/TR/cors/) - * policy apply in addition to this and may further restrict whether the template is successfully - * loaded. This means that without the right CORS policy, loading templates from a different domain - * won't work on all browsers. Also, loading templates from `file://` URL does not work on some - * browsers. - * - * ### This feels like too much overhead - * - * It's important to remember that SCE only applies to interpolation expressions. - * - * If your expressions are constant literals, they're automatically trusted and you don't need to - * call `$sce.trustAs` on them (e.g. - * `
    `) just works (remember to include the - * `ngSanitize` module). The `$sceDelegate` will also use the `$sanitize` service if it is available - * when binding untrusted values to `$sce.HTML` context. - * AngularJS provides an implementation in `angular-sanitize.js`, and if you - * wish to use it, you will also need to depend on the {@link ngSanitize `ngSanitize`} module in - * your application. - * - * The included {@link ng.$sceDelegate $sceDelegate} comes with sane defaults to allow you to load - * templates in `ng-include` from your application's domain without having to even know about SCE. - * It blocks loading templates from other domains or loading templates over http from an https - * served document. You can change these by setting your own custom {@link - * ng.$sceDelegateProvider#resourceUrlWhitelist whitelists} and {@link - * ng.$sceDelegateProvider#resourceUrlBlacklist blacklists} for matching such URLs. - * - * This significantly reduces the overhead. It is far easier to pay the small overhead and have an - * application that's secure and can be audited to verify that with much more ease than bolting - * security onto an application later. - * - * - * ### What trusted context types are supported? - * - * | Context | Notes | - * |---------------------|----------------| - * | `$sce.HTML` | For HTML that's safe to source into the application. The {@link ng.directive:ngBindHtml ngBindHtml} directive uses this context for bindings. If an unsafe value is encountered and the {@link ngSanitize $sanitize} module is present this will sanitize the value instead of throwing an error. | - * | `$sce.CSS` | For CSS that's safe to source into the application. Currently unused. Feel free to use it in your own directives. | - * | `$sce.MEDIA_URL` | For URLs that are safe to render as media. Is automatically converted from string by sanitizing when needed. | - * | `$sce.URL` | For URLs that are safe to follow as links. Is automatically converted from string by sanitizing when needed. Note that `$sce.URL` makes a stronger statement about the URL than `$sce.MEDIA_URL` does and therefore contexts requiring values trusted for `$sce.URL` can be used anywhere that values trusted for `$sce.MEDIA_URL` are required.| - * | `$sce.RESOURCE_URL` | For URLs that are not only safe to follow as links, but whose contents are also safe to include in your application. Examples include `ng-include`, `src` / `ngSrc` bindings for tags other than `IMG` (e.g. `IFRAME`, `OBJECT`, etc.)

    Note that `$sce.RESOURCE_URL` makes a stronger statement about the URL than `$sce.URL` or `$sce.MEDIA_URL` do and therefore contexts requiring values trusted for `$sce.RESOURCE_URL` can be used anywhere that values trusted for `$sce.URL` or `$sce.MEDIA_URL` are required.

    The {@link $sceDelegateProvider#resourceUrlWhitelist $sceDelegateProvider#resourceUrlWhitelist()} and {@link $sceDelegateProvider#resourceUrlBlacklist $sceDelegateProvider#resourceUrlBlacklist()} can be used to restrict trusted origins for `RESOURCE_URL` | - * | `$sce.JS` | For JavaScript that is safe to execute in your application's context. Currently unused. Feel free to use it in your own directives. | - * - * - *
    - * Be aware that, before AngularJS 1.7.0, `a[href]` and `img[src]` used to sanitize their - * interpolated values directly rather than rely upon {@link ng.$sce#getTrusted `$sce.getTrusted`}. - * - * **As of 1.7.0, this is no longer the case.** - * - * Now such interpolations are marked as requiring `$sce.URL` (for `a[href]`) or `$sce.MEDIA_URL` - * (for `img[src]`), so that the sanitization happens (via `$sce.getTrusted...`) when the `$interpolate` - * service evaluates the expressions. - *
    - * - * There are no CSS or JS context bindings in AngularJS currently, so their corresponding `$sce.trustAs` - * functions aren't useful yet. This might evolve. - * - * ### Format of items in {@link ng.$sceDelegateProvider#resourceUrlWhitelist resourceUrlWhitelist}/{@link ng.$sceDelegateProvider#resourceUrlBlacklist Blacklist} - * - * Each element in these arrays must be one of the following: - * - * - **'self'** - * - The special **string**, `'self'`, can be used to match against all URLs of the **same - * domain** as the application document using the **same protocol**. - * - **String** (except the special value `'self'`) - * - The string is matched against the full *normalized / absolute URL* of the resource - * being tested (substring matches are not good enough.) - * - There are exactly **two wildcard sequences** - `*` and `**`. All other characters - * match themselves. - * - `*`: matches zero or more occurrences of any character other than one of the following 6 - * characters: '`:`', '`/`', '`.`', '`?`', '`&`' and '`;`'. It's a useful wildcard for use - * in a whitelist. - * - `**`: matches zero or more occurrences of *any* character. As such, it's not - * appropriate for use in a scheme, domain, etc. as it would match too much. (e.g. - * http://**.example.com/ would match http://evil.com/?ignore=.example.com/ and that might - * not have been the intention.) Its usage at the very end of the path is ok. (e.g. - * http://foo.example.com/templates/**). - * - **RegExp** (*see caveat below*) - * - *Caveat*: While regular expressions are powerful and offer great flexibility, their syntax - * (and all the inevitable escaping) makes them *harder to maintain*. It's easy to - * accidentally introduce a bug when one updates a complex expression (imho, all regexes should - * have good test coverage). For instance, the use of `.` in the regex is correct only in a - * small number of cases. A `.` character in the regex used when matching the scheme or a - * subdomain could be matched against a `:` or literal `.` that was likely not intended. It - * is highly recommended to use the string patterns and only fall back to regular expressions - * as a last resort. - * - The regular expression must be an instance of RegExp (i.e. not a string.) It is - * matched against the **entire** *normalized / absolute URL* of the resource being tested - * (even when the RegExp did not have the `^` and `$` codes.) In addition, any flags - * present on the RegExp (such as multiline, global, ignoreCase) are ignored. - * - If you are generating your JavaScript from some other templating engine (not - * recommended, e.g. in issue [#4006](https://github.com/angular/angular.js/issues/4006)), - * remember to escape your regular expression (and be aware that you might need more than - * one level of escaping depending on your templating engine and the way you interpolated - * the value.) Do make use of your platform's escaping mechanism as it might be good - * enough before coding your own. E.g. Ruby has - * [Regexp.escape(str)](http://www.ruby-doc.org/core-2.0.0/Regexp.html#method-c-escape) - * and Python has [re.escape](http://docs.python.org/library/re.html#re.escape). - * Javascript lacks a similar built in function for escaping. Take a look at Google - * Closure library's [goog.string.regExpEscape(s)]( - * http://docs.closure-library.googlecode.com/git/closure_goog_string_string.js.source.html#line962). - * - * Refer {@link ng.$sceDelegateProvider $sceDelegateProvider} for an example. - * - * ### Show me an example using SCE. - * - * - * - *
    - *

    - * User comments
    - * By default, HTML that isn't explicitly trusted (e.g. Alice's comment) is sanitized when - * $sanitize is available. If $sanitize isn't available, this results in an error instead of an - * exploit. - *
    - *
    - * {{userComment.name}}: - * - *
    - *
    - *
    - *
    - *
    - * - * - * angular.module('mySceApp', ['ngSanitize']) - * .controller('AppController', ['$http', '$templateCache', '$sce', - * function AppController($http, $templateCache, $sce) { - * var self = this; - * $http.get('test_data.json', {cache: $templateCache}).then(function(response) { - * self.userComments = response.data; - * }); - * self.explicitlyTrustedHtml = $sce.trustAsHtml( - * 'Hover over this text.'); - * }]); - * - * - * - * [ - * { "name": "Alice", - * "htmlComment": - * "Is anyone reading this?" - * }, - * { "name": "Bob", - * "htmlComment": "Yes! Am I the only other one?" - * } - * ] - * - * - * - * describe('SCE doc demo', function() { - * it('should sanitize untrusted values', function() { - * expect(element.all(by.css('.htmlComment')).first().getAttribute('innerHTML')) - * .toBe('Is anyone reading this?'); - * }); - * - * it('should NOT sanitize explicitly trusted values', function() { - * expect(element(by.id('explicitlyTrustedHtml')).getAttribute('innerHTML')).toBe( - * 'Hover over this text.'); - * }); - * }); - * - *
    - * - * - * - * ## Can I disable SCE completely? - * - * Yes, you can. However, this is strongly discouraged. SCE gives you a lot of security benefits - * for little coding overhead. It will be much harder to take an SCE disabled application and - * either secure it on your own or enable SCE at a later stage. It might make sense to disable SCE - * for cases where you have a lot of existing code that was written before SCE was introduced and - * you're migrating them a module at a time. Also do note that this is an app-wide setting, so if - * you are writing a library, you will cause security bugs applications using it. - * - * That said, here's how you can completely disable SCE: - * - * ``` - * angular.module('myAppWithSceDisabledmyApp', []).config(function($sceProvider) { - * // Completely disable SCE. For demonstration purposes only! - * // Do not use in new projects or libraries. - * $sceProvider.enabled(false); - * }); - * ``` - * - */ - -function $SceProvider() { - var enabled = true; - - /** - * @ngdoc method - * @name $sceProvider#enabled - * @kind function - * - * @param {boolean=} value If provided, then enables/disables SCE application-wide. - * @return {boolean} True if SCE is enabled, false otherwise. - * - * @description - * Enables/disables SCE and returns the current value. - */ - this.enabled = function(value) { - if (arguments.length) { - enabled = !!value; - } - return enabled; - }; - - - /* Design notes on the default implementation for SCE. - * - * The API contract for the SCE delegate - * ------------------------------------- - * The SCE delegate object must provide the following 3 methods: - * - * - trustAs(contextEnum, value) - * This method is used to tell the SCE service that the provided value is OK to use in the - * contexts specified by contextEnum. It must return an object that will be accepted by - * getTrusted() for a compatible contextEnum and return this value. - * - * - valueOf(value) - * For values that were not produced by trustAs(), return them as is. For values that were - * produced by trustAs(), return the corresponding input value to trustAs. Basically, if - * trustAs is wrapping the given values into some type, this operation unwraps it when given - * such a value. - * - * - getTrusted(contextEnum, value) - * This function should return the value that is safe to use in the context specified by - * contextEnum or throw and exception otherwise. - * - * NOTE: This contract deliberately does NOT state that values returned by trustAs() must be - * opaque or wrapped in some holder object. That happens to be an implementation detail. For - * instance, an implementation could maintain a registry of all trusted objects by context. In - * such a case, trustAs() would return the same object that was passed in. getTrusted() would - * return the same object passed in if it was found in the registry under a compatible context or - * throw an exception otherwise. An implementation might only wrap values some of the time based - * on some criteria. getTrusted() might return a value and not throw an exception for special - * constants or objects even if not wrapped. All such implementations fulfill this contract. - * - * - * A note on the inheritance model for SCE contexts - * ------------------------------------------------ - * I've used inheritance and made RESOURCE_URL wrapped types a subtype of URL wrapped types. This - * is purely an implementation details. - * - * The contract is simply this: - * - * getTrusted($sce.RESOURCE_URL, value) succeeding implies that getTrusted($sce.URL, value) - * will also succeed. - * - * Inheritance happens to capture this in a natural way. In some future, we may not use - * inheritance anymore. That is OK because no code outside of sce.js and sceSpecs.js would need to - * be aware of this detail. - */ - - this.$get = ['$parse', '$sceDelegate', function( - $parse, $sceDelegate) { - // Support: IE 9-11 only - // Prereq: Ensure that we're not running in IE<11 quirks mode. In that mode, IE < 11 allow - // the "expression(javascript expression)" syntax which is insecure. - if (enabled && msie < 8) { - throw $sceMinErr('iequirks', - 'Strict Contextual Escaping does not support Internet Explorer version < 11 in quirks ' + - 'mode. You can fix this by adding the text to the top of your HTML ' + - 'document. See http://docs.angularjs.org/api/ng.$sce for more information.'); - } - - var sce = shallowCopy(SCE_CONTEXTS); - - /** - * @ngdoc method - * @name $sce#isEnabled - * @kind function - * - * @return {Boolean} True if SCE is enabled, false otherwise. If you want to set the value, you - * have to do it at module config time on {@link ng.$sceProvider $sceProvider}. - * - * @description - * Returns a boolean indicating if SCE is enabled. - */ - sce.isEnabled = function() { - return enabled; - }; - sce.trustAs = $sceDelegate.trustAs; - sce.getTrusted = $sceDelegate.getTrusted; - sce.valueOf = $sceDelegate.valueOf; - - if (!enabled) { - sce.trustAs = sce.getTrusted = function(type, value) { return value; }; - sce.valueOf = identity; - } - - /** - * @ngdoc method - * @name $sce#parseAs - * - * @description - * Converts AngularJS {@link guide/expression expression} into a function. This is like {@link - * ng.$parse $parse} and is identical when the expression is a literal constant. Otherwise, it - * wraps the expression in a call to {@link ng.$sce#getTrusted $sce.getTrusted(*type*, - * *result*)} - * - * @param {string} type The SCE context in which this result will be used. - * @param {string} expression String expression to compile. - * @return {function(context, locals)} A function which represents the compiled expression: - * - * * `context` – `{object}` – an object against which any expressions embedded in the - * strings are evaluated against (typically a scope object). - * * `locals` – `{object=}` – local variables context object, useful for overriding values - * in `context`. - */ - sce.parseAs = function sceParseAs(type, expr) { - var parsed = $parse(expr); - if (parsed.literal && parsed.constant) { - return parsed; - } else { - return $parse(expr, function(value) { - return sce.getTrusted(type, value); - }); - } - }; - - /** - * @ngdoc method - * @name $sce#trustAs - * - * @description - * Delegates to {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}. As such, returns a - * wrapped object that represents your value, and the trust you have in its safety for the given - * context. AngularJS can then use that value as-is in bindings of the specified secure context. - * This is used in bindings for `ng-bind-html`, `ng-include`, and most `src` attribute - * interpolations. See {@link ng.$sce $sce} for strict contextual escaping. - * - * @param {string} type The context in which this value is safe for use, e.g. `$sce.URL`, - * `$sce.RESOURCE_URL`, `$sce.HTML`, `$sce.JS` or `$sce.CSS`. - * - * @param {*} value The value that that should be considered trusted. - * @return {*} A wrapped version of value that can be used as a trusted variant of your `value` - * in the context you specified. - */ - - /** - * @ngdoc method - * @name $sce#trustAsHtml - * - * @description - * Shorthand method. `$sce.trustAsHtml(value)` → - * {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.HTML, value)`} - * - * @param {*} value The value to mark as trusted for `$sce.HTML` context. - * @return {*} A wrapped version of value that can be used as a trusted variant of your `value` - * in `$sce.HTML` context (like `ng-bind-html`). - */ - - /** - * @ngdoc method - * @name $sce#trustAsCss - * - * @description - * Shorthand method. `$sce.trustAsCss(value)` → - * {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.CSS, value)`} - * - * @param {*} value The value to mark as trusted for `$sce.CSS` context. - * @return {*} A wrapped version of value that can be used as a trusted variant - * of your `value` in `$sce.CSS` context. This context is currently unused, so there are - * almost no reasons to use this function so far. - */ - - /** - * @ngdoc method - * @name $sce#trustAsUrl - * - * @description - * Shorthand method. `$sce.trustAsUrl(value)` → - * {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.URL, value)`} - * - * @param {*} value The value to mark as trusted for `$sce.URL` context. - * @return {*} A wrapped version of value that can be used as a trusted variant of your `value` - * in `$sce.URL` context. That context is currently unused, so there are almost no reasons - * to use this function so far. - */ - - /** - * @ngdoc method - * @name $sce#trustAsResourceUrl - * - * @description - * Shorthand method. `$sce.trustAsResourceUrl(value)` → - * {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.RESOURCE_URL, value)`} - * - * @param {*} value The value to mark as trusted for `$sce.RESOURCE_URL` context. - * @return {*} A wrapped version of value that can be used as a trusted variant of your `value` - * in `$sce.RESOURCE_URL` context (template URLs in `ng-include`, most `src` attribute - * bindings, ...) - */ - - /** - * @ngdoc method - * @name $sce#trustAsJs - * - * @description - * Shorthand method. `$sce.trustAsJs(value)` → - * {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.JS, value)`} - * - * @param {*} value The value to mark as trusted for `$sce.JS` context. - * @return {*} A wrapped version of value that can be used as a trusted variant of your `value` - * in `$sce.JS` context. That context is currently unused, so there are almost no reasons to - * use this function so far. - */ - - /** - * @ngdoc method - * @name $sce#getTrusted - * - * @description - * Delegates to {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted`}. As such, - * takes any input, and either returns a value that's safe to use in the specified context, - * or throws an exception. This function is aware of trusted values created by the `trustAs` - * function and its shorthands, and when contexts are appropriate, returns the unwrapped value - * as-is. Finally, this function can also throw when there is no way to turn `maybeTrusted` in a - * safe value (e.g., no sanitization is available or possible.) - * - * @param {string} type The context in which this value is to be used. - * @param {*} maybeTrusted The result of a prior {@link ng.$sce#trustAs - * `$sce.trustAs`} call, or anything else (which will not be considered trusted.) - * @return {*} A version of the value that's safe to use in the given context, or throws an - * exception if this is impossible. - */ - - /** - * @ngdoc method - * @name $sce#getTrustedHtml - * - * @description - * Shorthand method. `$sce.getTrustedHtml(value)` → - * {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.HTML, value)`} - * - * @param {*} value The value to pass to `$sce.getTrusted`. - * @return {*} The return value of `$sce.getTrusted($sce.HTML, value)` - */ - - /** - * @ngdoc method - * @name $sce#getTrustedCss - * - * @description - * Shorthand method. `$sce.getTrustedCss(value)` → - * {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.CSS, value)`} - * - * @param {*} value The value to pass to `$sce.getTrusted`. - * @return {*} The return value of `$sce.getTrusted($sce.CSS, value)` - */ - - /** - * @ngdoc method - * @name $sce#getTrustedUrl - * - * @description - * Shorthand method. `$sce.getTrustedUrl(value)` → - * {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.URL, value)`} - * - * @param {*} value The value to pass to `$sce.getTrusted`. - * @return {*} The return value of `$sce.getTrusted($sce.URL, value)` - */ - - /** - * @ngdoc method - * @name $sce#getTrustedResourceUrl - * - * @description - * Shorthand method. `$sce.getTrustedResourceUrl(value)` → - * {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.RESOURCE_URL, value)`} - * - * @param {*} value The value to pass to `$sceDelegate.getTrusted`. - * @return {*} The return value of `$sce.getTrusted($sce.RESOURCE_URL, value)` - */ - - /** - * @ngdoc method - * @name $sce#getTrustedJs - * - * @description - * Shorthand method. `$sce.getTrustedJs(value)` → - * {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.JS, value)`} - * - * @param {*} value The value to pass to `$sce.getTrusted`. - * @return {*} The return value of `$sce.getTrusted($sce.JS, value)` - */ - - /** - * @ngdoc method - * @name $sce#parseAsHtml - * - * @description - * Shorthand method. `$sce.parseAsHtml(expression string)` → - * {@link ng.$sce#parseAs `$sce.parseAs($sce.HTML, value)`} - * - * @param {string} expression String expression to compile. - * @return {function(context, locals)} A function which represents the compiled expression: - * - * * `context` – `{object}` – an object against which any expressions embedded in the - * strings are evaluated against (typically a scope object). - * * `locals` – `{object=}` – local variables context object, useful for overriding values - * in `context`. - */ - - /** - * @ngdoc method - * @name $sce#parseAsCss - * - * @description - * Shorthand method. `$sce.parseAsCss(value)` → - * {@link ng.$sce#parseAs `$sce.parseAs($sce.CSS, value)`} - * - * @param {string} expression String expression to compile. - * @return {function(context, locals)} A function which represents the compiled expression: - * - * * `context` – `{object}` – an object against which any expressions embedded in the - * strings are evaluated against (typically a scope object). - * * `locals` – `{object=}` – local variables context object, useful for overriding values - * in `context`. - */ - - /** - * @ngdoc method - * @name $sce#parseAsUrl - * - * @description - * Shorthand method. `$sce.parseAsUrl(value)` → - * {@link ng.$sce#parseAs `$sce.parseAs($sce.URL, value)`} - * - * @param {string} expression String expression to compile. - * @return {function(context, locals)} A function which represents the compiled expression: - * - * * `context` – `{object}` – an object against which any expressions embedded in the - * strings are evaluated against (typically a scope object). - * * `locals` – `{object=}` – local variables context object, useful for overriding values - * in `context`. - */ - - /** - * @ngdoc method - * @name $sce#parseAsResourceUrl - * - * @description - * Shorthand method. `$sce.parseAsResourceUrl(value)` → - * {@link ng.$sce#parseAs `$sce.parseAs($sce.RESOURCE_URL, value)`} - * - * @param {string} expression String expression to compile. - * @return {function(context, locals)} A function which represents the compiled expression: - * - * * `context` – `{object}` – an object against which any expressions embedded in the - * strings are evaluated against (typically a scope object). - * * `locals` – `{object=}` – local variables context object, useful for overriding values - * in `context`. - */ - - /** - * @ngdoc method - * @name $sce#parseAsJs - * - * @description - * Shorthand method. `$sce.parseAsJs(value)` → - * {@link ng.$sce#parseAs `$sce.parseAs($sce.JS, value)`} - * - * @param {string} expression String expression to compile. - * @return {function(context, locals)} A function which represents the compiled expression: - * - * * `context` – `{object}` – an object against which any expressions embedded in the - * strings are evaluated against (typically a scope object). - * * `locals` – `{object=}` – local variables context object, useful for overriding values - * in `context`. - */ - - // Shorthand delegations. - var parse = sce.parseAs, - getTrusted = sce.getTrusted, - trustAs = sce.trustAs; - - forEach(SCE_CONTEXTS, function(enumValue, name) { - var lName = lowercase(name); - sce[snakeToCamel('parse_as_' + lName)] = function(expr) { - return parse(enumValue, expr); - }; - sce[snakeToCamel('get_trusted_' + lName)] = function(value) { - return getTrusted(enumValue, value); - }; - sce[snakeToCamel('trust_as_' + lName)] = function(value) { - return trustAs(enumValue, value); - }; - }); - - return sce; - }]; -} - -/* exported $SnifferProvider */ - -/** - * !!! This is an undocumented "private" service !!! - * - * @name $sniffer - * @requires $window - * @requires $document - * @this - * - * @property {boolean} history Does the browser support html5 history api ? - * @property {boolean} transitions Does the browser support CSS transition events ? - * @property {boolean} animations Does the browser support CSS animation events ? - * - * @description - * This is very simple implementation of testing browser's features. - */ -function $SnifferProvider() { - this.$get = ['$window', '$document', function($window, $document) { - var eventSupport = {}, - // Chrome Packaged Apps are not allowed to access `history.pushState`. - // If not sandboxed, they can be detected by the presence of `chrome.app.runtime` - // (see https://developer.chrome.com/apps/api_index). If sandboxed, they can be detected by - // the presence of an extension runtime ID and the absence of other Chrome runtime APIs - // (see https://developer.chrome.com/apps/manifest/sandbox). - // (NW.js apps have access to Chrome APIs, but do support `history`.) - isNw = $window.nw && $window.nw.process, - isChromePackagedApp = - !isNw && - $window.chrome && - ($window.chrome.app && $window.chrome.app.runtime || - !$window.chrome.app && $window.chrome.runtime && $window.chrome.runtime.id), - hasHistoryPushState = !isChromePackagedApp && $window.history && $window.history.pushState, - android = - toInt((/android (\d+)/.exec(lowercase(($window.navigator || {}).userAgent)) || [])[1]), - boxee = /Boxee/i.test(($window.navigator || {}).userAgent), - document = $document[0] || {}, - bodyStyle = document.body && document.body.style, - transitions = false, - animations = false; - - if (bodyStyle) { - // Support: Android <5, Blackberry Browser 10, default Chrome in Android 4.4.x - // Mentioned browsers need a -webkit- prefix for transitions & animations. - transitions = !!('transition' in bodyStyle || 'webkitTransition' in bodyStyle); - animations = !!('animation' in bodyStyle || 'webkitAnimation' in bodyStyle); - } - - - return { - // Android has history.pushState, but it does not update location correctly - // so let's not use the history API at all. - // http://code.google.com/p/android/issues/detail?id=17471 - // https://github.com/angular/angular.js/issues/904 - - // older webkit browser (533.9) on Boxee box has exactly the same problem as Android has - // so let's not use the history API also - // We are purposefully using `!(android < 4)` to cover the case when `android` is undefined - history: !!(hasHistoryPushState && !(android < 4) && !boxee), - hasEvent: function(event) { - // Support: IE 9-11 only - // IE9 implements 'input' event it's so fubared that we rather pretend that it doesn't have - // it. In particular the event is not fired when backspace or delete key are pressed or - // when cut operation is performed. - // IE10+ implements 'input' event but it erroneously fires under various situations, - // e.g. when placeholder changes, or a form is focused. - if (event === 'input' && msie) return false; - - if (isUndefined(eventSupport[event])) { - var divElm = document.createElement('div'); - eventSupport[event] = 'on' + event in divElm; - } - - return eventSupport[event]; - }, - csp: csp(), - transitions: transitions, - animations: animations, - android: android - }; - }]; -} - -/** - * ! This is a private undocumented service ! - * - * @name $$taskTrackerFactory - * @description - * A function to create `TaskTracker` instances. - * - * A `TaskTracker` can keep track of pending tasks (grouped by type) and can notify interested - * parties when all pending tasks (or tasks of a specific type) have been completed. - * - * @param {$log} log - A logger instance (such as `$log`). Used to log error during callback - * execution. - * - * @this - */ -function $$TaskTrackerFactoryProvider() { - this.$get = valueFn(function(log) { return new TaskTracker(log); }); -} - -function TaskTracker(log) { - var self = this; - var taskCounts = {}; - var taskCallbacks = []; - - var ALL_TASKS_TYPE = self.ALL_TASKS_TYPE = '$$all$$'; - var DEFAULT_TASK_TYPE = self.DEFAULT_TASK_TYPE = '$$default$$'; - - /** - * Execute the specified function and decrement the appropriate `taskCounts` counter. - * If the counter reaches 0, all corresponding `taskCallbacks` are executed. - * - * @param {Function} fn - The function to execute. - * @param {string=} [taskType=DEFAULT_TASK_TYPE] - The type of task that is being completed. - */ - self.completeTask = completeTask; - - /** - * Increase the task count for the specified task type (or the default task type if non is - * specified). - * - * @param {string=} [taskType=DEFAULT_TASK_TYPE] - The type of task whose count will be increased. - */ - self.incTaskCount = incTaskCount; - - /** - * Execute the specified callback when all pending tasks have been completed. - * - * If there are no pending tasks, the callback is executed immediately. You can optionally limit - * the tasks that will be waited for to a specific type, by passing a `taskType`. - * - * @param {function} callback - The function to call when there are no pending tasks. - * @param {string=} [taskType=ALL_TASKS_TYPE] - The type of tasks that will be waited for. - */ - self.notifyWhenNoPendingTasks = notifyWhenNoPendingTasks; - - function completeTask(fn, taskType) { - taskType = taskType || DEFAULT_TASK_TYPE; - - try { - fn(); - } finally { - decTaskCount(taskType); - - var countForType = taskCounts[taskType]; - var countForAll = taskCounts[ALL_TASKS_TYPE]; - - // If at least one of the queues (`ALL_TASKS_TYPE` or `taskType`) is empty, run callbacks. - if (!countForAll || !countForType) { - var getNextCallback = !countForAll ? getLastCallback : getLastCallbackForType; - var nextCb; - - while ((nextCb = getNextCallback(taskType))) { - try { - nextCb(); - } catch (e) { - log.error(e); - } - } - } - } - } - - function decTaskCount(taskType) { - taskType = taskType || DEFAULT_TASK_TYPE; - if (taskCounts[taskType]) { - taskCounts[taskType]--; - taskCounts[ALL_TASKS_TYPE]--; - } - } - - function getLastCallback() { - var cbInfo = taskCallbacks.pop(); - return cbInfo && cbInfo.cb; - } - - function getLastCallbackForType(taskType) { - for (var i = taskCallbacks.length - 1; i >= 0; --i) { - var cbInfo = taskCallbacks[i]; - if (cbInfo.type === taskType) { - taskCallbacks.splice(i, 1); - return cbInfo.cb; - } - } - } - - function incTaskCount(taskType) { - taskType = taskType || DEFAULT_TASK_TYPE; - taskCounts[taskType] = (taskCounts[taskType] || 0) + 1; - taskCounts[ALL_TASKS_TYPE] = (taskCounts[ALL_TASKS_TYPE] || 0) + 1; - } - - function notifyWhenNoPendingTasks(callback, taskType) { - taskType = taskType || ALL_TASKS_TYPE; - if (!taskCounts[taskType]) { - callback(); - } else { - taskCallbacks.push({type: taskType, cb: callback}); - } - } -} - -var $templateRequestMinErr = minErr('$templateRequest'); - -/** - * @ngdoc provider - * @name $templateRequestProvider - * @this - * - * @description - * Used to configure the options passed to the {@link $http} service when making a template request. - * - * For example, it can be used for specifying the "Accept" header that is sent to the server, when - * requesting a template. - */ -function $TemplateRequestProvider() { - - var httpOptions; - - /** - * @ngdoc method - * @name $templateRequestProvider#httpOptions - * @description - * The options to be passed to the {@link $http} service when making the request. - * You can use this to override options such as the "Accept" header for template requests. - * - * The {@link $templateRequest} will set the `cache` and the `transformResponse` properties of the - * options if not overridden here. - * - * @param {string=} value new value for the {@link $http} options. - * @returns {string|self} Returns the {@link $http} options when used as getter and self if used as setter. - */ - this.httpOptions = function(val) { - if (val) { - httpOptions = val; - return this; - } - return httpOptions; - }; - - /** - * @ngdoc service - * @name $templateRequest - * - * @description - * The `$templateRequest` service runs security checks then downloads the provided template using - * `$http` and, upon success, stores the contents inside of `$templateCache`. If the HTTP request - * fails or the response data of the HTTP request is empty, a `$compile` error will be thrown (the - * exception can be thwarted by setting the 2nd parameter of the function to true). Note that the - * contents of `$templateCache` are trusted, so the call to `$sce.getTrustedUrl(tpl)` is omitted - * when `tpl` is of type string and `$templateCache` has the matching entry. - * - * If you want to pass custom options to the `$http` service, such as setting the Accept header you - * can configure this via {@link $templateRequestProvider#httpOptions}. - * - * `$templateRequest` is used internally by {@link $compile}, {@link ngRoute.$route}, and directives such - * as {@link ngInclude} to download and cache templates. - * - * 3rd party modules should use `$templateRequest` if their services or directives are loading - * templates. - * - * @param {string|TrustedResourceUrl} tpl The HTTP request template URL - * @param {boolean=} ignoreRequestError Whether or not to ignore the exception when the request fails or the template is empty - * - * @return {Promise} a promise for the HTTP response data of the given URL. - * - * @property {number} totalPendingRequests total amount of pending template requests being downloaded. - */ - this.$get = ['$exceptionHandler', '$templateCache', '$http', '$q', '$sce', - function($exceptionHandler, $templateCache, $http, $q, $sce) { - - function handleRequestFn(tpl, ignoreRequestError) { - handleRequestFn.totalPendingRequests++; - - // We consider the template cache holds only trusted templates, so - // there's no need to go through whitelisting again for keys that already - // are included in there. This also makes AngularJS accept any script - // directive, no matter its name. However, we still need to unwrap trusted - // types. - if (!isString(tpl) || isUndefined($templateCache.get(tpl))) { - tpl = $sce.getTrustedResourceUrl(tpl); - } - - var transformResponse = $http.defaults && $http.defaults.transformResponse; - - if (isArray(transformResponse)) { - transformResponse = transformResponse.filter(function(transformer) { - return transformer !== defaultHttpResponseTransform; - }); - } else if (transformResponse === defaultHttpResponseTransform) { - transformResponse = null; - } - - return $http.get(tpl, extend({ - cache: $templateCache, - transformResponse: transformResponse - }, httpOptions)) - .finally(function() { - handleRequestFn.totalPendingRequests--; - }) - .then(function(response) { - return $templateCache.put(tpl, response.data); - }, handleError); - - function handleError(resp) { - if (!ignoreRequestError) { - resp = $templateRequestMinErr('tpload', - 'Failed to load template: {0} (HTTP status: {1} {2})', - tpl, resp.status, resp.statusText); - - $exceptionHandler(resp); - } - - return $q.reject(resp); - } - } - - handleRequestFn.totalPendingRequests = 0; - - return handleRequestFn; - } - ]; -} - -/** @this */ -function $$TestabilityProvider() { - this.$get = ['$rootScope', '$browser', '$location', - function($rootScope, $browser, $location) { - - /** - * @name $testability - * - * @description - * The private $$testability service provides a collection of methods for use when debugging - * or by automated test and debugging tools. - */ - var testability = {}; - - /** - * @name $$testability#findBindings - * - * @description - * Returns an array of elements that are bound (via ng-bind or {{}}) - * to expressions matching the input. - * - * @param {Element} element The element root to search from. - * @param {string} expression The binding expression to match. - * @param {boolean} opt_exactMatch If true, only returns exact matches - * for the expression. Filters and whitespace are ignored. - */ - testability.findBindings = function(element, expression, opt_exactMatch) { - var bindings = element.getElementsByClassName('ng-binding'); - var matches = []; - forEach(bindings, function(binding) { - var dataBinding = angular.element(binding).data('$binding'); - if (dataBinding) { - forEach(dataBinding, function(bindingName) { - if (opt_exactMatch) { - var matcher = new RegExp('(^|\\s)' + escapeForRegexp(expression) + '(\\s|\\||$)'); - if (matcher.test(bindingName)) { - matches.push(binding); - } - } else { - if (bindingName.indexOf(expression) !== -1) { - matches.push(binding); - } - } - }); - } - }); - return matches; - }; - - /** - * @name $$testability#findModels - * - * @description - * Returns an array of elements that are two-way found via ng-model to - * expressions matching the input. - * - * @param {Element} element The element root to search from. - * @param {string} expression The model expression to match. - * @param {boolean} opt_exactMatch If true, only returns exact matches - * for the expression. - */ - testability.findModels = function(element, expression, opt_exactMatch) { - var prefixes = ['ng-', 'data-ng-', 'ng\\:']; - for (var p = 0; p < prefixes.length; ++p) { - var attributeEquals = opt_exactMatch ? '=' : '*='; - var selector = '[' + prefixes[p] + 'model' + attributeEquals + '"' + expression + '"]'; - var elements = element.querySelectorAll(selector); - if (elements.length) { - return elements; - } - } - }; - - /** - * @name $$testability#getLocation - * - * @description - * Shortcut for getting the location in a browser agnostic way. Returns - * the path, search, and hash. (e.g. /path?a=b#hash) - */ - testability.getLocation = function() { - return $location.url(); - }; - - /** - * @name $$testability#setLocation - * - * @description - * Shortcut for navigating to a location without doing a full page reload. - * - * @param {string} url The location url (path, search and hash, - * e.g. /path?a=b#hash) to go to. - */ - testability.setLocation = function(url) { - if (url !== $location.url()) { - $location.url(url); - $rootScope.$digest(); - } - }; - - /** - * @name $$testability#whenStable - * - * @description - * Calls the callback when all pending tasks are completed. - * - * Types of tasks waited for include: - * - Pending timeouts (via {@link $timeout}). - * - Pending HTTP requests (via {@link $http}). - * - In-progress route transitions (via {@link $route}). - * - Pending tasks scheduled via {@link $rootScope#$applyAsync}. - * - Pending tasks scheduled via {@link $rootScope#$evalAsync}. - * These include tasks scheduled via `$evalAsync()` indirectly (such as {@link $q} promises). - * - * @param {function} callback - */ - testability.whenStable = function(callback) { - $browser.notifyWhenNoOutstandingRequests(callback); - }; - - return testability; - }]; -} - -var $timeoutMinErr = minErr('$timeout'); - -/** @this */ -function $TimeoutProvider() { - this.$get = ['$rootScope', '$browser', '$q', '$$q', '$exceptionHandler', - function($rootScope, $browser, $q, $$q, $exceptionHandler) { - - var deferreds = {}; - - - /** - * @ngdoc service - * @name $timeout - * - * @description - * AngularJS's wrapper for `window.setTimeout`. The `fn` function is wrapped into a try/catch - * block and delegates any exceptions to - * {@link ng.$exceptionHandler $exceptionHandler} service. - * - * The return value of calling `$timeout` is a promise, which will be resolved when - * the delay has passed and the timeout function, if provided, is executed. - * - * To cancel a timeout request, call `$timeout.cancel(promise)`. - * - * In tests you can use {@link ngMock.$timeout `$timeout.flush()`} to - * synchronously flush the queue of deferred functions. - * - * If you only want a promise that will be resolved after some specified delay - * then you can call `$timeout` without the `fn` function. - * - * @param {function()=} fn A function, whose execution should be delayed. - * @param {number=} [delay=0] Delay in milliseconds. - * @param {boolean=} [invokeApply=true] If set to `false` skips model dirty checking, otherwise - * will invoke `fn` within the {@link ng.$rootScope.Scope#$apply $apply} block. - * @param {...*=} Pass additional parameters to the executed function. - * @returns {Promise} Promise that will be resolved when the timeout is reached. The promise - * will be resolved with the return value of the `fn` function. - * - */ - function timeout(fn, delay, invokeApply) { - if (!isFunction(fn)) { - invokeApply = delay; - delay = fn; - fn = noop; - } - - var args = sliceArgs(arguments, 3), - skipApply = (isDefined(invokeApply) && !invokeApply), - deferred = (skipApply ? $$q : $q).defer(), - promise = deferred.promise, - timeoutId; - - timeoutId = $browser.defer(function() { - try { - deferred.resolve(fn.apply(null, args)); - } catch (e) { - deferred.reject(e); - $exceptionHandler(e); - } finally { - delete deferreds[promise.$$timeoutId]; - } - - if (!skipApply) $rootScope.$apply(); - }, delay, '$timeout'); - - promise.$$timeoutId = timeoutId; - deferreds[timeoutId] = deferred; - - return promise; - } - - - /** - * @ngdoc method - * @name $timeout#cancel - * - * @description - * Cancels a task associated with the `promise`. As a result of this, the promise will be - * resolved with a rejection. - * - * @param {Promise=} promise Promise returned by the `$timeout` function. - * @returns {boolean} Returns `true` if the task hasn't executed yet and was successfully - * canceled. - */ - timeout.cancel = function(promise) { - if (!promise) return false; - - if (!promise.hasOwnProperty('$$timeoutId')) { - throw $timeoutMinErr('badprom', - '`$timeout.cancel()` called with a promise that was not generated by `$timeout()`.'); - } - - if (!deferreds.hasOwnProperty(promise.$$timeoutId)) return false; - - var id = promise.$$timeoutId; - var deferred = deferreds[id]; - - // Timeout cancels should not report an unhandled promise. - markQExceptionHandled(deferred.promise); - deferred.reject('canceled'); - delete deferreds[id]; - - return $browser.defer.cancel(id); - }; - - return timeout; - }]; -} - -// NOTE: The usage of window and document instead of $window and $document here is -// deliberate. This service depends on the specific behavior of anchor nodes created by the -// browser (resolving and parsing URLs) that is unlikely to be provided by mock objects and -// cause us to break tests. In addition, when the browser resolves a URL for XHR, it -// doesn't know about mocked locations and resolves URLs to the real document - which is -// exactly the behavior needed here. There is little value is mocking these out for this -// service. -var urlParsingNode = window.document.createElement('a'); -var originUrl = urlResolve(window.location.href); -var baseUrlParsingNode; - -urlParsingNode.href = 'http://[::1]'; - -// Support: IE 9-11 only, Edge 16-17 only (fixed in 18 Preview) -// IE/Edge don't wrap IPv6 addresses' hostnames in square brackets -// when parsed out of an anchor element. -var ipv6InBrackets = urlParsingNode.hostname === '[::1]'; - -/** - * - * Implementation Notes for non-IE browsers - * ---------------------------------------- - * Assigning a URL to the href property of an anchor DOM node, even one attached to the DOM, - * results both in the normalizing and parsing of the URL. Normalizing means that a relative - * URL will be resolved into an absolute URL in the context of the application document. - * Parsing means that the anchor node's host, hostname, protocol, port, pathname and related - * properties are all populated to reflect the normalized URL. This approach has wide - * compatibility - Safari 1+, Mozilla 1+ etc. See - * http://www.aptana.com/reference/html/api/HTMLAnchorElement.html - * - * Implementation Notes for IE - * --------------------------- - * IE <= 10 normalizes the URL when assigned to the anchor node similar to the other - * browsers. However, the parsed components will not be set if the URL assigned did not specify - * them. (e.g. if you assign a.href = "foo", then a.protocol, a.host, etc. will be empty.) We - * work around that by performing the parsing in a 2nd step by taking a previously normalized - * URL (e.g. by assigning to a.href) and assigning it a.href again. This correctly populates the - * properties such as protocol, hostname, port, etc. - * - * References: - * http://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement - * http://www.aptana.com/reference/html/api/HTMLAnchorElement.html - * http://url.spec.whatwg.org/#urlutils - * https://github.com/angular/angular.js/pull/2902 - * http://james.padolsey.com/javascript/parsing-urls-with-the-dom/ - * - * @kind function - * @param {string|object} url The URL to be parsed. If `url` is not a string, it will be returned - * unchanged. - * @description Normalizes and parses a URL. - * @returns {object} Returns the normalized URL as a dictionary. - * - * | member name | Description | - * |---------------|------------------------------------------------------------------------| - * | href | A normalized version of the provided URL if it was not an absolute URL | - * | protocol | The protocol without the trailing colon | - * | host | The host and port (if the port is non-default) of the normalizedUrl | - * | search | The search params, minus the question mark | - * | hash | The hash string, minus the hash symbol | - * | hostname | The hostname | - * | port | The port, without ":" | - * | pathname | The pathname, beginning with "/" | - * - */ -function urlResolve(url) { - if (!isString(url)) return url; - - var href = url; - - // Support: IE 9-11 only - if (msie) { - // Normalize before parse. Refer Implementation Notes on why this is - // done in two steps on IE. - urlParsingNode.setAttribute('href', href); - href = urlParsingNode.href; - } - - urlParsingNode.setAttribute('href', href); - - var hostname = urlParsingNode.hostname; - - if (!ipv6InBrackets && hostname.indexOf(':') > -1) { - hostname = '[' + hostname + ']'; - } - - return { - href: urlParsingNode.href, - protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '', - host: urlParsingNode.host, - search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '', - hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '', - hostname: hostname, - port: urlParsingNode.port, - pathname: (urlParsingNode.pathname.charAt(0) === '/') - ? urlParsingNode.pathname - : '/' + urlParsingNode.pathname - }; -} - -/** - * Parse a request URL and determine whether this is a same-origin request as the application - * document. - * - * @param {string|object} requestUrl The url of the request as a string that will be resolved - * or a parsed URL object. - * @returns {boolean} Whether the request is for the same origin as the application document. - */ -function urlIsSameOrigin(requestUrl) { - return urlsAreSameOrigin(requestUrl, originUrl); -} - -/** - * Parse a request URL and determine whether it is same-origin as the current document base URL. - * - * Note: The base URL is usually the same as the document location (`location.href`) but can - * be overriden by using the `` tag. - * - * @param {string|object} requestUrl The url of the request as a string that will be resolved - * or a parsed URL object. - * @returns {boolean} Whether the URL is same-origin as the document base URL. - */ -function urlIsSameOriginAsBaseUrl(requestUrl) { - return urlsAreSameOrigin(requestUrl, getBaseUrl()); -} - -/** - * Create a function that can check a URL's origin against a list of allowed/whitelisted origins. - * The current location's origin is implicitly trusted. - * - * @param {string[]} whitelistedOriginUrls - A list of URLs (strings), whose origins are trusted. - * - * @returns {Function} - A function that receives a URL (string or parsed URL object) and returns - * whether it is of an allowed origin. - */ -function urlIsAllowedOriginFactory(whitelistedOriginUrls) { - var parsedAllowedOriginUrls = [originUrl].concat(whitelistedOriginUrls.map(urlResolve)); - - /** - * Check whether the specified URL (string or parsed URL object) has an origin that is allowed - * based on a list of whitelisted-origin URLs. The current location's origin is implicitly - * trusted. - * - * @param {string|Object} requestUrl - The URL to be checked (provided as a string that will be - * resolved or a parsed URL object). - * - * @returns {boolean} - Whether the specified URL is of an allowed origin. - */ - return function urlIsAllowedOrigin(requestUrl) { - var parsedUrl = urlResolve(requestUrl); - return parsedAllowedOriginUrls.some(urlsAreSameOrigin.bind(null, parsedUrl)); - }; -} - -/** - * Determine if two URLs share the same origin. - * - * @param {string|Object} url1 - First URL to compare as a string or a normalized URL in the form of - * a dictionary object returned by `urlResolve()`. - * @param {string|object} url2 - Second URL to compare as a string or a normalized URL in the form - * of a dictionary object returned by `urlResolve()`. - * - * @returns {boolean} - True if both URLs have the same origin, and false otherwise. - */ -function urlsAreSameOrigin(url1, url2) { - url1 = urlResolve(url1); - url2 = urlResolve(url2); - - return (url1.protocol === url2.protocol && - url1.host === url2.host); -} - -/** - * Returns the current document base URL. - * @returns {string} - */ -function getBaseUrl() { - if (window.document.baseURI) { - return window.document.baseURI; - } - - // `document.baseURI` is available everywhere except IE - if (!baseUrlParsingNode) { - baseUrlParsingNode = window.document.createElement('a'); - baseUrlParsingNode.href = '.'; - - // Work-around for IE bug described in Implementation Notes. The fix in `urlResolve()` is not - // suitable here because we need to track changes to the base URL. - baseUrlParsingNode = baseUrlParsingNode.cloneNode(false); - } - return baseUrlParsingNode.href; -} - -/** - * @ngdoc service - * @name $window - * @this - * - * @description - * A reference to the browser's `window` object. While `window` - * is globally available in JavaScript, it causes testability problems, because - * it is a global variable. In AngularJS we always refer to it through the - * `$window` service, so it may be overridden, removed or mocked for testing. - * - * Expressions, like the one defined for the `ngClick` directive in the example - * below, are evaluated with respect to the current scope. Therefore, there is - * no risk of inadvertently coding in a dependency on a global value in such an - * expression. - * - * @example - - - -
    - - -
    -
    - - it('should display the greeting in the input box', function() { - element(by.model('greeting')).sendKeys('Hello, E2E Tests'); - // If we click the button it will block the test runner - // element(':button').click(); - }); - -
    - */ -function $WindowProvider() { - this.$get = valueFn(window); -} - -/** - * @name $$cookieReader - * @requires $document - * - * @description - * This is a private service for reading cookies used by $http and ngCookies - * - * @return {Object} a key/value map of the current cookies - */ -function $$CookieReader($document) { - var rawDocument = $document[0] || {}; - var lastCookies = {}; - var lastCookieString = ''; - - function safeGetCookie(rawDocument) { - try { - return rawDocument.cookie || ''; - } catch (e) { - return ''; - } - } - - function safeDecodeURIComponent(str) { - try { - return decodeURIComponent(str); - } catch (e) { - return str; - } - } - - return function() { - var cookieArray, cookie, i, index, name; - var currentCookieString = safeGetCookie(rawDocument); - - if (currentCookieString !== lastCookieString) { - lastCookieString = currentCookieString; - cookieArray = lastCookieString.split('; '); - lastCookies = {}; - - for (i = 0; i < cookieArray.length; i++) { - cookie = cookieArray[i]; - index = cookie.indexOf('='); - if (index > 0) { //ignore nameless cookies - name = safeDecodeURIComponent(cookie.substring(0, index)); - // the first value that is seen for a cookie is the most - // specific one. values for the same cookie name that - // follow are for less specific paths. - if (isUndefined(lastCookies[name])) { - lastCookies[name] = safeDecodeURIComponent(cookie.substring(index + 1)); - } - } - } - } - return lastCookies; - }; -} - -$$CookieReader.$inject = ['$document']; - -/** @this */ -function $$CookieReaderProvider() { - this.$get = $$CookieReader; -} - -/* global currencyFilter: true, - dateFilter: true, - filterFilter: true, - jsonFilter: true, - limitToFilter: true, - lowercaseFilter: true, - numberFilter: true, - orderByFilter: true, - uppercaseFilter: true, - */ - -/** - * @ngdoc provider - * @name $filterProvider - * @description - * - * Filters are just functions which transform input to an output. However filters need to be - * Dependency Injected. To achieve this a filter definition consists of a factory function which is - * annotated with dependencies and is responsible for creating a filter function. - * - *
    - * **Note:** Filter names must be valid AngularJS {@link expression} identifiers, such as `uppercase` or `orderBy`. - * Names with special characters, such as hyphens and dots, are not allowed. If you wish to namespace - * your filters, then you can use capitalization (`myappSubsectionFilterx`) or underscores - * (`myapp_subsection_filterx`). - *
    - * - * ```js - * // Filter registration - * function MyModule($provide, $filterProvider) { - * // create a service to demonstrate injection (not always needed) - * $provide.value('greet', function(name){ - * return 'Hello ' + name + '!'; - * }); - * - * // register a filter factory which uses the - * // greet service to demonstrate DI. - * $filterProvider.register('greet', function(greet){ - * // return the filter function which uses the greet service - * // to generate salutation - * return function(text) { - * // filters need to be forgiving so check input validity - * return text && greet(text) || text; - * }; - * }); - * } - * ``` - * - * The filter function is registered with the `$injector` under the filter name suffix with - * `Filter`. - * - * ```js - * it('should be the same instance', inject( - * function($filterProvider) { - * $filterProvider.register('reverse', function(){ - * return ...; - * }); - * }, - * function($filter, reverseFilter) { - * expect($filter('reverse')).toBe(reverseFilter); - * }); - * ``` - * - * - * For more information about how AngularJS filters work, and how to create your own filters, see - * {@link guide/filter Filters} in the AngularJS Developer Guide. - */ - -/** - * @ngdoc service - * @name $filter - * @kind function - * @description - * Filters are used for formatting data displayed to the user. - * - * They can be used in view templates, controllers or services. AngularJS comes - * with a collection of [built-in filters](api/ng/filter), but it is easy to - * define your own as well. - * - * The general syntax in templates is as follows: - * - * ```html - * {{ expression [| filter_name[:parameter_value] ... ] }} - * ``` - * - * @param {String} name Name of the filter function to retrieve - * @return {Function} the filter function - * @example - - -
    -

    {{ originalText }}

    -

    {{ filteredText }}

    -
    -
    - - - angular.module('filterExample', []) - .controller('MainCtrl', function($scope, $filter) { - $scope.originalText = 'hello'; - $scope.filteredText = $filter('uppercase')($scope.originalText); - }); - -
    - */ -$FilterProvider.$inject = ['$provide']; -/** @this */ -function $FilterProvider($provide) { - var suffix = 'Filter'; - - /** - * @ngdoc method - * @name $filterProvider#register - * @param {string|Object} name Name of the filter function, or an object map of filters where - * the keys are the filter names and the values are the filter factories. - * - *
    - * **Note:** Filter names must be valid AngularJS {@link expression} identifiers, such as `uppercase` or `orderBy`. - * Names with special characters, such as hyphens and dots, are not allowed. If you wish to namespace - * your filters, then you can use capitalization (`myappSubsectionFilterx`) or underscores - * (`myapp_subsection_filterx`). - *
    - * @param {Function} factory If the first argument was a string, a factory function for the filter to be registered. - * @returns {Object} Registered filter instance, or if a map of filters was provided then a map - * of the registered filter instances. - */ - function register(name, factory) { - if (isObject(name)) { - var filters = {}; - forEach(name, function(filter, key) { - filters[key] = register(key, filter); - }); - return filters; - } else { - return $provide.factory(name + suffix, factory); - } - } - this.register = register; - - this.$get = ['$injector', function($injector) { - return function(name) { - return $injector.get(name + suffix); - }; - }]; - - //////////////////////////////////////// - - /* global - currencyFilter: false, - dateFilter: false, - filterFilter: false, - jsonFilter: false, - limitToFilter: false, - lowercaseFilter: false, - numberFilter: false, - orderByFilter: false, - uppercaseFilter: false - */ - - register('currency', currencyFilter); - register('date', dateFilter); - register('filter', filterFilter); - register('json', jsonFilter); - register('limitTo', limitToFilter); - register('lowercase', lowercaseFilter); - register('number', numberFilter); - register('orderBy', orderByFilter); - register('uppercase', uppercaseFilter); -} - -/** - * @ngdoc filter - * @name filter - * @kind function - * - * @description - * Selects a subset of items from `array` and returns it as a new array. - * - * @param {Array} array The source array. - *
    - * **Note**: If the array contains objects that reference themselves, filtering is not possible. - *
    - * @param {string|Object|function()} expression The predicate to be used for selecting items from - * `array`. - * - * Can be one of: - * - * - `string`: The string is used for matching against the contents of the `array`. All strings or - * objects with string properties in `array` that match this string will be returned. This also - * applies to nested object properties. - * The predicate can be negated by prefixing the string with `!`. - * - * - `Object`: A pattern object can be used to filter specific properties on objects contained - * by `array`. For example `{name:"M", phone:"1"}` predicate will return an array of items - * which have property `name` containing "M" and property `phone` containing "1". A special - * property name (`$` by default) can be used (e.g. as in `{$: "text"}`) to accept a match - * against any property of the object or its nested object properties. That's equivalent to the - * simple substring match with a `string` as described above. The special property name can be - * overwritten, using the `anyPropertyKey` parameter. - * The predicate can be negated by prefixing the string with `!`. - * For example `{name: "!M"}` predicate will return an array of items which have property `name` - * not containing "M". - * - * Note that a named property will match properties on the same level only, while the special - * `$` property will match properties on the same level or deeper. E.g. an array item like - * `{name: {first: 'John', last: 'Doe'}}` will **not** be matched by `{name: 'John'}`, but - * **will** be matched by `{$: 'John'}`. - * - * - `function(value, index, array)`: A predicate function can be used to write arbitrary filters. - * The function is called for each element of the array, with the element, its index, and - * the entire array itself as arguments. - * - * The final result is an array of those elements that the predicate returned true for. - * - * @param {function(actual, expected)|true|false} [comparator] Comparator which is used in - * determining if values retrieved using `expression` (when it is not a function) should be - * considered a match based on the expected value (from the filter expression) and actual - * value (from the object in the array). - * - * Can be one of: - * - * - `function(actual, expected)`: - * The function will be given the object value and the predicate value to compare and - * should return true if both values should be considered equal. - * - * - `true`: A shorthand for `function(actual, expected) { return angular.equals(actual, expected)}`. - * This is essentially strict comparison of expected and actual. - * - * - `false`: A short hand for a function which will look for a substring match in a case - * insensitive way. Primitive values are converted to strings. Objects are not compared against - * primitives, unless they have a custom `toString` method (e.g. `Date` objects). - * - * - * Defaults to `false`. - * - * @param {string} [anyPropertyKey] The special property name that matches against any property. - * By default `$`. - * - * @example - - -
    - - - - - - - - -
    NamePhone
    {{friend.name}}{{friend.phone}}
    -
    -
    -
    -
    -
    - - - - - - -
    NamePhone
    {{friendObj.name}}{{friendObj.phone}}
    -
    - - var expectFriendNames = function(expectedNames, key) { - element.all(by.repeater(key + ' in friends').column(key + '.name')).then(function(arr) { - arr.forEach(function(wd, i) { - expect(wd.getText()).toMatch(expectedNames[i]); - }); - }); - }; - - it('should search across all fields when filtering with a string', function() { - var searchText = element(by.model('searchText')); - searchText.clear(); - searchText.sendKeys('m'); - expectFriendNames(['Mary', 'Mike', 'Adam'], 'friend'); - - searchText.clear(); - searchText.sendKeys('76'); - expectFriendNames(['John', 'Julie'], 'friend'); - }); - - it('should search in specific fields when filtering with a predicate object', function() { - var searchAny = element(by.model('search.$')); - searchAny.clear(); - searchAny.sendKeys('i'); - expectFriendNames(['Mary', 'Mike', 'Julie', 'Juliette'], 'friendObj'); - }); - it('should use a equal comparison when comparator is true', function() { - var searchName = element(by.model('search.name')); - var strict = element(by.model('strict')); - searchName.clear(); - searchName.sendKeys('Julie'); - strict.click(); - expectFriendNames(['Julie'], 'friendObj'); - }); - -
    - */ - -function filterFilter() { - return function(array, expression, comparator, anyPropertyKey) { - if (!isArrayLike(array)) { - if (array == null) { - return array; - } else { - throw minErr('filter')('notarray', 'Expected array but received: {0}', array); - } - } - - anyPropertyKey = anyPropertyKey || '$'; - var expressionType = getTypeForFilter(expression); - var predicateFn; - var matchAgainstAnyProp; - - switch (expressionType) { - case 'function': - predicateFn = expression; - break; - case 'boolean': - case 'null': - case 'number': - case 'string': - matchAgainstAnyProp = true; - // falls through - case 'object': - predicateFn = createPredicateFn(expression, comparator, anyPropertyKey, matchAgainstAnyProp); - break; - default: - return array; - } - - return Array.prototype.filter.call(array, predicateFn); - }; -} - -// Helper functions for `filterFilter` -function createPredicateFn(expression, comparator, anyPropertyKey, matchAgainstAnyProp) { - var shouldMatchPrimitives = isObject(expression) && (anyPropertyKey in expression); - var predicateFn; - - if (comparator === true) { - comparator = equals; - } else if (!isFunction(comparator)) { - comparator = function(actual, expected) { - if (isUndefined(actual)) { - // No substring matching against `undefined` - return false; - } - if ((actual === null) || (expected === null)) { - // No substring matching against `null`; only match against `null` - return actual === expected; - } - if (isObject(expected) || (isObject(actual) && !hasCustomToString(actual))) { - // Should not compare primitives against objects, unless they have custom `toString` method - return false; - } - - actual = lowercase('' + actual); - expected = lowercase('' + expected); - return actual.indexOf(expected) !== -1; - }; - } - - predicateFn = function(item) { - if (shouldMatchPrimitives && !isObject(item)) { - return deepCompare(item, expression[anyPropertyKey], comparator, anyPropertyKey, false); - } - return deepCompare(item, expression, comparator, anyPropertyKey, matchAgainstAnyProp); - }; - - return predicateFn; -} - -function deepCompare(actual, expected, comparator, anyPropertyKey, matchAgainstAnyProp, dontMatchWholeObject) { - var actualType = getTypeForFilter(actual); - var expectedType = getTypeForFilter(expected); - - if ((expectedType === 'string') && (expected.charAt(0) === '!')) { - return !deepCompare(actual, expected.substring(1), comparator, anyPropertyKey, matchAgainstAnyProp); - } else if (isArray(actual)) { - // In case `actual` is an array, consider it a match - // if ANY of it's items matches `expected` - return actual.some(function(item) { - return deepCompare(item, expected, comparator, anyPropertyKey, matchAgainstAnyProp); - }); - } - - switch (actualType) { - case 'object': - var key; - if (matchAgainstAnyProp) { - for (key in actual) { - // Under certain, rare, circumstances, key may not be a string and `charAt` will be undefined - // See: https://github.com/angular/angular.js/issues/15644 - if (key.charAt && (key.charAt(0) !== '$') && - deepCompare(actual[key], expected, comparator, anyPropertyKey, true)) { - return true; - } - } - return dontMatchWholeObject ? false : deepCompare(actual, expected, comparator, anyPropertyKey, false); - } else if (expectedType === 'object') { - for (key in expected) { - var expectedVal = expected[key]; - if (isFunction(expectedVal) || isUndefined(expectedVal)) { - continue; - } - - var matchAnyProperty = key === anyPropertyKey; - var actualVal = matchAnyProperty ? actual : actual[key]; - if (!deepCompare(actualVal, expectedVal, comparator, anyPropertyKey, matchAnyProperty, matchAnyProperty)) { - return false; - } - } - return true; - } else { - return comparator(actual, expected); - } - case 'function': - return false; - default: - return comparator(actual, expected); - } -} - -// Used for easily differentiating between `null` and actual `object` -function getTypeForFilter(val) { - return (val === null) ? 'null' : typeof val; -} - -var MAX_DIGITS = 22; -var DECIMAL_SEP = '.'; -var ZERO_CHAR = '0'; - -/** - * @ngdoc filter - * @name currency - * @kind function - * - * @description - * Formats a number as a currency (ie $1,234.56). When no currency symbol is provided, default - * symbol for current locale is used. - * - * @param {number} amount Input to filter. - * @param {string=} symbol Currency symbol or identifier to be displayed. - * @param {number=} fractionSize Number of decimal places to round the amount to, defaults to default max fraction size for current locale - * @returns {string} Formatted number. - * - * - * @example - - - -
    -
    - default currency symbol ($): {{amount | currency}}
    - custom currency identifier (USD$): {{amount | currency:"USD$"}}
    - no fractions (0): {{amount | currency:"USD$":0}} -
    -
    - - it('should init with 1234.56', function() { - expect(element(by.id('currency-default')).getText()).toBe('$1,234.56'); - expect(element(by.id('currency-custom')).getText()).toBe('USD$1,234.56'); - expect(element(by.id('currency-no-fractions')).getText()).toBe('USD$1,235'); - }); - it('should update', function() { - if (browser.params.browser === 'safari') { - // Safari does not understand the minus key. See - // https://github.com/angular/protractor/issues/481 - return; - } - element(by.model('amount')).clear(); - element(by.model('amount')).sendKeys('-1234'); - expect(element(by.id('currency-default')).getText()).toBe('-$1,234.00'); - expect(element(by.id('currency-custom')).getText()).toBe('-USD$1,234.00'); - expect(element(by.id('currency-no-fractions')).getText()).toBe('-USD$1,234'); - }); - -
    - */ -currencyFilter.$inject = ['$locale']; -function currencyFilter($locale) { - var formats = $locale.NUMBER_FORMATS; - return function(amount, currencySymbol, fractionSize) { - if (isUndefined(currencySymbol)) { - currencySymbol = formats.CURRENCY_SYM; - } - - if (isUndefined(fractionSize)) { - fractionSize = formats.PATTERNS[1].maxFrac; - } - - // If the currency symbol is empty, trim whitespace around the symbol - var currencySymbolRe = !currencySymbol ? /\s*\u00A4\s*/g : /\u00A4/g; - - // if null or undefined pass it through - return (amount == null) - ? amount - : formatNumber(amount, formats.PATTERNS[1], formats.GROUP_SEP, formats.DECIMAL_SEP, fractionSize). - replace(currencySymbolRe, currencySymbol); - }; -} - -/** - * @ngdoc filter - * @name number - * @kind function - * - * @description - * Formats a number as text. - * - * If the input is null or undefined, it will just be returned. - * If the input is infinite (Infinity or -Infinity), the Infinity symbol '∞' or '-∞' is returned, respectively. - * If the input is not a number an empty string is returned. - * - * - * @param {number|string} number Number to format. - * @param {(number|string)=} fractionSize Number of decimal places to round the number to. - * If this is not provided then the fraction size is computed from the current locale's number - * formatting pattern. In the case of the default locale, it will be 3. - * @returns {string} Number rounded to `fractionSize` appropriately formatted based on the current - * locale (e.g., in the en_US locale it will have "." as the decimal separator and - * include "," group separators after each third digit). - * - * @example - - - -
    -
    - Default formatting: {{val | number}}
    - No fractions: {{val | number:0}}
    - Negative number: {{-val | number:4}} -
    -
    - - it('should format numbers', function() { - expect(element(by.id('number-default')).getText()).toBe('1,234.568'); - expect(element(by.binding('val | number:0')).getText()).toBe('1,235'); - expect(element(by.binding('-val | number:4')).getText()).toBe('-1,234.5679'); - }); - - it('should update', function() { - element(by.model('val')).clear(); - element(by.model('val')).sendKeys('3374.333'); - expect(element(by.id('number-default')).getText()).toBe('3,374.333'); - expect(element(by.binding('val | number:0')).getText()).toBe('3,374'); - expect(element(by.binding('-val | number:4')).getText()).toBe('-3,374.3330'); - }); - -
    - */ -numberFilter.$inject = ['$locale']; -function numberFilter($locale) { - var formats = $locale.NUMBER_FORMATS; - return function(number, fractionSize) { - - // if null or undefined pass it through - return (number == null) - ? number - : formatNumber(number, formats.PATTERNS[0], formats.GROUP_SEP, formats.DECIMAL_SEP, - fractionSize); - }; -} - -/** - * Parse a number (as a string) into three components that can be used - * for formatting the number. - * - * (Significant bits of this parse algorithm came from https://github.com/MikeMcl/big.js/) - * - * @param {string} numStr The number to parse - * @return {object} An object describing this number, containing the following keys: - * - d : an array of digits containing leading zeros as necessary - * - i : the number of the digits in `d` that are to the left of the decimal point - * - e : the exponent for numbers that would need more than `MAX_DIGITS` digits in `d` - * - */ -function parse(numStr) { - var exponent = 0, digits, numberOfIntegerDigits; - var i, j, zeros; - - // Decimal point? - if ((numberOfIntegerDigits = numStr.indexOf(DECIMAL_SEP)) > -1) { - numStr = numStr.replace(DECIMAL_SEP, ''); - } - - // Exponential form? - if ((i = numStr.search(/e/i)) > 0) { - // Work out the exponent. - if (numberOfIntegerDigits < 0) numberOfIntegerDigits = i; - numberOfIntegerDigits += +numStr.slice(i + 1); - numStr = numStr.substring(0, i); - } else if (numberOfIntegerDigits < 0) { - // There was no decimal point or exponent so it is an integer. - numberOfIntegerDigits = numStr.length; - } - - // Count the number of leading zeros. - for (i = 0; numStr.charAt(i) === ZERO_CHAR; i++) { /* empty */ } - - if (i === (zeros = numStr.length)) { - // The digits are all zero. - digits = [0]; - numberOfIntegerDigits = 1; - } else { - // Count the number of trailing zeros - zeros--; - while (numStr.charAt(zeros) === ZERO_CHAR) zeros--; - - // Trailing zeros are insignificant so ignore them - numberOfIntegerDigits -= i; - digits = []; - // Convert string to array of digits without leading/trailing zeros. - for (j = 0; i <= zeros; i++, j++) { - digits[j] = +numStr.charAt(i); - } - } - - // If the number overflows the maximum allowed digits then use an exponent. - if (numberOfIntegerDigits > MAX_DIGITS) { - digits = digits.splice(0, MAX_DIGITS - 1); - exponent = numberOfIntegerDigits - 1; - numberOfIntegerDigits = 1; - } - - return { d: digits, e: exponent, i: numberOfIntegerDigits }; -} - -/** - * Round the parsed number to the specified number of decimal places - * This function changed the parsedNumber in-place - */ -function roundNumber(parsedNumber, fractionSize, minFrac, maxFrac) { - var digits = parsedNumber.d; - var fractionLen = digits.length - parsedNumber.i; - - // determine fractionSize if it is not specified; `+fractionSize` converts it to a number - fractionSize = (isUndefined(fractionSize)) ? Math.min(Math.max(minFrac, fractionLen), maxFrac) : +fractionSize; - - // The index of the digit to where rounding is to occur - var roundAt = fractionSize + parsedNumber.i; - var digit = digits[roundAt]; - - if (roundAt > 0) { - // Drop fractional digits beyond `roundAt` - digits.splice(Math.max(parsedNumber.i, roundAt)); - - // Set non-fractional digits beyond `roundAt` to 0 - for (var j = roundAt; j < digits.length; j++) { - digits[j] = 0; - } - } else { - // We rounded to zero so reset the parsedNumber - fractionLen = Math.max(0, fractionLen); - parsedNumber.i = 1; - digits.length = Math.max(1, roundAt = fractionSize + 1); - digits[0] = 0; - for (var i = 1; i < roundAt; i++) digits[i] = 0; - } - - if (digit >= 5) { - if (roundAt - 1 < 0) { - for (var k = 0; k > roundAt; k--) { - digits.unshift(0); - parsedNumber.i++; - } - digits.unshift(1); - parsedNumber.i++; - } else { - digits[roundAt - 1]++; - } - } - - // Pad out with zeros to get the required fraction length - for (; fractionLen < Math.max(0, fractionSize); fractionLen++) digits.push(0); - - - // Do any carrying, e.g. a digit was rounded up to 10 - var carry = digits.reduceRight(function(carry, d, i, digits) { - d = d + carry; - digits[i] = d % 10; - return Math.floor(d / 10); - }, 0); - if (carry) { - digits.unshift(carry); - parsedNumber.i++; - } -} - -/** - * Format a number into a string - * @param {number} number The number to format - * @param {{ - * minFrac, // the minimum number of digits required in the fraction part of the number - * maxFrac, // the maximum number of digits required in the fraction part of the number - * gSize, // number of digits in each group of separated digits - * lgSize, // number of digits in the last group of digits before the decimal separator - * negPre, // the string to go in front of a negative number (e.g. `-` or `(`)) - * posPre, // the string to go in front of a positive number - * negSuf, // the string to go after a negative number (e.g. `)`) - * posSuf // the string to go after a positive number - * }} pattern - * @param {string} groupSep The string to separate groups of number (e.g. `,`) - * @param {string} decimalSep The string to act as the decimal separator (e.g. `.`) - * @param {[type]} fractionSize The size of the fractional part of the number - * @return {string} The number formatted as a string - */ -function formatNumber(number, pattern, groupSep, decimalSep, fractionSize) { - - if (!(isString(number) || isNumber(number)) || isNaN(number)) return ''; - - var isInfinity = !isFinite(number); - var isZero = false; - var numStr = Math.abs(number) + '', - formattedText = '', - parsedNumber; - - if (isInfinity) { - formattedText = '\u221e'; - } else { - parsedNumber = parse(numStr); - - roundNumber(parsedNumber, fractionSize, pattern.minFrac, pattern.maxFrac); - - var digits = parsedNumber.d; - var integerLen = parsedNumber.i; - var exponent = parsedNumber.e; - var decimals = []; - isZero = digits.reduce(function(isZero, d) { return isZero && !d; }, true); - - // pad zeros for small numbers - while (integerLen < 0) { - digits.unshift(0); - integerLen++; - } - - // extract decimals digits - if (integerLen > 0) { - decimals = digits.splice(integerLen, digits.length); - } else { - decimals = digits; - digits = [0]; - } - - // format the integer digits with grouping separators - var groups = []; - if (digits.length >= pattern.lgSize) { - groups.unshift(digits.splice(-pattern.lgSize, digits.length).join('')); - } - while (digits.length > pattern.gSize) { - groups.unshift(digits.splice(-pattern.gSize, digits.length).join('')); - } - if (digits.length) { - groups.unshift(digits.join('')); - } - formattedText = groups.join(groupSep); - - // append the decimal digits - if (decimals.length) { - formattedText += decimalSep + decimals.join(''); - } - - if (exponent) { - formattedText += 'e+' + exponent; - } - } - if (number < 0 && !isZero) { - return pattern.negPre + formattedText + pattern.negSuf; - } else { - return pattern.posPre + formattedText + pattern.posSuf; - } -} - -function padNumber(num, digits, trim, negWrap) { - var neg = ''; - if (num < 0 || (negWrap && num <= 0)) { - if (negWrap) { - num = -num + 1; - } else { - num = -num; - neg = '-'; - } - } - num = '' + num; - while (num.length < digits) num = ZERO_CHAR + num; - if (trim) { - num = num.substr(num.length - digits); - } - return neg + num; -} - - -function dateGetter(name, size, offset, trim, negWrap) { - offset = offset || 0; - return function(date) { - var value = date['get' + name](); - if (offset > 0 || value > -offset) { - value += offset; - } - if (value === 0 && offset === -12) value = 12; - return padNumber(value, size, trim, negWrap); - }; -} - -function dateStrGetter(name, shortForm, standAlone) { - return function(date, formats) { - var value = date['get' + name](); - var propPrefix = (standAlone ? 'STANDALONE' : '') + (shortForm ? 'SHORT' : ''); - var get = uppercase(propPrefix + name); - - return formats[get][value]; - }; -} - -function timeZoneGetter(date, formats, offset) { - var zone = -1 * offset; - var paddedZone = (zone >= 0) ? '+' : ''; - - paddedZone += padNumber(Math[zone > 0 ? 'floor' : 'ceil'](zone / 60), 2) + - padNumber(Math.abs(zone % 60), 2); - - return paddedZone; -} - -function getFirstThursdayOfYear(year) { - // 0 = index of January - var dayOfWeekOnFirst = (new Date(year, 0, 1)).getDay(); - // 4 = index of Thursday (+1 to account for 1st = 5) - // 11 = index of *next* Thursday (+1 account for 1st = 12) - return new Date(year, 0, ((dayOfWeekOnFirst <= 4) ? 5 : 12) - dayOfWeekOnFirst); -} - -function getThursdayThisWeek(datetime) { - return new Date(datetime.getFullYear(), datetime.getMonth(), - // 4 = index of Thursday - datetime.getDate() + (4 - datetime.getDay())); -} - -function weekGetter(size) { - return function(date) { - var firstThurs = getFirstThursdayOfYear(date.getFullYear()), - thisThurs = getThursdayThisWeek(date); - - var diff = +thisThurs - +firstThurs, - result = 1 + Math.round(diff / 6.048e8); // 6.048e8 ms per week - - return padNumber(result, size); - }; -} - -function ampmGetter(date, formats) { - return date.getHours() < 12 ? formats.AMPMS[0] : formats.AMPMS[1]; -} - -function eraGetter(date, formats) { - return date.getFullYear() <= 0 ? formats.ERAS[0] : formats.ERAS[1]; -} - -function longEraGetter(date, formats) { - return date.getFullYear() <= 0 ? formats.ERANAMES[0] : formats.ERANAMES[1]; -} - -var DATE_FORMATS = { - yyyy: dateGetter('FullYear', 4, 0, false, true), - yy: dateGetter('FullYear', 2, 0, true, true), - y: dateGetter('FullYear', 1, 0, false, true), - MMMM: dateStrGetter('Month'), - MMM: dateStrGetter('Month', true), - MM: dateGetter('Month', 2, 1), - M: dateGetter('Month', 1, 1), - LLLL: dateStrGetter('Month', false, true), - dd: dateGetter('Date', 2), - d: dateGetter('Date', 1), - HH: dateGetter('Hours', 2), - H: dateGetter('Hours', 1), - hh: dateGetter('Hours', 2, -12), - h: dateGetter('Hours', 1, -12), - mm: dateGetter('Minutes', 2), - m: dateGetter('Minutes', 1), - ss: dateGetter('Seconds', 2), - s: dateGetter('Seconds', 1), - // while ISO 8601 requires fractions to be prefixed with `.` or `,` - // we can be just safely rely on using `sss` since we currently don't support single or two digit fractions - sss: dateGetter('Milliseconds', 3), - EEEE: dateStrGetter('Day'), - EEE: dateStrGetter('Day', true), - a: ampmGetter, - Z: timeZoneGetter, - ww: weekGetter(2), - w: weekGetter(1), - G: eraGetter, - GG: eraGetter, - GGG: eraGetter, - GGGG: longEraGetter -}; - -var DATE_FORMATS_SPLIT = /((?:[^yMLdHhmsaZEwG']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|L+|d+|H+|h+|m+|s+|a|Z|G+|w+))([\s\S]*)/, - NUMBER_STRING = /^-?\d+$/; - -/** - * @ngdoc filter - * @name date - * @kind function - * - * @description - * Formats `date` to a string based on the requested `format`. - * - * `format` string can be composed of the following elements: - * - * * `'yyyy'`: 4 digit representation of year (e.g. AD 1 => 0001, AD 2010 => 2010) - * * `'yy'`: 2 digit representation of year, padded (00-99). (e.g. AD 2001 => 01, AD 2010 => 10) - * * `'y'`: 1 digit representation of year, e.g. (AD 1 => 1, AD 199 => 199) - * * `'MMMM'`: Month in year (January-December) - * * `'MMM'`: Month in year (Jan-Dec) - * * `'MM'`: Month in year, padded (01-12) - * * `'M'`: Month in year (1-12) - * * `'LLLL'`: Stand-alone month in year (January-December) - * * `'dd'`: Day in month, padded (01-31) - * * `'d'`: Day in month (1-31) - * * `'EEEE'`: Day in Week,(Sunday-Saturday) - * * `'EEE'`: Day in Week, (Sun-Sat) - * * `'HH'`: Hour in day, padded (00-23) - * * `'H'`: Hour in day (0-23) - * * `'hh'`: Hour in AM/PM, padded (01-12) - * * `'h'`: Hour in AM/PM, (1-12) - * * `'mm'`: Minute in hour, padded (00-59) - * * `'m'`: Minute in hour (0-59) - * * `'ss'`: Second in minute, padded (00-59) - * * `'s'`: Second in minute (0-59) - * * `'sss'`: Millisecond in second, padded (000-999) - * * `'a'`: AM/PM marker - * * `'Z'`: 4 digit (+sign) representation of the timezone offset (-1200-+1200) - * * `'ww'`: Week of year, padded (00-53). Week 01 is the week with the first Thursday of the year - * * `'w'`: Week of year (0-53). Week 1 is the week with the first Thursday of the year - * * `'G'`, `'GG'`, `'GGG'`: The abbreviated form of the era string (e.g. 'AD') - * * `'GGGG'`: The long form of the era string (e.g. 'Anno Domini') - * - * `format` string can also be one of the following predefined - * {@link guide/i18n localizable formats}: - * - * * `'medium'`: equivalent to `'MMM d, y h:mm:ss a'` for en_US locale - * (e.g. Sep 3, 2010 12:05:08 PM) - * * `'short'`: equivalent to `'M/d/yy h:mm a'` for en_US locale (e.g. 9/3/10 12:05 PM) - * * `'fullDate'`: equivalent to `'EEEE, MMMM d, y'` for en_US locale - * (e.g. Friday, September 3, 2010) - * * `'longDate'`: equivalent to `'MMMM d, y'` for en_US locale (e.g. September 3, 2010) - * * `'mediumDate'`: equivalent to `'MMM d, y'` for en_US locale (e.g. Sep 3, 2010) - * * `'shortDate'`: equivalent to `'M/d/yy'` for en_US locale (e.g. 9/3/10) - * * `'mediumTime'`: equivalent to `'h:mm:ss a'` for en_US locale (e.g. 12:05:08 PM) - * * `'shortTime'`: equivalent to `'h:mm a'` for en_US locale (e.g. 12:05 PM) - * - * `format` string can contain literal values. These need to be escaped by surrounding with single quotes (e.g. - * `"h 'in the morning'"`). In order to output a single quote, escape it - i.e., two single quotes in a sequence - * (e.g. `"h 'o''clock'"`). - * - * Any other characters in the `format` string will be output as-is. - * - * @param {(Date|number|string)} date Date to format either as Date object, milliseconds (string or - * number) or various ISO 8601 datetime string formats (e.g. yyyy-MM-ddTHH:mm:ss.sssZ and its - * shorter versions like yyyy-MM-ddTHH:mmZ, yyyy-MM-dd or yyyyMMddTHHmmssZ). If no timezone is - * specified in the string input, the time is considered to be in the local timezone. - * @param {string=} format Formatting rules (see Description). If not specified, - * `mediumDate` is used. - * @param {string=} timezone Timezone to be used for formatting. It understands UTC/GMT and the - * continental US time zone abbreviations, but for general use, use a time zone offset, for - * example, `'+0430'` (4 hours, 30 minutes east of the Greenwich meridian) - * If not specified, the timezone of the browser will be used. - * @returns {string} Formatted string or the input if input is not recognized as date/millis. - * - * @example - - - {{1288323623006 | date:'medium'}}: - {{1288323623006 | date:'medium'}}
    - {{1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'}}: - {{1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'}}
    - {{1288323623006 | date:'MM/dd/yyyy @ h:mma'}}: - {{'1288323623006' | date:'MM/dd/yyyy @ h:mma'}}
    - {{1288323623006 | date:"MM/dd/yyyy 'at' h:mma"}}: - {{'1288323623006' | date:"MM/dd/yyyy 'at' h:mma"}}
    -
    - - it('should format date', function() { - expect(element(by.binding("1288323623006 | date:'medium'")).getText()). - toMatch(/Oct 2\d, 2010 \d{1,2}:\d{2}:\d{2} (AM|PM)/); - expect(element(by.binding("1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'")).getText()). - toMatch(/2010-10-2\d \d{2}:\d{2}:\d{2} (-|\+)?\d{4}/); - expect(element(by.binding("'1288323623006' | date:'MM/dd/yyyy @ h:mma'")).getText()). - toMatch(/10\/2\d\/2010 @ \d{1,2}:\d{2}(AM|PM)/); - expect(element(by.binding("'1288323623006' | date:\"MM/dd/yyyy 'at' h:mma\"")).getText()). - toMatch(/10\/2\d\/2010 at \d{1,2}:\d{2}(AM|PM)/); - }); - -
    - */ -dateFilter.$inject = ['$locale']; -function dateFilter($locale) { - - - var R_ISO8601_STR = /^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/; - // 1 2 3 4 5 6 7 8 9 10 11 - function jsonStringToDate(string) { - var match; - if ((match = string.match(R_ISO8601_STR))) { - var date = new Date(0), - tzHour = 0, - tzMin = 0, - dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear, - timeSetter = match[8] ? date.setUTCHours : date.setHours; - - if (match[9]) { - tzHour = toInt(match[9] + match[10]); - tzMin = toInt(match[9] + match[11]); - } - dateSetter.call(date, toInt(match[1]), toInt(match[2]) - 1, toInt(match[3])); - var h = toInt(match[4] || 0) - tzHour; - var m = toInt(match[5] || 0) - tzMin; - var s = toInt(match[6] || 0); - var ms = Math.round(parseFloat('0.' + (match[7] || 0)) * 1000); - timeSetter.call(date, h, m, s, ms); - return date; - } - return string; - } - - - return function(date, format, timezone) { - var text = '', - parts = [], - fn, match; - - format = format || 'mediumDate'; - format = $locale.DATETIME_FORMATS[format] || format; - if (isString(date)) { - date = NUMBER_STRING.test(date) ? toInt(date) : jsonStringToDate(date); - } - - if (isNumber(date)) { - date = new Date(date); - } - - if (!isDate(date) || !isFinite(date.getTime())) { - return date; - } - - while (format) { - match = DATE_FORMATS_SPLIT.exec(format); - if (match) { - parts = concat(parts, match, 1); - format = parts.pop(); - } else { - parts.push(format); - format = null; - } - } - - var dateTimezoneOffset = date.getTimezoneOffset(); - if (timezone) { - dateTimezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset); - date = convertTimezoneToLocal(date, timezone, true); - } - forEach(parts, function(value) { - fn = DATE_FORMATS[value]; - text += fn ? fn(date, $locale.DATETIME_FORMATS, dateTimezoneOffset) - : value === '\'\'' ? '\'' : value.replace(/(^'|'$)/g, '').replace(/''/g, '\''); - }); - - return text; - }; -} - - -/** - * @ngdoc filter - * @name json - * @kind function - * - * @description - * Allows you to convert a JavaScript object into JSON string. - * - * This filter is mostly useful for debugging. When using the double curly {{value}} notation - * the binding is automatically converted to JSON. - * - * @param {*} object Any JavaScript object (including arrays and primitive types) to filter. - * @param {number=} spacing The number of spaces to use per indentation, defaults to 2. - * @returns {string} JSON string. - * - * - * @example - - -
    {{ {'name':'value'} | json }}
    -
    {{ {'name':'value'} | json:4 }}
    -
    - - it('should jsonify filtered objects', function() { - expect(element(by.id('default-spacing')).getText()).toMatch(/\{\n {2}"name": ?"value"\n}/); - expect(element(by.id('custom-spacing')).getText()).toMatch(/\{\n {4}"name": ?"value"\n}/); - }); - -
    - * - */ -function jsonFilter() { - return function(object, spacing) { - if (isUndefined(spacing)) { - spacing = 2; - } - return toJson(object, spacing); - }; -} - - -/** - * @ngdoc filter - * @name lowercase - * @kind function - * @description - * Converts string to lowercase. - * - * See the {@link ng.uppercase uppercase filter documentation} for a functionally identical example. - * - * @see angular.lowercase - */ -var lowercaseFilter = valueFn(lowercase); - - -/** - * @ngdoc filter - * @name uppercase - * @kind function - * @description - * Converts string to uppercase. - * @example - - - -
    - -

    {{title}}

    - -

    {{title | uppercase}}

    -
    -
    -
    - */ -var uppercaseFilter = valueFn(uppercase); - -/** - * @ngdoc filter - * @name limitTo - * @kind function - * - * @description - * Creates a new array or string containing only a specified number of elements. The elements are - * taken from either the beginning or the end of the source array, string or number, as specified by - * the value and sign (positive or negative) of `limit`. Other array-like objects are also supported - * (e.g. array subclasses, NodeLists, jqLite/jQuery collections etc). If a number is used as input, - * it is converted to a string. - * - * @param {Array|ArrayLike|string|number} input - Array/array-like, string or number to be limited. - * @param {string|number} limit - The length of the returned array or string. If the `limit` number - * is positive, `limit` number of items from the beginning of the source array/string are copied. - * If the number is negative, `limit` number of items from the end of the source array/string - * are copied. The `limit` will be trimmed if it exceeds `array.length`. If `limit` is undefined, - * the input will be returned unchanged. - * @param {(string|number)=} begin - Index at which to begin limitation. As a negative index, - * `begin` indicates an offset from the end of `input`. Defaults to `0`. - * @returns {Array|string} A new sub-array or substring of length `limit` or less if the input had - * less than `limit` elements. - * - * @example - - - -
    - -

    Output numbers: {{ numbers | limitTo:numLimit }}

    - -

    Output letters: {{ letters | limitTo:letterLimit }}

    - -

    Output long number: {{ longNumber | limitTo:longNumberLimit }}

    -
    -
    - - var numLimitInput = element(by.model('numLimit')); - var letterLimitInput = element(by.model('letterLimit')); - var longNumberLimitInput = element(by.model('longNumberLimit')); - var limitedNumbers = element(by.binding('numbers | limitTo:numLimit')); - var limitedLetters = element(by.binding('letters | limitTo:letterLimit')); - var limitedLongNumber = element(by.binding('longNumber | limitTo:longNumberLimit')); - - it('should limit the number array to first three items', function() { - expect(numLimitInput.getAttribute('value')).toBe('3'); - expect(letterLimitInput.getAttribute('value')).toBe('3'); - expect(longNumberLimitInput.getAttribute('value')).toBe('3'); - expect(limitedNumbers.getText()).toEqual('Output numbers: [1,2,3]'); - expect(limitedLetters.getText()).toEqual('Output letters: abc'); - expect(limitedLongNumber.getText()).toEqual('Output long number: 234'); - }); - - // There is a bug in safari and protractor that doesn't like the minus key - // it('should update the output when -3 is entered', function() { - // numLimitInput.clear(); - // numLimitInput.sendKeys('-3'); - // letterLimitInput.clear(); - // letterLimitInput.sendKeys('-3'); - // longNumberLimitInput.clear(); - // longNumberLimitInput.sendKeys('-3'); - // expect(limitedNumbers.getText()).toEqual('Output numbers: [7,8,9]'); - // expect(limitedLetters.getText()).toEqual('Output letters: ghi'); - // expect(limitedLongNumber.getText()).toEqual('Output long number: 342'); - // }); - - it('should not exceed the maximum size of input array', function() { - numLimitInput.clear(); - numLimitInput.sendKeys('100'); - letterLimitInput.clear(); - letterLimitInput.sendKeys('100'); - longNumberLimitInput.clear(); - longNumberLimitInput.sendKeys('100'); - expect(limitedNumbers.getText()).toEqual('Output numbers: [1,2,3,4,5,6,7,8,9]'); - expect(limitedLetters.getText()).toEqual('Output letters: abcdefghi'); - expect(limitedLongNumber.getText()).toEqual('Output long number: 2345432342'); - }); - -
    -*/ -function limitToFilter() { - return function(input, limit, begin) { - if (Math.abs(Number(limit)) === Infinity) { - limit = Number(limit); - } else { - limit = toInt(limit); - } - if (isNumberNaN(limit)) return input; - - if (isNumber(input)) input = input.toString(); - if (!isArrayLike(input)) return input; - - begin = (!begin || isNaN(begin)) ? 0 : toInt(begin); - begin = (begin < 0) ? Math.max(0, input.length + begin) : begin; - - if (limit >= 0) { - return sliceFn(input, begin, begin + limit); - } else { - if (begin === 0) { - return sliceFn(input, limit, input.length); - } else { - return sliceFn(input, Math.max(0, begin + limit), begin); - } - } - }; -} - -function sliceFn(input, begin, end) { - if (isString(input)) return input.slice(begin, end); - - return slice.call(input, begin, end); -} - -/** - * @ngdoc filter - * @name orderBy - * @kind function - * - * @description - * Returns an array containing the items from the specified `collection`, ordered by a `comparator` - * function based on the values computed using the `expression` predicate. - * - * For example, `[{id: 'foo'}, {id: 'bar'}] | orderBy:'id'` would result in - * `[{id: 'bar'}, {id: 'foo'}]`. - * - * The `collection` can be an Array or array-like object (e.g. NodeList, jQuery object, TypedArray, - * String, etc). - * - * The `expression` can be a single predicate, or a list of predicates each serving as a tie-breaker - * for the preceding one. The `expression` is evaluated against each item and the output is used - * for comparing with other items. - * - * You can change the sorting order by setting `reverse` to `true`. By default, items are sorted in - * ascending order. - * - * The comparison is done using the `comparator` function. If none is specified, a default, built-in - * comparator is used (see below for details - in a nutshell, it compares numbers numerically and - * strings alphabetically). - * - * ### Under the hood - * - * Ordering the specified `collection` happens in two phases: - * - * 1. All items are passed through the predicate (or predicates), and the returned values are saved - * along with their type (`string`, `number` etc). For example, an item `{label: 'foo'}`, passed - * through a predicate that extracts the value of the `label` property, would be transformed to: - * ``` - * { - * value: 'foo', - * type: 'string', - * index: ... - * } - * ``` - * **Note:** `null` values use `'null'` as their type. - * 2. The comparator function is used to sort the items, based on the derived values, types and - * indices. - * - * If you use a custom comparator, it will be called with pairs of objects of the form - * `{value: ..., type: '...', index: ...}` and is expected to return `0` if the objects are equal - * (as far as the comparator is concerned), `-1` if the 1st one should be ranked higher than the - * second, or `1` otherwise. - * - * In order to ensure that the sorting will be deterministic across platforms, if none of the - * specified predicates can distinguish between two items, `orderBy` will automatically introduce a - * dummy predicate that returns the item's index as `value`. - * (If you are using a custom comparator, make sure it can handle this predicate as well.) - * - * If a custom comparator still can't distinguish between two items, then they will be sorted based - * on their index using the built-in comparator. - * - * Finally, in an attempt to simplify things, if a predicate returns an object as the extracted - * value for an item, `orderBy` will try to convert that object to a primitive value, before passing - * it to the comparator. The following rules govern the conversion: - * - * 1. If the object has a `valueOf()` method that returns a primitive, its return value will be - * used instead.
    - * (If the object has a `valueOf()` method that returns another object, then the returned object - * will be used in subsequent steps.) - * 2. If the object has a custom `toString()` method (i.e. not the one inherited from `Object`) that - * returns a primitive, its return value will be used instead.
    - * (If the object has a `toString()` method that returns another object, then the returned object - * will be used in subsequent steps.) - * 3. No conversion; the object itself is used. - * - * ### The default comparator - * - * The default, built-in comparator should be sufficient for most usecases. In short, it compares - * numbers numerically, strings alphabetically (and case-insensitively), for objects falls back to - * using their index in the original collection, sorts values of different types by type and puts - * `undefined` and `null` values at the end of the sorted list. - * - * More specifically, it follows these steps to determine the relative order of items: - * - * 1. If the compared values are of different types: - * - If one of the values is undefined, consider it "greater than" the other. - * - Else if one of the values is null, consider it "greater than" the other. - * - Else compare the types themselves alphabetically. - * 2. If both values are of type `string`, compare them alphabetically in a case- and - * locale-insensitive way. - * 3. If both values are objects, compare their indices instead. - * 4. Otherwise, return: - * - `0`, if the values are equal (by strict equality comparison, i.e. using `===`). - * - `-1`, if the 1st value is "less than" the 2nd value (compared using the `<` operator). - * - `1`, otherwise. - * - * **Note:** If you notice numbers not being sorted as expected, make sure they are actually being - * saved as numbers and not strings. - * **Note:** For the purpose of sorting, `null` and `undefined` are considered "greater than" - * any other value (with undefined "greater than" null). This effectively means that `null` - * and `undefined` values end up at the end of a list sorted in ascending order. - * **Note:** `null` values use `'null'` as their type to be able to distinguish them from objects. - * - * @param {Array|ArrayLike} collection - The collection (array or array-like object) to sort. - * @param {(Function|string|Array.)=} expression - A predicate (or list of - * predicates) to be used by the comparator to determine the order of elements. - * - * Can be one of: - * - * - `Function`: A getter function. This function will be called with each item as argument and - * the return value will be used for sorting. - * - `string`: An AngularJS expression. This expression will be evaluated against each item and the - * result will be used for sorting. For example, use `'label'` to sort by a property called - * `label` or `'label.substring(0, 3)'` to sort by the first 3 characters of the `label` - * property.
    - * (The result of a constant expression is interpreted as a property name to be used for - * comparison. For example, use `'"special name"'` (note the extra pair of quotes) to sort by a - * property called `special name`.)
    - * An expression can be optionally prefixed with `+` or `-` to control the sorting direction, - * ascending or descending. For example, `'+label'` or `'-label'`. If no property is provided, - * (e.g. `'+'` or `'-'`), the collection element itself is used in comparisons. - * - `Array`: An array of function and/or string predicates. If a predicate cannot determine the - * relative order of two items, the next predicate is used as a tie-breaker. - * - * **Note:** If the predicate is missing or empty then it defaults to `'+'`. - * - * @param {boolean=} reverse - If `true`, reverse the sorting order. - * @param {(Function)=} comparator - The comparator function used to determine the relative order of - * value pairs. If omitted, the built-in comparator will be used. - * - * @returns {Array} - The sorted array. - * - * - * @example - * ### Ordering a table with `ngRepeat` - * - * The example below demonstrates a simple {@link ngRepeat ngRepeat}, where the data is sorted by - * age in descending order (expression is set to `'-age'`). The `comparator` is not set, which means - * it defaults to the built-in comparator. - * - - -
    - - - - - - - - - - - -
    NamePhone NumberAge
    {{friend.name}}{{friend.phone}}{{friend.age}}
    -
    -
    - - angular.module('orderByExample1', []) - .controller('ExampleController', ['$scope', function($scope) { - $scope.friends = [ - {name: 'John', phone: '555-1212', age: 10}, - {name: 'Mary', phone: '555-9876', age: 19}, - {name: 'Mike', phone: '555-4321', age: 21}, - {name: 'Adam', phone: '555-5678', age: 35}, - {name: 'Julie', phone: '555-8765', age: 29} - ]; - }]); - - - .friends { - border-collapse: collapse; - } - - .friends th { - border-bottom: 1px solid; - } - .friends td, .friends th { - border-left: 1px solid; - padding: 5px 10px; - } - .friends td:first-child, .friends th:first-child { - border-left: none; - } - - - // Element locators - var names = element.all(by.repeater('friends').column('friend.name')); - - it('should sort friends by age in reverse order', function() { - expect(names.get(0).getText()).toBe('Adam'); - expect(names.get(1).getText()).toBe('Julie'); - expect(names.get(2).getText()).toBe('Mike'); - expect(names.get(3).getText()).toBe('Mary'); - expect(names.get(4).getText()).toBe('John'); - }); - -
    - *
    - * - * @example - * ### Changing parameters dynamically - * - * All parameters can be changed dynamically. The next example shows how you can make the columns of - * a table sortable, by binding the `expression` and `reverse` parameters to scope properties. - * - - -
    -
    Sort by = {{propertyName}}; reverse = {{reverse}}
    -
    - -
    - - - - - - - - - - - -
    - - - - - - - - -
    {{friend.name}}{{friend.phone}}{{friend.age}}
    -
    -
    - - angular.module('orderByExample2', []) - .controller('ExampleController', ['$scope', function($scope) { - var friends = [ - {name: 'John', phone: '555-1212', age: 10}, - {name: 'Mary', phone: '555-9876', age: 19}, - {name: 'Mike', phone: '555-4321', age: 21}, - {name: 'Adam', phone: '555-5678', age: 35}, - {name: 'Julie', phone: '555-8765', age: 29} - ]; - - $scope.propertyName = 'age'; - $scope.reverse = true; - $scope.friends = friends; - - $scope.sortBy = function(propertyName) { - $scope.reverse = ($scope.propertyName === propertyName) ? !$scope.reverse : false; - $scope.propertyName = propertyName; - }; - }]); - - - .friends { - border-collapse: collapse; - } - - .friends th { - border-bottom: 1px solid; - } - .friends td, .friends th { - border-left: 1px solid; - padding: 5px 10px; - } - .friends td:first-child, .friends th:first-child { - border-left: none; - } - - .sortorder:after { - content: '\25b2'; // BLACK UP-POINTING TRIANGLE - } - .sortorder.reverse:after { - content: '\25bc'; // BLACK DOWN-POINTING TRIANGLE - } - - - // Element locators - var unsortButton = element(by.partialButtonText('unsorted')); - var nameHeader = element(by.partialButtonText('Name')); - var phoneHeader = element(by.partialButtonText('Phone')); - var ageHeader = element(by.partialButtonText('Age')); - var firstName = element(by.repeater('friends').column('friend.name').row(0)); - var lastName = element(by.repeater('friends').column('friend.name').row(4)); - - it('should sort friends by some property, when clicking on the column header', function() { - expect(firstName.getText()).toBe('Adam'); - expect(lastName.getText()).toBe('John'); - - phoneHeader.click(); - expect(firstName.getText()).toBe('John'); - expect(lastName.getText()).toBe('Mary'); - - nameHeader.click(); - expect(firstName.getText()).toBe('Adam'); - expect(lastName.getText()).toBe('Mike'); - - ageHeader.click(); - expect(firstName.getText()).toBe('John'); - expect(lastName.getText()).toBe('Adam'); - }); - - it('should sort friends in reverse order, when clicking on the same column', function() { - expect(firstName.getText()).toBe('Adam'); - expect(lastName.getText()).toBe('John'); - - ageHeader.click(); - expect(firstName.getText()).toBe('John'); - expect(lastName.getText()).toBe('Adam'); - - ageHeader.click(); - expect(firstName.getText()).toBe('Adam'); - expect(lastName.getText()).toBe('John'); - }); - - it('should restore the original order, when clicking "Set to unsorted"', function() { - expect(firstName.getText()).toBe('Adam'); - expect(lastName.getText()).toBe('John'); - - unsortButton.click(); - expect(firstName.getText()).toBe('John'); - expect(lastName.getText()).toBe('Julie'); - }); - -
    - *
    - * - * @example - * ### Using `orderBy` inside a controller - * - * It is also possible to call the `orderBy` filter manually, by injecting `orderByFilter`, and - * calling it with the desired parameters. (Alternatively, you could inject the `$filter` factory - * and retrieve the `orderBy` filter with `$filter('orderBy')`.) - * - - -
    -
    Sort by = {{propertyName}}; reverse = {{reverse}}
    -
    - -
    - - - - - - - - - - - -
    - - - - - - - - -
    {{friend.name}}{{friend.phone}}{{friend.age}}
    -
    -
    - - angular.module('orderByExample3', []) - .controller('ExampleController', ['$scope', 'orderByFilter', function($scope, orderBy) { - var friends = [ - {name: 'John', phone: '555-1212', age: 10}, - {name: 'Mary', phone: '555-9876', age: 19}, - {name: 'Mike', phone: '555-4321', age: 21}, - {name: 'Adam', phone: '555-5678', age: 35}, - {name: 'Julie', phone: '555-8765', age: 29} - ]; - - $scope.propertyName = 'age'; - $scope.reverse = true; - $scope.friends = orderBy(friends, $scope.propertyName, $scope.reverse); - - $scope.sortBy = function(propertyName) { - $scope.reverse = (propertyName !== null && $scope.propertyName === propertyName) - ? !$scope.reverse : false; - $scope.propertyName = propertyName; - $scope.friends = orderBy(friends, $scope.propertyName, $scope.reverse); - }; - }]); - - - .friends { - border-collapse: collapse; - } - - .friends th { - border-bottom: 1px solid; - } - .friends td, .friends th { - border-left: 1px solid; - padding: 5px 10px; - } - .friends td:first-child, .friends th:first-child { - border-left: none; - } - - .sortorder:after { - content: '\25b2'; // BLACK UP-POINTING TRIANGLE - } - .sortorder.reverse:after { - content: '\25bc'; // BLACK DOWN-POINTING TRIANGLE - } - - - // Element locators - var unsortButton = element(by.partialButtonText('unsorted')); - var nameHeader = element(by.partialButtonText('Name')); - var phoneHeader = element(by.partialButtonText('Phone')); - var ageHeader = element(by.partialButtonText('Age')); - var firstName = element(by.repeater('friends').column('friend.name').row(0)); - var lastName = element(by.repeater('friends').column('friend.name').row(4)); - - it('should sort friends by some property, when clicking on the column header', function() { - expect(firstName.getText()).toBe('Adam'); - expect(lastName.getText()).toBe('John'); - - phoneHeader.click(); - expect(firstName.getText()).toBe('John'); - expect(lastName.getText()).toBe('Mary'); - - nameHeader.click(); - expect(firstName.getText()).toBe('Adam'); - expect(lastName.getText()).toBe('Mike'); - - ageHeader.click(); - expect(firstName.getText()).toBe('John'); - expect(lastName.getText()).toBe('Adam'); - }); - - it('should sort friends in reverse order, when clicking on the same column', function() { - expect(firstName.getText()).toBe('Adam'); - expect(lastName.getText()).toBe('John'); - - ageHeader.click(); - expect(firstName.getText()).toBe('John'); - expect(lastName.getText()).toBe('Adam'); - - ageHeader.click(); - expect(firstName.getText()).toBe('Adam'); - expect(lastName.getText()).toBe('John'); - }); - - it('should restore the original order, when clicking "Set to unsorted"', function() { - expect(firstName.getText()).toBe('Adam'); - expect(lastName.getText()).toBe('John'); - - unsortButton.click(); - expect(firstName.getText()).toBe('John'); - expect(lastName.getText()).toBe('Julie'); - }); - -
    - *
    - * - * @example - * ### Using a custom comparator - * - * If you have very specific requirements about the way items are sorted, you can pass your own - * comparator function. For example, you might need to compare some strings in a locale-sensitive - * way. (When specifying a custom comparator, you also need to pass a value for the `reverse` - * argument - passing `false` retains the default sorting order, i.e. ascending.) - * - - -
    -
    -

    Locale-sensitive Comparator

    - - - - - - - - - -
    NameFavorite Letter
    {{friend.name}}{{friend.favoriteLetter}}
    -
    -
    -

    Default Comparator

    - - - - - - - - - -
    NameFavorite Letter
    {{friend.name}}{{friend.favoriteLetter}}
    -
    -
    -
    - - angular.module('orderByExample4', []) - .controller('ExampleController', ['$scope', function($scope) { - $scope.friends = [ - {name: 'John', favoriteLetter: 'Ä'}, - {name: 'Mary', favoriteLetter: 'Ü'}, - {name: 'Mike', favoriteLetter: 'Ö'}, - {name: 'Adam', favoriteLetter: 'H'}, - {name: 'Julie', favoriteLetter: 'Z'} - ]; - - $scope.localeSensitiveComparator = function(v1, v2) { - // If we don't get strings, just compare by index - if (v1.type !== 'string' || v2.type !== 'string') { - return (v1.index < v2.index) ? -1 : 1; - } - - // Compare strings alphabetically, taking locale into account - return v1.value.localeCompare(v2.value); - }; - }]); - - - .friends-container { - display: inline-block; - margin: 0 30px; - } - - .friends { - border-collapse: collapse; - } - - .friends th { - border-bottom: 1px solid; - } - .friends td, .friends th { - border-left: 1px solid; - padding: 5px 10px; - } - .friends td:first-child, .friends th:first-child { - border-left: none; - } - - - // Element locators - var container = element(by.css('.custom-comparator')); - var names = container.all(by.repeater('friends').column('friend.name')); - - it('should sort friends by favorite letter (in correct alphabetical order)', function() { - expect(names.get(0).getText()).toBe('John'); - expect(names.get(1).getText()).toBe('Adam'); - expect(names.get(2).getText()).toBe('Mike'); - expect(names.get(3).getText()).toBe('Mary'); - expect(names.get(4).getText()).toBe('Julie'); - }); - -
    - * - */ -orderByFilter.$inject = ['$parse']; -function orderByFilter($parse) { - return function(array, sortPredicate, reverseOrder, compareFn) { - - if (array == null) return array; - if (!isArrayLike(array)) { - throw minErr('orderBy')('notarray', 'Expected array but received: {0}', array); - } - - if (!isArray(sortPredicate)) { sortPredicate = [sortPredicate]; } - if (sortPredicate.length === 0) { sortPredicate = ['+']; } - - var predicates = processPredicates(sortPredicate); - - var descending = reverseOrder ? -1 : 1; - - // Define the `compare()` function. Use a default comparator if none is specified. - var compare = isFunction(compareFn) ? compareFn : defaultCompare; - - // The next three lines are a version of a Swartzian Transform idiom from Perl - // (sometimes called the Decorate-Sort-Undecorate idiom) - // See https://en.wikipedia.org/wiki/Schwartzian_transform - var compareValues = Array.prototype.map.call(array, getComparisonObject); - compareValues.sort(doComparison); - array = compareValues.map(function(item) { return item.value; }); - - return array; - - function getComparisonObject(value, index) { - // NOTE: We are adding an extra `tieBreaker` value based on the element's index. - // This will be used to keep the sort stable when none of the input predicates can - // distinguish between two elements. - return { - value: value, - tieBreaker: {value: index, type: 'number', index: index}, - predicateValues: predicates.map(function(predicate) { - return getPredicateValue(predicate.get(value), index); - }) - }; - } - - function doComparison(v1, v2) { - for (var i = 0, ii = predicates.length; i < ii; i++) { - var result = compare(v1.predicateValues[i], v2.predicateValues[i]); - if (result) { - return result * predicates[i].descending * descending; - } - } - - return (compare(v1.tieBreaker, v2.tieBreaker) || defaultCompare(v1.tieBreaker, v2.tieBreaker)) * descending; - } - }; - - function processPredicates(sortPredicates) { - return sortPredicates.map(function(predicate) { - var descending = 1, get = identity; - - if (isFunction(predicate)) { - get = predicate; - } else if (isString(predicate)) { - if ((predicate.charAt(0) === '+' || predicate.charAt(0) === '-')) { - descending = predicate.charAt(0) === '-' ? -1 : 1; - predicate = predicate.substring(1); - } - if (predicate !== '') { - get = $parse(predicate); - if (get.constant) { - var key = get(); - get = function(value) { return value[key]; }; - } - } - } - return {get: get, descending: descending}; - }); - } - - function isPrimitive(value) { - switch (typeof value) { - case 'number': /* falls through */ - case 'boolean': /* falls through */ - case 'string': - return true; - default: - return false; - } - } - - function objectValue(value) { - // If `valueOf` is a valid function use that - if (isFunction(value.valueOf)) { - value = value.valueOf(); - if (isPrimitive(value)) return value; - } - // If `toString` is a valid function and not the one from `Object.prototype` use that - if (hasCustomToString(value)) { - value = value.toString(); - if (isPrimitive(value)) return value; - } - - return value; - } - - function getPredicateValue(value, index) { - var type = typeof value; - if (value === null) { - type = 'null'; - } else if (type === 'object') { - value = objectValue(value); - } - return {value: value, type: type, index: index}; - } - - function defaultCompare(v1, v2) { - var result = 0; - var type1 = v1.type; - var type2 = v2.type; - - if (type1 === type2) { - var value1 = v1.value; - var value2 = v2.value; - - if (type1 === 'string') { - // Compare strings case-insensitively - value1 = value1.toLowerCase(); - value2 = value2.toLowerCase(); - } else if (type1 === 'object') { - // For basic objects, use the position of the object - // in the collection instead of the value - if (isObject(value1)) value1 = v1.index; - if (isObject(value2)) value2 = v2.index; - } - - if (value1 !== value2) { - result = value1 < value2 ? -1 : 1; - } - } else { - result = (type1 === 'undefined') ? 1 : - (type2 === 'undefined') ? -1 : - (type1 === 'null') ? 1 : - (type2 === 'null') ? -1 : - (type1 < type2) ? -1 : 1; - } - - return result; - } -} - -function ngDirective(directive) { - if (isFunction(directive)) { - directive = { - link: directive - }; - } - directive.restrict = directive.restrict || 'AC'; - return valueFn(directive); -} - -/** - * @ngdoc directive - * @name a - * @restrict E - * - * @description - * Modifies the default behavior of the html a tag so that the default action is prevented when - * the href attribute is empty. - * - * For dynamically creating `href` attributes for a tags, see the {@link ng.ngHref `ngHref`} directive. - */ -var htmlAnchorDirective = valueFn({ - restrict: 'E', - compile: function(element, attr) { - if (!attr.href && !attr.xlinkHref) { - return function(scope, element) { - // If the linked element is not an anchor tag anymore, do nothing - if (element[0].nodeName.toLowerCase() !== 'a') return; - - // SVGAElement does not use the href attribute, but rather the 'xlinkHref' attribute. - var href = toString.call(element.prop('href')) === '[object SVGAnimatedString]' ? - 'xlink:href' : 'href'; - element.on('click', function(event) { - // if we have no href url, then don't navigate anywhere. - if (!element.attr(href)) { - event.preventDefault(); - } - }); - }; - } - } -}); - -/** - * @ngdoc directive - * @name ngHref - * @restrict A - * @priority 99 - * - * @description - * Using AngularJS markup like `{{hash}}` in an href attribute will - * make the link go to the wrong URL if the user clicks it before - * AngularJS has a chance to replace the `{{hash}}` markup with its - * value. Until AngularJS replaces the markup the link will be broken - * and will most likely return a 404 error. The `ngHref` directive - * solves this problem. - * - * The wrong way to write it: - * ```html - * link1 - * ``` - * - * The correct way to write it: - * ```html - * link1 - * ``` - * - * @element A - * @param {template} ngHref any string which can contain `{{}}` markup. - * - * @example - * This example shows various combinations of `href`, `ng-href` and `ng-click` attributes - * in links and their different behaviors: - - -
    - link 1 (link, don't reload)
    - link 2 (link, don't reload)
    - link 3 (link, reload!)
    - anchor (link, don't reload)
    - anchor (no link)
    - link (link, change location) -
    - - it('should execute ng-click but not reload when href without value', function() { - element(by.id('link-1')).click(); - expect(element(by.model('value')).getAttribute('value')).toEqual('1'); - expect(element(by.id('link-1')).getAttribute('href')).toBe(''); - }); - - it('should execute ng-click but not reload when href empty string', function() { - element(by.id('link-2')).click(); - expect(element(by.model('value')).getAttribute('value')).toEqual('2'); - expect(element(by.id('link-2')).getAttribute('href')).toBe(''); - }); - - it('should execute ng-click and change url when ng-href specified', function() { - expect(element(by.id('link-3')).getAttribute('href')).toMatch(/\/123$/); - - element(by.id('link-3')).click(); - - // At this point, we navigate away from an AngularJS page, so we need - // to use browser.driver to get the base webdriver. - - browser.wait(function() { - return browser.driver.getCurrentUrl().then(function(url) { - return url.match(/\/123$/); - }); - }, 5000, 'page should navigate to /123'); - }); - - it('should execute ng-click but not reload when href empty string and name specified', function() { - element(by.id('link-4')).click(); - expect(element(by.model('value')).getAttribute('value')).toEqual('4'); - expect(element(by.id('link-4')).getAttribute('href')).toBe(''); - }); - - it('should execute ng-click but not reload when no href but name specified', function() { - element(by.id('link-5')).click(); - expect(element(by.model('value')).getAttribute('value')).toEqual('5'); - expect(element(by.id('link-5')).getAttribute('href')).toBe(null); - }); - - it('should only change url when only ng-href', function() { - element(by.model('value')).clear(); - element(by.model('value')).sendKeys('6'); - expect(element(by.id('link-6')).getAttribute('href')).toMatch(/\/6$/); - - element(by.id('link-6')).click(); - - // At this point, we navigate away from an AngularJS page, so we need - // to use browser.driver to get the base webdriver. - browser.wait(function() { - return browser.driver.getCurrentUrl().then(function(url) { - return url.match(/\/6$/); - }); - }, 5000, 'page should navigate to /6'); - }); - -
    - */ - -/** - * @ngdoc directive - * @name ngSrc - * @restrict A - * @priority 99 - * - * @description - * Using AngularJS markup like `{{hash}}` in a `src` attribute doesn't - * work right: The browser will fetch from the URL with the literal - * text `{{hash}}` until AngularJS replaces the expression inside - * `{{hash}}`. The `ngSrc` directive solves this problem. - * - * The buggy way to write it: - * ```html - * Description - * ``` - * - * The correct way to write it: - * ```html - * Description - * ``` - * - * @element IMG - * @param {template} ngSrc any string which can contain `{{}}` markup. - */ - -/** - * @ngdoc directive - * @name ngSrcset - * @restrict A - * @priority 99 - * - * @description - * Using AngularJS markup like `{{hash}}` in a `srcset` attribute doesn't - * work right: The browser will fetch from the URL with the literal - * text `{{hash}}` until AngularJS replaces the expression inside - * `{{hash}}`. The `ngSrcset` directive solves this problem. - * - * The buggy way to write it: - * ```html - * Description - * ``` - * - * The correct way to write it: - * ```html - * Description - * ``` - * - * @element IMG - * @param {template} ngSrcset any string which can contain `{{}}` markup. - */ - -/** - * @ngdoc directive - * @name ngDisabled - * @restrict A - * @priority 100 - * - * @description - * - * This directive sets the `disabled` attribute on the element (typically a form control, - * e.g. `input`, `button`, `select` etc.) if the - * {@link guide/expression expression} inside `ngDisabled` evaluates to truthy. - * - * A special directive is necessary because we cannot use interpolation inside the `disabled` - * attribute. See the {@link guide/interpolation interpolation guide} for more info. - * - * @example - - -
    - -
    - - it('should toggle button', function() { - expect(element(by.css('button')).getAttribute('disabled')).toBeFalsy(); - element(by.model('checked')).click(); - expect(element(by.css('button')).getAttribute('disabled')).toBeTruthy(); - }); - -
    - * - * @param {expression} ngDisabled If the {@link guide/expression expression} is truthy, - * then the `disabled` attribute will be set on the element - */ - - -/** - * @ngdoc directive - * @name ngChecked - * @restrict A - * @priority 100 - * - * @description - * Sets the `checked` attribute on the element, if the expression inside `ngChecked` is truthy. - * - * Note that this directive should not be used together with {@link ngModel `ngModel`}, - * as this can lead to unexpected behavior. - * - * A special directive is necessary because we cannot use interpolation inside the `checked` - * attribute. See the {@link guide/interpolation interpolation guide} for more info. - * - * @example - - -
    - -
    - - it('should check both checkBoxes', function() { - expect(element(by.id('checkFollower')).getAttribute('checked')).toBeFalsy(); - element(by.model('leader')).click(); - expect(element(by.id('checkFollower')).getAttribute('checked')).toBeTruthy(); - }); - -
    - * - * @element INPUT - * @param {expression} ngChecked If the {@link guide/expression expression} is truthy, - * then the `checked` attribute will be set on the element - */ - - -/** - * @ngdoc directive - * @name ngReadonly - * @restrict A - * @priority 100 - * - * @description - * - * Sets the `readonly` attribute on the element, if the expression inside `ngReadonly` is truthy. - * Note that `readonly` applies only to `input` elements with specific types. [See the input docs on - * MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-readonly) for more information. - * - * A special directive is necessary because we cannot use interpolation inside the `readonly` - * attribute. See the {@link guide/interpolation interpolation guide} for more info. - * - * @example - - -
    - -
    - - it('should toggle readonly attr', function() { - expect(element(by.css('[type="text"]')).getAttribute('readonly')).toBeFalsy(); - element(by.model('checked')).click(); - expect(element(by.css('[type="text"]')).getAttribute('readonly')).toBeTruthy(); - }); - -
    - * - * @element INPUT - * @param {expression} ngReadonly If the {@link guide/expression expression} is truthy, - * then special attribute "readonly" will be set on the element - */ - - -/** - * @ngdoc directive - * @name ngSelected - * @restrict A - * @priority 100 - * - * @description - * - * Sets the `selected` attribute on the element, if the expression inside `ngSelected` is truthy. - * - * A special directive is necessary because we cannot use interpolation inside the `selected` - * attribute. See the {@link guide/interpolation interpolation guide} for more info. - * - *
    - * **Note:** `ngSelected` does not interact with the `select` and `ngModel` directives, it only - * sets the `selected` attribute on the element. If you are using `ngModel` on the select, you - * should not use `ngSelected` on the options, as `ngModel` will set the select value and - * selected options. - *
    - * - * @example - - -
    - -
    - - it('should select Greetings!', function() { - expect(element(by.id('greet')).getAttribute('selected')).toBeFalsy(); - element(by.model('selected')).click(); - expect(element(by.id('greet')).getAttribute('selected')).toBeTruthy(); - }); - -
    - * - * @element OPTION - * @param {expression} ngSelected If the {@link guide/expression expression} is truthy, - * then special attribute "selected" will be set on the element - */ - -/** - * @ngdoc directive - * @name ngOpen - * @restrict A - * @priority 100 - * - * @description - * - * Sets the `open` attribute on the element, if the expression inside `ngOpen` is truthy. - * - * A special directive is necessary because we cannot use interpolation inside the `open` - * attribute. See the {@link guide/interpolation interpolation guide} for more info. - * - * ## A note about browser compatibility - * - * Internet Explorer and Edge do not support the `details` element, it is - * recommended to use {@link ng.ngShow} and {@link ng.ngHide} instead. - * - * @example - - -
    -
    - List -
      -
    • Apple
    • -
    • Orange
    • -
    • Durian
    • -
    -
    -
    - - it('should toggle open', function() { - expect(element(by.id('details')).getAttribute('open')).toBeFalsy(); - element(by.model('open')).click(); - expect(element(by.id('details')).getAttribute('open')).toBeTruthy(); - }); - -
    - * - * @element DETAILS - * @param {expression} ngOpen If the {@link guide/expression expression} is truthy, - * then special attribute "open" will be set on the element - */ - -var ngAttributeAliasDirectives = {}; - -// boolean attrs are evaluated -forEach(BOOLEAN_ATTR, function(propName, attrName) { - // binding to multiple is not supported - if (propName === 'multiple') return; - - function defaultLinkFn(scope, element, attr) { - scope.$watch(attr[normalized], function ngBooleanAttrWatchAction(value) { - attr.$set(attrName, !!value); - }); - } - - var normalized = directiveNormalize('ng-' + attrName); - var linkFn = defaultLinkFn; - - if (propName === 'checked') { - linkFn = function(scope, element, attr) { - // ensuring ngChecked doesn't interfere with ngModel when both are set on the same input - if (attr.ngModel !== attr[normalized]) { - defaultLinkFn(scope, element, attr); - } - }; - } - - ngAttributeAliasDirectives[normalized] = function() { - return { - restrict: 'A', - priority: 100, - link: linkFn - }; - }; -}); - -// aliased input attrs are evaluated -forEach(ALIASED_ATTR, function(htmlAttr, ngAttr) { - ngAttributeAliasDirectives[ngAttr] = function() { - return { - priority: 100, - link: function(scope, element, attr) { - //special case ngPattern when a literal regular expression value - //is used as the expression (this way we don't have to watch anything). - if (ngAttr === 'ngPattern' && attr.ngPattern.charAt(0) === '/') { - var match = attr.ngPattern.match(REGEX_STRING_REGEXP); - if (match) { - attr.$set('ngPattern', new RegExp(match[1], match[2])); - return; - } - } - - scope.$watch(attr[ngAttr], function ngAttrAliasWatchAction(value) { - attr.$set(ngAttr, value); - }); - } - }; - }; -}); - -// ng-src, ng-srcset, ng-href are interpolated -forEach(['src', 'srcset', 'href'], function(attrName) { - var normalized = directiveNormalize('ng-' + attrName); - ngAttributeAliasDirectives[normalized] = ['$sce', function($sce) { - return { - priority: 99, // it needs to run after the attributes are interpolated - link: function(scope, element, attr) { - var propName = attrName, - name = attrName; - - if (attrName === 'href' && - toString.call(element.prop('href')) === '[object SVGAnimatedString]') { - name = 'xlinkHref'; - attr.$attr[name] = 'xlink:href'; - propName = null; - } - - // We need to sanitize the url at least once, in case it is a constant - // non-interpolated attribute. - attr.$set(normalized, $sce.getTrustedMediaUrl(attr[normalized])); - - attr.$observe(normalized, function(value) { - if (!value) { - if (attrName === 'href') { - attr.$set(name, null); - } - return; - } - - attr.$set(name, value); - - // Support: IE 9-11 only - // On IE, if "ng:src" directive declaration is used and "src" attribute doesn't exist - // then calling element.setAttribute('src', 'foo') doesn't do anything, so we need - // to set the property as well to achieve the desired effect. - // We use attr[attrName] value since $set might have sanitized the url. - if (msie && propName) element.prop(propName, attr[name]); - }); - } - }; - }]; -}); - -/* global -nullFormCtrl, -PENDING_CLASS, -SUBMITTED_CLASS - */ -var nullFormCtrl = { - $addControl: noop, - $getControls: valueFn([]), - $$renameControl: nullFormRenameControl, - $removeControl: noop, - $setValidity: noop, - $setDirty: noop, - $setPristine: noop, - $setSubmitted: noop, - $$setSubmitted: noop -}, -PENDING_CLASS = 'ng-pending', -SUBMITTED_CLASS = 'ng-submitted'; - -function nullFormRenameControl(control, name) { - control.$name = name; -} - -/** - * @ngdoc type - * @name form.FormController - * - * @property {boolean} $pristine True if user has not interacted with the form yet. - * @property {boolean} $dirty True if user has already interacted with the form. - * @property {boolean} $valid True if all of the containing forms and controls are valid. - * @property {boolean} $invalid True if at least one containing control or form is invalid. - * @property {boolean} $submitted True if user has submitted the form even if its invalid. - * - * @property {Object} $pending An object hash, containing references to controls or forms with - * pending validators, where: - * - * - keys are validations tokens (error names). - * - values are arrays of controls or forms that have a pending validator for the given error name. - * - * See {@link form.FormController#$error $error} for a list of built-in validation tokens. - * - * @property {Object} $error An object hash, containing references to controls or forms with failing - * validators, where: - * - * - keys are validation tokens (error names), - * - values are arrays of controls or forms that have a failing validator for the given error name. - * - * Built-in validation tokens: - * - `email` - * - `max` - * - `maxlength` - * - `min` - * - `minlength` - * - `number` - * - `pattern` - * - `required` - * - `url` - * - `date` - * - `datetimelocal` - * - `time` - * - `week` - * - `month` - * - * @description - * `FormController` keeps track of all its controls and nested forms as well as the state of them, - * such as being valid/invalid or dirty/pristine. - * - * Each {@link ng.directive:form form} directive creates an instance - * of `FormController`. - * - */ -//asks for $scope to fool the BC controller module -FormController.$inject = ['$element', '$attrs', '$scope', '$animate', '$interpolate']; -function FormController($element, $attrs, $scope, $animate, $interpolate) { - this.$$controls = []; - - // init state - this.$error = {}; - this.$$success = {}; - this.$pending = undefined; - this.$name = $interpolate($attrs.name || $attrs.ngForm || '')($scope); - this.$dirty = false; - this.$pristine = true; - this.$valid = true; - this.$invalid = false; - this.$submitted = false; - this.$$parentForm = nullFormCtrl; - - this.$$element = $element; - this.$$animate = $animate; - - setupValidity(this); -} - -FormController.prototype = { - /** - * @ngdoc method - * @name form.FormController#$rollbackViewValue - * - * @description - * Rollback all form controls pending updates to the `$modelValue`. - * - * Updates may be pending by a debounced event or because the input is waiting for a some future - * event defined in `ng-model-options`. This method is typically needed by the reset button of - * a form that uses `ng-model-options` to pend updates. - */ - $rollbackViewValue: function() { - forEach(this.$$controls, function(control) { - control.$rollbackViewValue(); - }); - }, - - /** - * @ngdoc method - * @name form.FormController#$commitViewValue - * - * @description - * Commit all form controls pending updates to the `$modelValue`. - * - * Updates may be pending by a debounced event or because the input is waiting for a some future - * event defined in `ng-model-options`. This method is rarely needed as `NgModelController` - * usually handles calling this in response to input events. - */ - $commitViewValue: function() { - forEach(this.$$controls, function(control) { - control.$commitViewValue(); - }); - }, - - /** - * @ngdoc method - * @name form.FormController#$addControl - * @param {object} control control object, either a {@link form.FormController} or an - * {@link ngModel.NgModelController} - * - * @description - * Register a control with the form. Input elements using ngModelController do this automatically - * when they are linked. - * - * Note that the current state of the control will not be reflected on the new parent form. This - * is not an issue with normal use, as freshly compiled and linked controls are in a `$pristine` - * state. - * - * However, if the method is used programmatically, for example by adding dynamically created controls, - * or controls that have been previously removed without destroying their corresponding DOM element, - * it's the developers responsibility to make sure the current state propagates to the parent form. - * - * For example, if an input control is added that is already `$dirty` and has `$error` properties, - * calling `$setDirty()` and `$validate()` afterwards will propagate the state to the parent form. - */ - $addControl: function(control) { - // Breaking change - before, inputs whose name was "hasOwnProperty" were quietly ignored - // and not added to the scope. Now we throw an error. - assertNotHasOwnProperty(control.$name, 'input'); - this.$$controls.push(control); - - if (control.$name) { - this[control.$name] = control; - } - - control.$$parentForm = this; - }, - - /** - * @ngdoc method - * @name form.FormController#$getControls - * @returns {Array} the controls that are currently part of this form - * - * @description - * This method returns a **shallow copy** of the controls that are currently part of this form. - * The controls can be instances of {@link form.FormController `FormController`} - * ({@link ngForm "child-forms"}) and of {@link ngModel.NgModelController `NgModelController`}. - * If you need access to the controls of child-forms, you have to call `$getControls()` - * recursively on them. - * This can be used for example to iterate over all controls to validate them. - * - * The controls can be accessed normally, but adding to, or removing controls from the array has - * no effect on the form. Instead, use {@link form.FormController#$addControl `$addControl()`} and - * {@link form.FormController#$removeControl `$removeControl()`} for this use-case. - * Likewise, adding a control to, or removing a control from the form is not reflected - * in the shallow copy. That means you should get a fresh copy from `$getControls()` every time - * you need access to the controls. - */ - $getControls: function() { - return shallowCopy(this.$$controls); - }, - - // Private API: rename a form control - $$renameControl: function(control, newName) { - var oldName = control.$name; - - if (this[oldName] === control) { - delete this[oldName]; - } - this[newName] = control; - control.$name = newName; - }, - - /** - * @ngdoc method - * @name form.FormController#$removeControl - * @param {object} control control object, either a {@link form.FormController} or an - * {@link ngModel.NgModelController} - * - * @description - * Deregister a control from the form. - * - * Input elements using ngModelController do this automatically when they are destroyed. - * - * Note that only the removed control's validation state (`$errors`etc.) will be removed from the - * form. `$dirty`, `$submitted` states will not be changed, because the expected behavior can be - * different from case to case. For example, removing the only `$dirty` control from a form may or - * may not mean that the form is still `$dirty`. - */ - $removeControl: function(control) { - if (control.$name && this[control.$name] === control) { - delete this[control.$name]; - } - forEach(this.$pending, function(value, name) { - // eslint-disable-next-line no-invalid-this - this.$setValidity(name, null, control); - }, this); - forEach(this.$error, function(value, name) { - // eslint-disable-next-line no-invalid-this - this.$setValidity(name, null, control); - }, this); - forEach(this.$$success, function(value, name) { - // eslint-disable-next-line no-invalid-this - this.$setValidity(name, null, control); - }, this); - - arrayRemove(this.$$controls, control); - control.$$parentForm = nullFormCtrl; - }, - - /** - * @ngdoc method - * @name form.FormController#$setDirty - * - * @description - * Sets the form to a dirty state. - * - * This method can be called to add the 'ng-dirty' class and set the form to a dirty - * state (ng-dirty class). This method will also propagate to parent forms. - */ - $setDirty: function() { - this.$$animate.removeClass(this.$$element, PRISTINE_CLASS); - this.$$animate.addClass(this.$$element, DIRTY_CLASS); - this.$dirty = true; - this.$pristine = false; - this.$$parentForm.$setDirty(); - }, - - /** - * @ngdoc method - * @name form.FormController#$setPristine - * - * @description - * Sets the form to its pristine state. - * - * This method sets the form's `$pristine` state to true, the `$dirty` state to false, removes - * the `ng-dirty` class and adds the `ng-pristine` class. Additionally, it sets the `$submitted` - * state to false. - * - * This method will also propagate to all the controls contained in this form. - * - * Setting a form back to a pristine state is often useful when we want to 'reuse' a form after - * saving or resetting it. - */ - $setPristine: function() { - this.$$animate.setClass(this.$$element, PRISTINE_CLASS, DIRTY_CLASS + ' ' + SUBMITTED_CLASS); - this.$dirty = false; - this.$pristine = true; - this.$submitted = false; - forEach(this.$$controls, function(control) { - control.$setPristine(); - }); - }, - - /** - * @ngdoc method - * @name form.FormController#$setUntouched - * - * @description - * Sets the form to its untouched state. - * - * This method can be called to remove the 'ng-touched' class and set the form controls to their - * untouched state (ng-untouched class). - * - * Setting a form controls back to their untouched state is often useful when setting the form - * back to its pristine state. - */ - $setUntouched: function() { - forEach(this.$$controls, function(control) { - control.$setUntouched(); - }); - }, - - /** - * @ngdoc method - * @name form.FormController#$setSubmitted - * - * @description - * Sets the form to its `$submitted` state. This will also set `$submitted` on all child and - * parent forms of the form. - */ - $setSubmitted: function() { - var rootForm = this; - while (rootForm.$$parentForm && (rootForm.$$parentForm !== nullFormCtrl)) { - rootForm = rootForm.$$parentForm; - } - rootForm.$$setSubmitted(); - }, - - $$setSubmitted: function() { - this.$$animate.addClass(this.$$element, SUBMITTED_CLASS); - this.$submitted = true; - forEach(this.$$controls, function(control) { - if (control.$$setSubmitted) { - control.$$setSubmitted(); - } - }); - } -}; - -/** - * @ngdoc method - * @name form.FormController#$setValidity - * - * @description - * Change the validity state of the form, and notify the parent form (if any). - * - * Application developers will rarely need to call this method directly. It is used internally, by - * {@link ngModel.NgModelController#$setValidity NgModelController.$setValidity()}, to propagate a - * control's validity state to the parent `FormController`. - * - * @param {string} validationErrorKey Name of the validator. The `validationErrorKey` will be - * assigned to either `$error[validationErrorKey]` or `$pending[validationErrorKey]` (for - * unfulfilled `$asyncValidators`), so that it is available for data-binding. The - * `validationErrorKey` should be in camelCase and will get converted into dash-case for - * class name. Example: `myError` will result in `ng-valid-my-error` and - * `ng-invalid-my-error` classes and can be bound to as `{{ someForm.$error.myError }}`. - * @param {boolean} isValid Whether the current state is valid (true), invalid (false), pending - * (undefined), or skipped (null). Pending is used for unfulfilled `$asyncValidators`. - * Skipped is used by AngularJS when validators do not run because of parse errors and when - * `$asyncValidators` do not run because any of the `$validators` failed. - * @param {NgModelController | FormController} controller - The controller whose validity state is - * triggering the change. - */ -addSetValidityMethod({ - clazz: FormController, - set: function(object, property, controller) { - var list = object[property]; - if (!list) { - object[property] = [controller]; - } else { - var index = list.indexOf(controller); - if (index === -1) { - list.push(controller); - } - } - }, - unset: function(object, property, controller) { - var list = object[property]; - if (!list) { - return; - } - arrayRemove(list, controller); - if (list.length === 0) { - delete object[property]; - } - } -}); - -/** - * @ngdoc directive - * @name ngForm - * @restrict EAC - * - * @description - * Helper directive that makes it possible to create control groups inside a - * {@link ng.directive:form `form`} directive. - * These "child forms" can be used, for example, to determine the validity of a sub-group of - * controls. - * - *
    - * **Note**: `ngForm` cannot be used as a replacement for `
    `, because it lacks its - * [built-in HTML functionality](https://html.spec.whatwg.org/#the-form-element). - * Specifically, you cannot submit `ngForm` like a `` tag. That means, - * you cannot send data to the server with `ngForm`, or integrate it with - * {@link ng.directive:ngSubmit `ngSubmit`}. - *
    - * - * @param {string=} ngForm|name Name of the form. If specified, the form controller will - * be published into the related scope, under this name. - * - */ - - /** - * @ngdoc directive - * @name form - * @restrict E - * - * @description - * Directive that instantiates - * {@link form.FormController FormController}. - * - * If the `name` attribute is specified, the form controller is published onto the current scope under - * this name. - * - * ## Alias: {@link ng.directive:ngForm `ngForm`} - * - * In AngularJS, forms can be nested. This means that the outer form is valid when all of the child - * forms are valid as well. However, browsers do not allow nesting of `` elements, so - * AngularJS provides the {@link ng.directive:ngForm `ngForm`} directive, which behaves identically to - * `form` but can be nested. Nested forms can be useful, for example, if the validity of a sub-group - * of controls needs to be determined. - * - * ## CSS classes - * - `ng-valid` is set if the form is valid. - * - `ng-invalid` is set if the form is invalid. - * - `ng-pending` is set if the form is pending. - * - `ng-pristine` is set if the form is pristine. - * - `ng-dirty` is set if the form is dirty. - * - `ng-submitted` is set if the form was submitted. - * - * Keep in mind that ngAnimate can detect each of these classes when added and removed. - * - * - * ## Submitting a form and preventing the default action - * - * Since the role of forms in client-side AngularJS applications is different than in classical - * roundtrip apps, it is desirable for the browser not to translate the form submission into a full - * page reload that sends the data to the server. Instead some javascript logic should be triggered - * to handle the form submission in an application-specific way. - * - * For this reason, AngularJS prevents the default action (form submission to the server) unless the - * `` element has an `action` attribute specified. - * - * You can use one of the following two ways to specify what javascript method should be called when - * a form is submitted: - * - * - {@link ng.directive:ngSubmit ngSubmit} directive on the form element - * - {@link ng.directive:ngClick ngClick} directive on the first - * button or input field of type submit (input[type=submit]) - * - * To prevent double execution of the handler, use only one of the {@link ng.directive:ngSubmit ngSubmit} - * or {@link ng.directive:ngClick ngClick} directives. - * This is because of the following form submission rules in the HTML specification: - * - * - If a form has only one input field then hitting enter in this field triggers form submit - * (`ngSubmit`) - * - if a form has 2+ input fields and no buttons or input[type=submit] then hitting enter - * doesn't trigger submit - * - if a form has one or more input fields and one or more buttons or input[type=submit] then - * hitting enter in any of the input fields will trigger the click handler on the *first* button or - * input[type=submit] (`ngClick`) *and* a submit handler on the enclosing form (`ngSubmit`) - * - * Any pending `ngModelOptions` changes will take place immediately when an enclosing form is - * submitted. Note that `ngClick` events will occur before the model is updated. Use `ngSubmit` - * to have access to the updated model. - * - * @animations - * Animations in ngForm are triggered when any of the associated CSS classes are added and removed. - * These classes are: `.ng-pristine`, `.ng-dirty`, `.ng-invalid` and `.ng-valid` as well as any - * other validations that are performed within the form. Animations in ngForm are similar to how - * they work in ngClass and animations can be hooked into using CSS transitions, keyframes as well - * as JS animations. - * - * The following example shows a simple way to utilize CSS transitions to style a form element - * that has been rendered as invalid after it has been validated: - * - *
    - * //be sure to include ngAnimate as a module to hook into more
    - * //advanced animations
    - * .my-form {
    - *   transition:0.5s linear all;
    - *   background: white;
    - * }
    - * .my-form.ng-invalid {
    - *   background: red;
    - *   color:white;
    - * }
    - * 
    - * - * @example - - - - - - userType: - Required!
    - userType = {{userType}}
    - myForm.input.$valid = {{myForm.input.$valid}}
    - myForm.input.$error = {{myForm.input.$error}}
    - myForm.$valid = {{myForm.$valid}}
    - myForm.$error.required = {{!!myForm.$error.required}}
    - -
    - - it('should initialize to model', function() { - var userType = element(by.binding('userType')); - var valid = element(by.binding('myForm.input.$valid')); - - expect(userType.getText()).toContain('guest'); - expect(valid.getText()).toContain('true'); - }); - - it('should be invalid if empty', function() { - var userType = element(by.binding('userType')); - var valid = element(by.binding('myForm.input.$valid')); - var userInput = element(by.model('userType')); - - userInput.clear(); - userInput.sendKeys(''); - - expect(userType.getText()).toEqual('userType ='); - expect(valid.getText()).toContain('false'); - }); - -
    - * - * @param {string=} name Name of the form. If specified, the form controller will be published into - * related scope, under this name. - */ -var formDirectiveFactory = function(isNgForm) { - return ['$timeout', '$parse', function($timeout, $parse) { - var formDirective = { - name: 'form', - restrict: isNgForm ? 'EAC' : 'E', - require: ['form', '^^?form'], //first is the form's own ctrl, second is an optional parent form - controller: FormController, - compile: function ngFormCompile(formElement, attr) { - // Setup initial state of the control - formElement.addClass(PRISTINE_CLASS).addClass(VALID_CLASS); - - var nameAttr = attr.name ? 'name' : (isNgForm && attr.ngForm ? 'ngForm' : false); - - return { - pre: function ngFormPreLink(scope, formElement, attr, ctrls) { - var controller = ctrls[0]; - - // if `action` attr is not present on the form, prevent the default action (submission) - if (!('action' in attr)) { - // we can't use jq events because if a form is destroyed during submission the default - // action is not prevented. see #1238 - // - // IE 9 is not affected because it doesn't fire a submit event and try to do a full - // page reload if the form was destroyed by submission of the form via a click handler - // on a button in the form. Looks like an IE9 specific bug. - var handleFormSubmission = function(event) { - scope.$apply(function() { - controller.$commitViewValue(); - controller.$setSubmitted(); - }); - - event.preventDefault(); - }; - - formElement[0].addEventListener('submit', handleFormSubmission); - - // unregister the preventDefault listener so that we don't not leak memory but in a - // way that will achieve the prevention of the default action. - formElement.on('$destroy', function() { - $timeout(function() { - formElement[0].removeEventListener('submit', handleFormSubmission); - }, 0, false); - }); - } - - var parentFormCtrl = ctrls[1] || controller.$$parentForm; - parentFormCtrl.$addControl(controller); - - var setter = nameAttr ? getSetter(controller.$name) : noop; - - if (nameAttr) { - setter(scope, controller); - attr.$observe(nameAttr, function(newValue) { - if (controller.$name === newValue) return; - setter(scope, undefined); - controller.$$parentForm.$$renameControl(controller, newValue); - setter = getSetter(controller.$name); - setter(scope, controller); - }); - } - formElement.on('$destroy', function() { - controller.$$parentForm.$removeControl(controller); - setter(scope, undefined); - extend(controller, nullFormCtrl); //stop propagating child destruction handlers upwards - }); - } - }; - } - }; - - return formDirective; - - function getSetter(expression) { - if (expression === '') { - //create an assignable expression, so forms with an empty name can be renamed later - return $parse('this[""]').assign; - } - return $parse(expression).assign || noop; - } - }]; -}; - -var formDirective = formDirectiveFactory(); -var ngFormDirective = formDirectiveFactory(true); - - - -// helper methods -function setupValidity(instance) { - instance.$$classCache = {}; - instance.$$classCache[INVALID_CLASS] = !(instance.$$classCache[VALID_CLASS] = instance.$$element.hasClass(VALID_CLASS)); -} -function addSetValidityMethod(context) { - var clazz = context.clazz, - set = context.set, - unset = context.unset; - - clazz.prototype.$setValidity = function(validationErrorKey, state, controller) { - if (isUndefined(state)) { - createAndSet(this, '$pending', validationErrorKey, controller); - } else { - unsetAndCleanup(this, '$pending', validationErrorKey, controller); - } - if (!isBoolean(state)) { - unset(this.$error, validationErrorKey, controller); - unset(this.$$success, validationErrorKey, controller); - } else { - if (state) { - unset(this.$error, validationErrorKey, controller); - set(this.$$success, validationErrorKey, controller); - } else { - set(this.$error, validationErrorKey, controller); - unset(this.$$success, validationErrorKey, controller); - } - } - if (this.$pending) { - cachedToggleClass(this, PENDING_CLASS, true); - this.$valid = this.$invalid = undefined; - toggleValidationCss(this, '', null); - } else { - cachedToggleClass(this, PENDING_CLASS, false); - this.$valid = isObjectEmpty(this.$error); - this.$invalid = !this.$valid; - toggleValidationCss(this, '', this.$valid); - } - - // re-read the state as the set/unset methods could have - // combined state in this.$error[validationError] (used for forms), - // where setting/unsetting only increments/decrements the value, - // and does not replace it. - var combinedState; - if (this.$pending && this.$pending[validationErrorKey]) { - combinedState = undefined; - } else if (this.$error[validationErrorKey]) { - combinedState = false; - } else if (this.$$success[validationErrorKey]) { - combinedState = true; - } else { - combinedState = null; - } - - toggleValidationCss(this, validationErrorKey, combinedState); - this.$$parentForm.$setValidity(validationErrorKey, combinedState, this); - }; - - function createAndSet(ctrl, name, value, controller) { - if (!ctrl[name]) { - ctrl[name] = {}; - } - set(ctrl[name], value, controller); - } - - function unsetAndCleanup(ctrl, name, value, controller) { - if (ctrl[name]) { - unset(ctrl[name], value, controller); - } - if (isObjectEmpty(ctrl[name])) { - ctrl[name] = undefined; - } - } - - function cachedToggleClass(ctrl, className, switchValue) { - if (switchValue && !ctrl.$$classCache[className]) { - ctrl.$$animate.addClass(ctrl.$$element, className); - ctrl.$$classCache[className] = true; - } else if (!switchValue && ctrl.$$classCache[className]) { - ctrl.$$animate.removeClass(ctrl.$$element, className); - ctrl.$$classCache[className] = false; - } - } - - function toggleValidationCss(ctrl, validationErrorKey, isValid) { - validationErrorKey = validationErrorKey ? '-' + snake_case(validationErrorKey, '-') : ''; - - cachedToggleClass(ctrl, VALID_CLASS + validationErrorKey, isValid === true); - cachedToggleClass(ctrl, INVALID_CLASS + validationErrorKey, isValid === false); - } -} - -function isObjectEmpty(obj) { - if (obj) { - for (var prop in obj) { - if (obj.hasOwnProperty(prop)) { - return false; - } - } - } - return true; -} - -/* global - VALID_CLASS: false, - INVALID_CLASS: false, - PRISTINE_CLASS: false, - DIRTY_CLASS: false, - ngModelMinErr: false -*/ - -// Regex code was initially obtained from SO prior to modification: https://stackoverflow.com/questions/3143070/javascript-regex-iso-datetime#answer-3143231 -var ISO_DATE_REGEXP = /^\d{4,}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+(?:[+-][0-2]\d:[0-5]\d|Z)$/; -// See valid URLs in RFC3987 (http://tools.ietf.org/html/rfc3987) -// Note: We are being more lenient, because browsers are too. -// 1. Scheme -// 2. Slashes -// 3. Username -// 4. Password -// 5. Hostname -// 6. Port -// 7. Path -// 8. Query -// 9. Fragment -// 1111111111111111 222 333333 44444 55555555555555555555555 666 77777777 8888888 999 -var URL_REGEXP = /^[a-z][a-z\d.+-]*:\/*(?:[^:@]+(?::[^@]+)?@)?(?:[^\s:/?#]+|\[[a-f\d:]+])(?::\d+)?(?:\/[^?#]*)?(?:\?[^#]*)?(?:#.*)?$/i; -// eslint-disable-next-line max-len -var EMAIL_REGEXP = /^(?=.{1,254}$)(?=.{1,64}@)[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+(\.[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+)*@[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?(\.[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?)*$/; -var NUMBER_REGEXP = /^\s*(-|\+)?(\d+|(\d*(\.\d*)))([eE][+-]?\d+)?\s*$/; -var DATE_REGEXP = /^(\d{4,})-(\d{2})-(\d{2})$/; -var DATETIMELOCAL_REGEXP = /^(\d{4,})-(\d\d)-(\d\d)T(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/; -var WEEK_REGEXP = /^(\d{4,})-W(\d\d)$/; -var MONTH_REGEXP = /^(\d{4,})-(\d\d)$/; -var TIME_REGEXP = /^(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/; - -var PARTIAL_VALIDATION_EVENTS = 'keydown wheel mousedown'; -var PARTIAL_VALIDATION_TYPES = createMap(); -forEach('date,datetime-local,month,time,week'.split(','), function(type) { - PARTIAL_VALIDATION_TYPES[type] = true; -}); - -var inputType = { - - /** - * @ngdoc input - * @name input[text] - * - * @description - * Standard HTML text input with AngularJS data binding, inherited by most of the `input` elements. - * - * - * @param {string} ngModel Assignable AngularJS expression to data-bind to. - * @param {string=} name Property name of the form under which the control is published. - * @param {string=} required Adds `required` validation error key if the value is not entered. - * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to - * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of - * `required` when you want to data-bind to the `required` attribute. - * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than - * minlength. - * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than - * maxlength. Setting the attribute to a negative or non-numeric value, allows view values of - * any length. - * @param {string=} pattern Similar to `ngPattern` except that the attribute value is the actual string - * that contains the regular expression body that will be converted to a regular expression - * as in the ngPattern directive. - * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel {@link ngModel.NgModelController#$viewValue $viewValue} - * does not match a RegExp found by evaluating the AngularJS expression given in the attribute value. - * If the expression evaluates to a RegExp object, then this is used directly. - * If the expression evaluates to a string, then it will be converted to a RegExp - * after wrapping it in `^` and `$` characters. For instance, `"abc"` will be converted to - * `new RegExp('^abc$')`.
    - * **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to - * start at the index of the last search's match, thus not taking the whole input value into - * account. - * @param {string=} ngChange AngularJS expression to be executed when input changes due to user - * interaction with the input element. - * @param {boolean=} [ngTrim=true] If set to false AngularJS will not automatically trim the input. - * This parameter is ignored for input[type=password] controls, which will never trim the - * input. - * - * @example - - - -
    - -
    - - Required! - - Single word only! -
    - text = {{example.text}}
    - myForm.input.$valid = {{myForm.input.$valid}}
    - myForm.input.$error = {{myForm.input.$error}}
    - myForm.$valid = {{myForm.$valid}}
    - myForm.$error.required = {{!!myForm.$error.required}}
    -
    -
    - - var text = element(by.binding('example.text')); - var valid = element(by.binding('myForm.input.$valid')); - var input = element(by.model('example.text')); - - it('should initialize to model', function() { - expect(text.getText()).toContain('guest'); - expect(valid.getText()).toContain('true'); - }); - - it('should be invalid if empty', function() { - input.clear(); - input.sendKeys(''); - - expect(text.getText()).toEqual('text ='); - expect(valid.getText()).toContain('false'); - }); - - it('should be invalid if multi word', function() { - input.clear(); - input.sendKeys('hello world'); - - expect(valid.getText()).toContain('false'); - }); - -
    - */ - 'text': textInputType, - - /** - * @ngdoc input - * @name input[date] - * - * @description - * Input with date validation and transformation. In browsers that do not yet support - * the HTML5 date input, a text element will be used. In that case, text must be entered in a valid ISO-8601 - * date format (yyyy-MM-dd), for example: `2009-01-06`. Since many - * modern browsers do not yet support this input type, it is important to provide cues to users on the - * expected input format via a placeholder or label. - * - * The model must always be a Date object, otherwise AngularJS will throw an error. - * Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string. - * - * The timezone to be used to read/write the `Date` instance in the model can be defined using - * {@link ng.directive:ngModelOptions ngModelOptions}. By default, this is the timezone of the browser. - * - * @param {string} ngModel Assignable AngularJS expression to data-bind to. - * @param {string=} name Property name of the form under which the control is published. - * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`. This must be a - * valid ISO date string (yyyy-MM-dd). You can also use interpolation inside this attribute - * (e.g. `min="{{minDate | date:'yyyy-MM-dd'}}"`). Note that `min` will also add native HTML5 - * constraint validation. - * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`. This must be - * a valid ISO date string (yyyy-MM-dd). You can also use interpolation inside this attribute - * (e.g. `max="{{maxDate | date:'yyyy-MM-dd'}}"`). Note that `max` will also add native HTML5 - * constraint validation. - * @param {(date|string)=} ngMin Sets the `min` validation constraint to the Date / ISO date string - * the `ngMin` expression evaluates to. Note that it does not set the `min` attribute. - * @param {(date|string)=} ngMax Sets the `max` validation constraint to the Date / ISO date string - * the `ngMax` expression evaluates to. Note that it does not set the `max` attribute. - * @param {string=} required Sets `required` validation error key if the value is not entered. - * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to - * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of - * `required` when you want to data-bind to the `required` attribute. - * @param {string=} ngChange AngularJS expression to be executed when input changes due to user - * interaction with the input element. - * - * @example - - - -
    - - -
    - - Required! - - Not a valid date! -
    - value = {{example.value | date: "yyyy-MM-dd"}}
    - myForm.input.$valid = {{myForm.input.$valid}}
    - myForm.input.$error = {{myForm.input.$error}}
    - myForm.$valid = {{myForm.$valid}}
    - myForm.$error.required = {{!!myForm.$error.required}}
    -
    -
    - - var value = element(by.binding('example.value | date: "yyyy-MM-dd"')); - var valid = element(by.binding('myForm.input.$valid')); - - // currently protractor/webdriver does not support - // sending keys to all known HTML5 input controls - // for various browsers (see https://github.com/angular/protractor/issues/562). - function setInput(val) { - // set the value of the element and force validation. - var scr = "var ipt = document.getElementById('exampleInput'); " + - "ipt.value = '" + val + "';" + - "angular.element(ipt).scope().$apply(function(s) { s.myForm[ipt.name].$setViewValue('" + val + "'); });"; - browser.executeScript(scr); - } - - it('should initialize to model', function() { - expect(value.getText()).toContain('2013-10-22'); - expect(valid.getText()).toContain('myForm.input.$valid = true'); - }); - - it('should be invalid if empty', function() { - setInput(''); - expect(value.getText()).toEqual('value ='); - expect(valid.getText()).toContain('myForm.input.$valid = false'); - }); - - it('should be invalid if over max', function() { - setInput('2015-01-01'); - expect(value.getText()).toContain(''); - expect(valid.getText()).toContain('myForm.input.$valid = false'); - }); - -
    - */ - 'date': createDateInputType('date', DATE_REGEXP, - createDateParser(DATE_REGEXP, ['yyyy', 'MM', 'dd']), - 'yyyy-MM-dd'), - - /** - * @ngdoc input - * @name input[datetime-local] - * - * @description - * Input with datetime validation and transformation. In browsers that do not yet support - * the HTML5 date input, a text element will be used. In that case, the text must be entered in a valid ISO-8601 - * local datetime format (yyyy-MM-ddTHH:mm:ss), for example: `2010-12-28T14:57:00`. - * - * The model must always be a Date object, otherwise AngularJS will throw an error. - * Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string. - * - * The timezone to be used to read/write the `Date` instance in the model can be defined using - * {@link ng.directive:ngModelOptions ngModelOptions}. By default, this is the timezone of the browser. - * - * The format of the displayed time can be adjusted with the - * {@link ng.directive:ngModelOptions#ngModelOptions-arguments ngModelOptions} `timeSecondsFormat` - * and `timeStripZeroSeconds`. - * - * @param {string} ngModel Assignable AngularJS expression to data-bind to. - * @param {string=} name Property name of the form under which the control is published. - * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`. - * This must be a valid ISO datetime format (yyyy-MM-ddTHH:mm:ss). You can also use interpolation - * inside this attribute (e.g. `min="{{minDatetimeLocal | date:'yyyy-MM-ddTHH:mm:ss'}}"`). - * Note that `min` will also add native HTML5 constraint validation. - * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`. - * This must be a valid ISO datetime format (yyyy-MM-ddTHH:mm:ss). You can also use interpolation - * inside this attribute (e.g. `max="{{maxDatetimeLocal | date:'yyyy-MM-ddTHH:mm:ss'}}"`). - * Note that `max` will also add native HTML5 constraint validation. - * @param {(date|string)=} ngMin Sets the `min` validation error key to the Date / ISO datetime string - * the `ngMin` expression evaluates to. Note that it does not set the `min` attribute. - * @param {(date|string)=} ngMax Sets the `max` validation error key to the Date / ISO datetime string - * the `ngMax` expression evaluates to. Note that it does not set the `max` attribute. - * @param {string=} required Sets `required` validation error key if the value is not entered. - * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to - * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of - * `required` when you want to data-bind to the `required` attribute. - * @param {string=} ngChange AngularJS expression to be executed when input changes due to user - * interaction with the input element. - * - * @example - - - -
    - - -
    - - Required! - - Not a valid date! -
    - value = {{example.value | date: "yyyy-MM-ddTHH:mm:ss"}}
    - myForm.input.$valid = {{myForm.input.$valid}}
    - myForm.input.$error = {{myForm.input.$error}}
    - myForm.$valid = {{myForm.$valid}}
    - myForm.$error.required = {{!!myForm.$error.required}}
    -
    -
    - - var value = element(by.binding('example.value | date: "yyyy-MM-ddTHH:mm:ss"')); - var valid = element(by.binding('myForm.input.$valid')); - - // currently protractor/webdriver does not support - // sending keys to all known HTML5 input controls - // for various browsers (https://github.com/angular/protractor/issues/562). - function setInput(val) { - // set the value of the element and force validation. - var scr = "var ipt = document.getElementById('exampleInput'); " + - "ipt.value = '" + val + "';" + - "angular.element(ipt).scope().$apply(function(s) { s.myForm[ipt.name].$setViewValue('" + val + "'); });"; - browser.executeScript(scr); - } - - it('should initialize to model', function() { - expect(value.getText()).toContain('2010-12-28T14:57:00'); - expect(valid.getText()).toContain('myForm.input.$valid = true'); - }); - - it('should be invalid if empty', function() { - setInput(''); - expect(value.getText()).toEqual('value ='); - expect(valid.getText()).toContain('myForm.input.$valid = false'); - }); - - it('should be invalid if over max', function() { - setInput('2015-01-01T23:59:00'); - expect(value.getText()).toContain(''); - expect(valid.getText()).toContain('myForm.input.$valid = false'); - }); - -
    - */ - 'datetime-local': createDateInputType('datetimelocal', DATETIMELOCAL_REGEXP, - createDateParser(DATETIMELOCAL_REGEXP, ['yyyy', 'MM', 'dd', 'HH', 'mm', 'ss', 'sss']), - 'yyyy-MM-ddTHH:mm:ss.sss'), - - /** - * @ngdoc input - * @name input[time] - * - * @description - * Input with time validation and transformation. In browsers that do not yet support - * the HTML5 time input, a text element will be used. In that case, the text must be entered in a valid ISO-8601 - * local time format (HH:mm:ss), for example: `14:57:00`. Model must be a Date object. This binding will always output a - * Date object to the model of January 1, 1970, or local date `new Date(1970, 0, 1, HH, mm, ss)`. - * - * The model must always be a Date object, otherwise AngularJS will throw an error. - * Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string. - * - * The timezone to be used to read/write the `Date` instance in the model can be defined using - * {@link ng.directive:ngModelOptions#ngModelOptions-arguments ngModelOptions}. By default, - * this is the timezone of the browser. - * - * The format of the displayed time can be adjusted with the - * {@link ng.directive:ngModelOptions#ngModelOptions-arguments ngModelOptions} `timeSecondsFormat` - * and `timeStripZeroSeconds`. - * - * @param {string} ngModel Assignable AngularJS expression to data-bind to. - * @param {string=} name Property name of the form under which the control is published. - * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`. - * This must be a valid ISO time format (HH:mm:ss). You can also use interpolation inside this - * attribute (e.g. `min="{{minTime | date:'HH:mm:ss'}}"`). Note that `min` will also add - * native HTML5 constraint validation. - * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`. - * This must be a valid ISO time format (HH:mm:ss). You can also use interpolation inside this - * attribute (e.g. `max="{{maxTime | date:'HH:mm:ss'}}"`). Note that `max` will also add - * native HTML5 constraint validation. - * @param {(date|string)=} ngMin Sets the `min` validation constraint to the Date / ISO time string the - * `ngMin` expression evaluates to. Note that it does not set the `min` attribute. - * @param {(date|string)=} ngMax Sets the `max` validation constraint to the Date / ISO time string the - * `ngMax` expression evaluates to. Note that it does not set the `max` attribute. - * @param {string=} required Sets `required` validation error key if the value is not entered. - * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to - * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of - * `required` when you want to data-bind to the `required` attribute. - * @param {string=} ngChange AngularJS expression to be executed when input changes due to user - * interaction with the input element. - * - * @example - - - -
    - - -
    - - Required! - - Not a valid date! -
    - value = {{example.value | date: "HH:mm:ss"}}
    - myForm.input.$valid = {{myForm.input.$valid}}
    - myForm.input.$error = {{myForm.input.$error}}
    - myForm.$valid = {{myForm.$valid}}
    - myForm.$error.required = {{!!myForm.$error.required}}
    -
    -
    - - var value = element(by.binding('example.value | date: "HH:mm:ss"')); - var valid = element(by.binding('myForm.input.$valid')); - - // currently protractor/webdriver does not support - // sending keys to all known HTML5 input controls - // for various browsers (https://github.com/angular/protractor/issues/562). - function setInput(val) { - // set the value of the element and force validation. - var scr = "var ipt = document.getElementById('exampleInput'); " + - "ipt.value = '" + val + "';" + - "angular.element(ipt).scope().$apply(function(s) { s.myForm[ipt.name].$setViewValue('" + val + "'); });"; - browser.executeScript(scr); - } - - it('should initialize to model', function() { - expect(value.getText()).toContain('14:57:00'); - expect(valid.getText()).toContain('myForm.input.$valid = true'); - }); - - it('should be invalid if empty', function() { - setInput(''); - expect(value.getText()).toEqual('value ='); - expect(valid.getText()).toContain('myForm.input.$valid = false'); - }); - - it('should be invalid if over max', function() { - setInput('23:59:00'); - expect(value.getText()).toContain(''); - expect(valid.getText()).toContain('myForm.input.$valid = false'); - }); - -
    - */ - 'time': createDateInputType('time', TIME_REGEXP, - createDateParser(TIME_REGEXP, ['HH', 'mm', 'ss', 'sss']), - 'HH:mm:ss.sss'), - - /** - * @ngdoc input - * @name input[week] - * - * @description - * Input with week-of-the-year validation and transformation to Date. In browsers that do not yet support - * the HTML5 week input, a text element will be used. In that case, the text must be entered in a valid ISO-8601 - * week format (yyyy-W##), for example: `2013-W02`. - * - * The model must always be a Date object, otherwise AngularJS will throw an error. - * Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string. - * - * The value of the resulting Date object will be set to Thursday at 00:00:00 of the requested week, - * due to ISO-8601 week numbering standards. Information on ISO's system for numbering the weeks of the - * year can be found at: https://en.wikipedia.org/wiki/ISO_8601#Week_dates - * - * The timezone to be used to read/write the `Date` instance in the model can be defined using - * {@link ng.directive:ngModelOptions ngModelOptions}. By default, this is the timezone of the browser. - * - * @param {string} ngModel Assignable AngularJS expression to data-bind to. - * @param {string=} name Property name of the form under which the control is published. - * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`. - * This must be a valid ISO week format (yyyy-W##). You can also use interpolation inside this - * attribute (e.g. `min="{{minWeek | date:'yyyy-Www'}}"`). Note that `min` will also add - * native HTML5 constraint validation. - * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`. - * This must be a valid ISO week format (yyyy-W##). You can also use interpolation inside this - * attribute (e.g. `max="{{maxWeek | date:'yyyy-Www'}}"`). Note that `max` will also add - * native HTML5 constraint validation. - * @param {(date|string)=} ngMin Sets the `min` validation constraint to the Date / ISO week string - * the `ngMin` expression evaluates to. Note that it does not set the `min` attribute. - * @param {(date|string)=} ngMax Sets the `max` validation constraint to the Date / ISO week string - * the `ngMax` expression evaluates to. Note that it does not set the `max` attribute. - * @param {string=} required Sets `required` validation error key if the value is not entered. - * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to - * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of - * `required` when you want to data-bind to the `required` attribute. - * @param {string=} ngChange AngularJS expression to be executed when input changes due to user - * interaction with the input element. - * - * @example - - - -
    - -
    - - Required! - - Not a valid date! -
    - value = {{example.value | date: "yyyy-Www"}}
    - myForm.input.$valid = {{myForm.input.$valid}}
    - myForm.input.$error = {{myForm.input.$error}}
    - myForm.$valid = {{myForm.$valid}}
    - myForm.$error.required = {{!!myForm.$error.required}}
    -
    -
    - - var value = element(by.binding('example.value | date: "yyyy-Www"')); - var valid = element(by.binding('myForm.input.$valid')); - - // currently protractor/webdriver does not support - // sending keys to all known HTML5 input controls - // for various browsers (https://github.com/angular/protractor/issues/562). - function setInput(val) { - // set the value of the element and force validation. - var scr = "var ipt = document.getElementById('exampleInput'); " + - "ipt.value = '" + val + "';" + - "angular.element(ipt).scope().$apply(function(s) { s.myForm[ipt.name].$setViewValue('" + val + "'); });"; - browser.executeScript(scr); - } - - it('should initialize to model', function() { - expect(value.getText()).toContain('2013-W01'); - expect(valid.getText()).toContain('myForm.input.$valid = true'); - }); - - it('should be invalid if empty', function() { - setInput(''); - expect(value.getText()).toEqual('value ='); - expect(valid.getText()).toContain('myForm.input.$valid = false'); - }); - - it('should be invalid if over max', function() { - setInput('2015-W01'); - expect(value.getText()).toContain(''); - expect(valid.getText()).toContain('myForm.input.$valid = false'); - }); - -
    - */ - 'week': createDateInputType('week', WEEK_REGEXP, weekParser, 'yyyy-Www'), - - /** - * @ngdoc input - * @name input[month] - * - * @description - * Input with month validation and transformation. In browsers that do not yet support - * the HTML5 month input, a text element will be used. In that case, the text must be entered in a valid ISO-8601 - * month format (yyyy-MM), for example: `2009-01`. - * - * The model must always be a Date object, otherwise AngularJS will throw an error. - * Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string. - * If the model is not set to the first of the month, the next view to model update will set it - * to the first of the month. - * - * The timezone to be used to read/write the `Date` instance in the model can be defined using - * {@link ng.directive:ngModelOptions ngModelOptions}. By default, this is the timezone of the browser. - * - * @param {string} ngModel Assignable AngularJS expression to data-bind to. - * @param {string=} name Property name of the form under which the control is published. - * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`. - * This must be a valid ISO month format (yyyy-MM). You can also use interpolation inside this - * attribute (e.g. `min="{{minMonth | date:'yyyy-MM'}}"`). Note that `min` will also add - * native HTML5 constraint validation. - * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`. - * This must be a valid ISO month format (yyyy-MM). You can also use interpolation inside this - * attribute (e.g. `max="{{maxMonth | date:'yyyy-MM'}}"`). Note that `max` will also add - * native HTML5 constraint validation. - * @param {(date|string)=} ngMin Sets the `min` validation constraint to the Date / ISO week string - * the `ngMin` expression evaluates to. Note that it does not set the `min` attribute. - * @param {(date|string)=} ngMax Sets the `max` validation constraint to the Date / ISO week string - * the `ngMax` expression evaluates to. Note that it does not set the `max` attribute. - - * @param {string=} required Sets `required` validation error key if the value is not entered. - * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to - * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of - * `required` when you want to data-bind to the `required` attribute. - * @param {string=} ngChange AngularJS expression to be executed when input changes due to user - * interaction with the input element. - * - * @example - - - -
    - - -
    - - Required! - - Not a valid month! -
    - value = {{example.value | date: "yyyy-MM"}}
    - myForm.input.$valid = {{myForm.input.$valid}}
    - myForm.input.$error = {{myForm.input.$error}}
    - myForm.$valid = {{myForm.$valid}}
    - myForm.$error.required = {{!!myForm.$error.required}}
    -
    -
    - - var value = element(by.binding('example.value | date: "yyyy-MM"')); - var valid = element(by.binding('myForm.input.$valid')); - - // currently protractor/webdriver does not support - // sending keys to all known HTML5 input controls - // for various browsers (https://github.com/angular/protractor/issues/562). - function setInput(val) { - // set the value of the element and force validation. - var scr = "var ipt = document.getElementById('exampleInput'); " + - "ipt.value = '" + val + "';" + - "angular.element(ipt).scope().$apply(function(s) { s.myForm[ipt.name].$setViewValue('" + val + "'); });"; - browser.executeScript(scr); - } - - it('should initialize to model', function() { - expect(value.getText()).toContain('2013-10'); - expect(valid.getText()).toContain('myForm.input.$valid = true'); - }); - - it('should be invalid if empty', function() { - setInput(''); - expect(value.getText()).toEqual('value ='); - expect(valid.getText()).toContain('myForm.input.$valid = false'); - }); - - it('should be invalid if over max', function() { - setInput('2015-01'); - expect(value.getText()).toContain(''); - expect(valid.getText()).toContain('myForm.input.$valid = false'); - }); - -
    - */ - 'month': createDateInputType('month', MONTH_REGEXP, - createDateParser(MONTH_REGEXP, ['yyyy', 'MM']), - 'yyyy-MM'), - - /** - * @ngdoc input - * @name input[number] - * - * @description - * Text input with number validation and transformation. Sets the `number` validation - * error if not a valid number. - * - *
    - * The model must always be of type `number` otherwise AngularJS will throw an error. - * Be aware that a string containing a number is not enough. See the {@link ngModel:numfmt} - * error docs for more information and an example of how to convert your model if necessary. - *
    - * - * - * - * @knownIssue - * - * ### HTML5 constraint validation and `allowInvalid` - * - * In browsers that follow the - * [HTML5 specification](https://html.spec.whatwg.org/multipage/forms.html#number-state-%28type=number%29), - * `input[number]` does not work as expected with {@link ngModelOptions `ngModelOptions.allowInvalid`}. - * If a non-number is entered in the input, the browser will report the value as an empty string, - * which means the view / model values in `ngModel` and subsequently the scope value - * will also be an empty string. - * - * @knownIssue - * - * ### Large numbers and `step` validation - * - * The `step` validation will not work correctly for very large numbers (e.g. 9999999999) due to - * Javascript's arithmetic limitations. If you need to handle large numbers, purpose-built - * libraries (e.g. https://github.com/MikeMcl/big.js/), can be included into AngularJS by - * {@link guide/forms#modifying-built-in-validators overwriting the validators} - * for `number` and / or `step`, or by {@link guide/forms#custom-validation applying custom validators} - * to an `input[text]` element. The source for `input[number]` type can be used as a starting - * point for both implementations. - * - * @param {string} ngModel Assignable AngularJS expression to data-bind to. - * @param {string=} name Property name of the form under which the control is published. - * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`. - * Can be interpolated. - * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`. - * Can be interpolated. - * @param {string=} ngMin Like `min`, sets the `min` validation error key if the value entered is less than `ngMin`, - * but does not trigger HTML5 native validation. Takes an expression. - * @param {string=} ngMax Like `max`, sets the `max` validation error key if the value entered is greater than `ngMax`, - * but does not trigger HTML5 native validation. Takes an expression. - * @param {string=} step Sets the `step` validation error key if the value entered does not fit the `step` constraint. - * Can be interpolated. - * @param {string=} ngStep Like `step`, sets the `step` validation error key if the value entered does not fit the `ngStep` constraint, - * but does not trigger HTML5 native validation. Takes an expression. - * @param {string=} required Sets `required` validation error key if the value is not entered. - * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to - * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of - * `required` when you want to data-bind to the `required` attribute. - * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than - * minlength. - * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than - * maxlength. Setting the attribute to a negative or non-numeric value, allows view values of - * any length. - * @param {string=} pattern Similar to `ngPattern` except that the attribute value is the actual string - * that contains the regular expression body that will be converted to a regular expression - * as in the ngPattern directive. - * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel {@link ngModel.NgModelController#$viewValue $viewValue} - * does not match a RegExp found by evaluating the AngularJS expression given in the attribute value. - * If the expression evaluates to a RegExp object, then this is used directly. - * If the expression evaluates to a string, then it will be converted to a RegExp - * after wrapping it in `^` and `$` characters. For instance, `"abc"` will be converted to - * `new RegExp('^abc$')`.
    - * **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to - * start at the index of the last search's match, thus not taking the whole input value into - * account. - * @param {string=} ngChange AngularJS expression to be executed when input changes due to user - * interaction with the input element. - * - * @example - - - -
    - -
    - - Required! - - Not valid number! -
    - value = {{example.value}}
    - myForm.input.$valid = {{myForm.input.$valid}}
    - myForm.input.$error = {{myForm.input.$error}}
    - myForm.$valid = {{myForm.$valid}}
    - myForm.$error.required = {{!!myForm.$error.required}}
    -
    -
    - - var value = element(by.binding('example.value')); - var valid = element(by.binding('myForm.input.$valid')); - var input = element(by.model('example.value')); - - it('should initialize to model', function() { - expect(value.getText()).toContain('12'); - expect(valid.getText()).toContain('true'); - }); - - it('should be invalid if empty', function() { - input.clear(); - input.sendKeys(''); - expect(value.getText()).toEqual('value ='); - expect(valid.getText()).toContain('false'); - }); - - it('should be invalid if over max', function() { - input.clear(); - input.sendKeys('123'); - expect(value.getText()).toEqual('value ='); - expect(valid.getText()).toContain('false'); - }); - -
    - */ - 'number': numberInputType, - - - /** - * @ngdoc input - * @name input[url] - * - * @description - * Text input with URL validation. Sets the `url` validation error key if the content is not a - * valid URL. - * - *
    - * **Note:** `input[url]` uses a regex to validate urls that is derived from the regex - * used in Chromium. If you need stricter validation, you can use `ng-pattern` or modify - * the built-in validators (see the {@link guide/forms Forms guide}) - *
    - * - * @param {string} ngModel Assignable AngularJS expression to data-bind to. - * @param {string=} name Property name of the form under which the control is published. - * @param {string=} required Sets `required` validation error key if the value is not entered. - * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to - * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of - * `required` when you want to data-bind to the `required` attribute. - * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than - * minlength. - * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than - * maxlength. Setting the attribute to a negative or non-numeric value, allows view values of - * any length. - * @param {string=} pattern Similar to `ngPattern` except that the attribute value is the actual string - * that contains the regular expression body that will be converted to a regular expression - * as in the ngPattern directive. - * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel {@link ngModel.NgModelController#$viewValue $viewValue} - * does not match a RegExp found by evaluating the AngularJS expression given in the attribute value. - * If the expression evaluates to a RegExp object, then this is used directly. - * If the expression evaluates to a string, then it will be converted to a RegExp - * after wrapping it in `^` and `$` characters. For instance, `"abc"` will be converted to - * `new RegExp('^abc$')`.
    - * **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to - * start at the index of the last search's match, thus not taking the whole input value into - * account. - * @param {string=} ngChange AngularJS expression to be executed when input changes due to user - * interaction with the input element. - * - * @example - - - -
    -
    - - var text = element(by.binding('url.text')); - var valid = element(by.binding('myForm.input.$valid')); - var input = element(by.model('url.text')); - - it('should initialize to model', function() { - expect(text.getText()).toContain('http://google.com'); - expect(valid.getText()).toContain('true'); - }); - - it('should be invalid if empty', function() { - input.clear(); - input.sendKeys(''); - - expect(text.getText()).toEqual('text ='); - expect(valid.getText()).toContain('false'); - }); - - it('should be invalid if not url', function() { - input.clear(); - input.sendKeys('box'); - - expect(valid.getText()).toContain('false'); - }); - -
    - */ - 'url': urlInputType, - - - /** - * @ngdoc input - * @name input[email] - * - * @description - * Text input with email validation. Sets the `email` validation error key if not a valid email - * address. - * - *
    - * **Note:** `input[email]` uses a regex to validate email addresses that is derived from the regex - * used in Chromium, which may not fulfill your app's requirements. - * If you need stricter (e.g. requiring a top-level domain), or more relaxed validation - * (e.g. allowing IPv6 address literals) you can use `ng-pattern` or - * modify the built-in validators (see the {@link guide/forms Forms guide}). - *
    - * - * @param {string} ngModel Assignable AngularJS expression to data-bind to. - * @param {string=} name Property name of the form under which the control is published. - * @param {string=} required Sets `required` validation error key if the value is not entered. - * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to - * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of - * `required` when you want to data-bind to the `required` attribute. - * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than - * minlength. - * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than - * maxlength. Setting the attribute to a negative or non-numeric value, allows view values of - * any length. - * @param {string=} pattern Similar to `ngPattern` except that the attribute value is the actual string - * that contains the regular expression body that will be converted to a regular expression - * as in the ngPattern directive. - * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel {@link ngModel.NgModelController#$viewValue $viewValue} - * does not match a RegExp found by evaluating the AngularJS expression given in the attribute value. - * If the expression evaluates to a RegExp object, then this is used directly. - * If the expression evaluates to a string, then it will be converted to a RegExp - * after wrapping it in `^` and `$` characters. For instance, `"abc"` will be converted to - * `new RegExp('^abc$')`.
    - * **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to - * start at the index of the last search's match, thus not taking the whole input value into - * account. - * @param {string=} ngChange AngularJS expression to be executed when input changes due to user - * interaction with the input element. - * - * @example - - - -
    - -
    - - Required! - - Not valid email! -
    - text = {{email.text}}
    - myForm.input.$valid = {{myForm.input.$valid}}
    - myForm.input.$error = {{myForm.input.$error}}
    - myForm.$valid = {{myForm.$valid}}
    - myForm.$error.required = {{!!myForm.$error.required}}
    - myForm.$error.email = {{!!myForm.$error.email}}
    -
    -
    - - var text = element(by.binding('email.text')); - var valid = element(by.binding('myForm.input.$valid')); - var input = element(by.model('email.text')); - - it('should initialize to model', function() { - expect(text.getText()).toContain('me@example.com'); - expect(valid.getText()).toContain('true'); - }); - - it('should be invalid if empty', function() { - input.clear(); - input.sendKeys(''); - expect(text.getText()).toEqual('text ='); - expect(valid.getText()).toContain('false'); - }); - - it('should be invalid if not email', function() { - input.clear(); - input.sendKeys('xxx'); - - expect(valid.getText()).toContain('false'); - }); - -
    - */ - 'email': emailInputType, - - - /** - * @ngdoc input - * @name input[radio] - * - * @description - * HTML radio button. - * - * **Note:**
    - * All inputs controlled by {@link ngModel ngModel} (including those of type `radio`) will use the - * value of their `name` attribute to determine the property under which their - * {@link ngModel.NgModelController NgModelController} will be published on the parent - * {@link form.FormController FormController}. Thus, if you use the same `name` for multiple - * inputs of a form (e.g. a group of radio inputs), only _one_ `NgModelController` will be - * published on the parent `FormController` under that name. The rest of the controllers will - * continue to work as expected, but you won't be able to access them as properties on the parent - * `FormController`. - * - *
    - *

    - * In plain HTML forms, the `name` attribute is used to identify groups of radio inputs, so - * that the browser can manage their state (checked/unchecked) based on the state of other - * inputs in the same group. - *

    - *

    - * In AngularJS forms, this is not necessary. The input's state will be updated based on the - * value of the underlying model data. - *

    - *
    - * - *
    - * If you omit the `name` attribute on a radio input, `ngModel` will automatically assign it a - * unique name. - *
    - * - * @param {string} ngModel Assignable AngularJS expression to data-bind to. - * @param {string} value The value to which the `ngModel` expression should be set when selected. - * Note that `value` only supports `string` values, i.e. the scope model needs to be a string, - * too. Use `ngValue` if you need complex models (`number`, `object`, ...). - * @param {string=} name Property name of the form under which the control is published. - * @param {string=} ngChange AngularJS expression to be executed when input changes due to user - * interaction with the input element. - * @param {string} ngValue AngularJS expression to which `ngModel` will be be set when the radio - * is selected. Should be used instead of the `value` attribute if you need - * a non-string `ngModel` (`boolean`, `array`, ...). - * - * @example - - - -
    -
    -
    -
    - color = {{color.name | json}}
    -
    - Note that `ng-value="specialValue"` sets radio item's value to be the value of `$scope.specialValue`. -
    - - it('should change state', function() { - var inputs = element.all(by.model('color.name')); - var color = element(by.binding('color.name')); - - expect(color.getText()).toContain('blue'); - - inputs.get(0).click(); - expect(color.getText()).toContain('red'); - - inputs.get(1).click(); - expect(color.getText()).toContain('green'); - }); - -
    - */ - 'radio': radioInputType, - - /** - * @ngdoc input - * @name input[range] - * - * @description - * Native range input with validation and transformation. - * - * The model for the range input must always be a `Number`. - * - * IE9 and other browsers that do not support the `range` type fall back - * to a text input without any default values for `min`, `max` and `step`. Model binding, - * validation and number parsing are nevertheless supported. - * - * Browsers that support range (latest Chrome, Safari, Firefox, Edge) treat `input[range]` - * in a way that never allows the input to hold an invalid value. That means: - * - any non-numerical value is set to `(max + min) / 2`. - * - any numerical value that is less than the current min val, or greater than the current max val - * is set to the min / max val respectively. - * - additionally, the current `step` is respected, so the nearest value that satisfies a step - * is used. - * - * See the [HTML Spec on input[type=range]](https://www.w3.org/TR/html5/forms.html#range-state-(type=range)) - * for more info. - * - * This has the following consequences for AngularJS: - * - * Since the element value should always reflect the current model value, a range input - * will set the bound ngModel expression to the value that the browser has set for the - * input element. For example, in the following input ``, - * if the application sets `model.value = null`, the browser will set the input to `'50'`. - * AngularJS will then set the model to `50`, to prevent input and model value being out of sync. - * - * That means the model for range will immediately be set to `50` after `ngModel` has been - * initialized. It also means a range input can never have the required error. - * - * This does not only affect changes to the model value, but also to the values of the `min`, - * `max`, and `step` attributes. When these change in a way that will cause the browser to modify - * the input value, AngularJS will also update the model value. - * - * Automatic value adjustment also means that a range input element can never have the `required`, - * `min`, or `max` errors. - * - * However, `step` is currently only fully implemented by Firefox. Other browsers have problems - * when the step value changes dynamically - they do not adjust the element value correctly, but - * instead may set the `stepMismatch` error. If that's the case, the AngularJS will set the `step` - * error on the input, and set the model to `undefined`. - * - * Note that `input[range]` is not compatible with`ngMax`, `ngMin`, and `ngStep`, because they do - * not set the `min` and `max` attributes, which means that the browser won't automatically adjust - * the input value based on their values, and will always assume min = 0, max = 100, and step = 1. - * - * @param {string} ngModel Assignable AngularJS expression to data-bind to. - * @param {string=} name Property name of the form under which the control is published. - * @param {string=} min Sets the `min` validation to ensure that the value entered is greater - * than `min`. Can be interpolated. - * @param {string=} max Sets the `max` validation to ensure that the value entered is less than `max`. - * Can be interpolated. - * @param {string=} step Sets the `step` validation to ensure that the value entered matches the `step` - * Can be interpolated. - * @param {expression=} ngChange AngularJS expression to be executed when the ngModel value changes due - * to user interaction with the input element. - * @param {expression=} ngChecked If the expression is truthy, then the `checked` attribute will be set on the - * element. **Note** : `ngChecked` should not be used alongside `ngModel`. - * Checkout {@link ng.directive:ngChecked ngChecked} for usage. - * - * @example - - - -
    - - Model as range: -
    - Model as number:
    - Min:
    - Max:
    - value = {{value}}
    - myForm.range.$valid = {{myForm.range.$valid}}
    - myForm.range.$error = {{myForm.range.$error}} -
    -
    -
    - - * ## Range Input with ngMin & ngMax attributes - - * @example - - - -
    - Model as range: -
    - Model as number:
    - Min:
    - Max:
    - value = {{value}}
    - myForm.range.$valid = {{myForm.range.$valid}}
    - myForm.range.$error = {{myForm.range.$error}} -
    -
    -
    - - */ - 'range': rangeInputType, - - /** - * @ngdoc input - * @name input[checkbox] - * - * @description - * HTML checkbox. - * - * @param {string} ngModel Assignable AngularJS expression to data-bind to. - * @param {string=} name Property name of the form under which the control is published. - * @param {expression=} ngTrueValue The value to which the expression should be set when selected. - * @param {expression=} ngFalseValue The value to which the expression should be set when not selected. - * @param {string=} ngChange AngularJS expression to be executed when input changes due to user - * interaction with the input element. - * - * @example - - - -
    -
    -
    - value1 = {{checkboxModel.value1}}
    - value2 = {{checkboxModel.value2}}
    -
    -
    - - it('should change state', function() { - var value1 = element(by.binding('checkboxModel.value1')); - var value2 = element(by.binding('checkboxModel.value2')); - - expect(value1.getText()).toContain('true'); - expect(value2.getText()).toContain('YES'); - - element(by.model('checkboxModel.value1')).click(); - element(by.model('checkboxModel.value2')).click(); - - expect(value1.getText()).toContain('false'); - expect(value2.getText()).toContain('NO'); - }); - -
    - */ - 'checkbox': checkboxInputType, - - 'hidden': noop, - 'button': noop, - 'submit': noop, - 'reset': noop, - 'file': noop -}; - -function stringBasedInputType(ctrl) { - ctrl.$formatters.push(function(value) { - return ctrl.$isEmpty(value) ? value : value.toString(); - }); -} - -function textInputType(scope, element, attr, ctrl, $sniffer, $browser) { - baseInputType(scope, element, attr, ctrl, $sniffer, $browser); - stringBasedInputType(ctrl); -} - -function baseInputType(scope, element, attr, ctrl, $sniffer, $browser) { - var type = lowercase(element[0].type); - - // In composition mode, users are still inputting intermediate text buffer, - // hold the listener until composition is done. - // More about composition events: https://developer.mozilla.org/en-US/docs/Web/API/CompositionEvent - if (!$sniffer.android) { - var composing = false; - - element.on('compositionstart', function() { - composing = true; - }); - - // Support: IE9+ - element.on('compositionupdate', function(ev) { - // End composition when ev.data is empty string on 'compositionupdate' event. - // When the input de-focusses (e.g. by clicking away), IE triggers 'compositionupdate' - // instead of 'compositionend'. - if (isUndefined(ev.data) || ev.data === '') { - composing = false; - } - }); - - element.on('compositionend', function() { - composing = false; - listener(); - }); - } - - var timeout; - - var listener = function(ev) { - if (timeout) { - $browser.defer.cancel(timeout); - timeout = null; - } - if (composing) return; - var value = element.val(), - event = ev && ev.type; - - // By default we will trim the value - // If the attribute ng-trim exists we will avoid trimming - // If input type is 'password', the value is never trimmed - if (type !== 'password' && (!attr.ngTrim || attr.ngTrim !== 'false')) { - value = trim(value); - } - - // If a control is suffering from bad input (due to native validators), browsers discard its - // value, so it may be necessary to revalidate (by calling $setViewValue again) even if the - // control's value is the same empty value twice in a row. - if (ctrl.$viewValue !== value || (value === '' && ctrl.$$hasNativeValidators)) { - ctrl.$setViewValue(value, event); - } - }; - - // if the browser does support "input" event, we are fine - except on IE9 which doesn't fire the - // input event on backspace, delete or cut - if ($sniffer.hasEvent('input')) { - element.on('input', listener); - } else { - var deferListener = function(ev, input, origValue) { - if (!timeout) { - timeout = $browser.defer(function() { - timeout = null; - if (!input || input.value !== origValue) { - listener(ev); - } - }); - } - }; - - element.on('keydown', /** @this */ function(event) { - var key = event.keyCode; - - // ignore - // command modifiers arrows - if (key === 91 || (15 < key && key < 19) || (37 <= key && key <= 40)) return; - - deferListener(event, this, this.value); - }); - - // if user modifies input value using context menu in IE, we need "paste", "cut" and "drop" events to catch it - if ($sniffer.hasEvent('paste')) { - element.on('paste cut drop', deferListener); - } - } - - // if user paste into input using mouse on older browser - // or form autocomplete on newer browser, we need "change" event to catch it - element.on('change', listener); - - // Some native input types (date-family) have the ability to change validity without - // firing any input/change events. - // For these event types, when native validators are present and the browser supports the type, - // check for validity changes on various DOM events. - if (PARTIAL_VALIDATION_TYPES[type] && ctrl.$$hasNativeValidators && type === attr.type) { - element.on(PARTIAL_VALIDATION_EVENTS, /** @this */ function(ev) { - if (!timeout) { - var validity = this[VALIDITY_STATE_PROPERTY]; - var origBadInput = validity.badInput; - var origTypeMismatch = validity.typeMismatch; - timeout = $browser.defer(function() { - timeout = null; - if (validity.badInput !== origBadInput || validity.typeMismatch !== origTypeMismatch) { - listener(ev); - } - }); - } - }); - } - - ctrl.$render = function() { - // Workaround for Firefox validation #12102. - var value = ctrl.$isEmpty(ctrl.$viewValue) ? '' : ctrl.$viewValue; - if (element.val() !== value) { - element.val(value); - } - }; -} - -function weekParser(isoWeek, existingDate) { - if (isDate(isoWeek)) { - return isoWeek; - } - - if (isString(isoWeek)) { - WEEK_REGEXP.lastIndex = 0; - var parts = WEEK_REGEXP.exec(isoWeek); - if (parts) { - var year = +parts[1], - week = +parts[2], - hours = 0, - minutes = 0, - seconds = 0, - milliseconds = 0, - firstThurs = getFirstThursdayOfYear(year), - addDays = (week - 1) * 7; - - if (existingDate) { - hours = existingDate.getHours(); - minutes = existingDate.getMinutes(); - seconds = existingDate.getSeconds(); - milliseconds = existingDate.getMilliseconds(); - } - - return new Date(year, 0, firstThurs.getDate() + addDays, hours, minutes, seconds, milliseconds); - } - } - - return NaN; -} - -function createDateParser(regexp, mapping) { - return function(iso, previousDate) { - var parts, map; - - if (isDate(iso)) { - return iso; - } - - if (isString(iso)) { - // When a date is JSON'ified to wraps itself inside of an extra - // set of double quotes. This makes the date parsing code unable - // to match the date string and parse it as a date. - if (iso.charAt(0) === '"' && iso.charAt(iso.length - 1) === '"') { - iso = iso.substring(1, iso.length - 1); - } - if (ISO_DATE_REGEXP.test(iso)) { - return new Date(iso); - } - regexp.lastIndex = 0; - parts = regexp.exec(iso); - - if (parts) { - parts.shift(); - if (previousDate) { - map = { - yyyy: previousDate.getFullYear(), - MM: previousDate.getMonth() + 1, - dd: previousDate.getDate(), - HH: previousDate.getHours(), - mm: previousDate.getMinutes(), - ss: previousDate.getSeconds(), - sss: previousDate.getMilliseconds() / 1000 - }; - } else { - map = { yyyy: 1970, MM: 1, dd: 1, HH: 0, mm: 0, ss: 0, sss: 0 }; - } - - forEach(parts, function(part, index) { - if (index < mapping.length) { - map[mapping[index]] = +part; - } - }); - - var date = new Date(map.yyyy, map.MM - 1, map.dd, map.HH, map.mm, map.ss || 0, map.sss * 1000 || 0); - if (map.yyyy < 100) { - // In the constructor, 2-digit years map to 1900-1999. - // Use `setFullYear()` to set the correct year. - date.setFullYear(map.yyyy); - } - - return date; - } - } - - return NaN; - }; -} - -function createDateInputType(type, regexp, parseDate, format) { - return function dynamicDateInputType(scope, element, attr, ctrl, $sniffer, $browser, $filter, $parse) { - badInputChecker(scope, element, attr, ctrl, type); - baseInputType(scope, element, attr, ctrl, $sniffer, $browser); - - var isTimeType = type === 'time' || type === 'datetimelocal'; - var previousDate; - var previousTimezone; - - ctrl.$parsers.push(function(value) { - if (ctrl.$isEmpty(value)) return null; - - if (regexp.test(value)) { - // Note: We cannot read ctrl.$modelValue, as there might be a different - // parser/formatter in the processing chain so that the model - // contains some different data format! - return parseDateAndConvertTimeZoneToLocal(value, previousDate); - } - ctrl.$$parserName = type; - return undefined; - }); - - ctrl.$formatters.push(function(value) { - if (value && !isDate(value)) { - throw ngModelMinErr('datefmt', 'Expected `{0}` to be a date', value); - } - if (isValidDate(value)) { - previousDate = value; - var timezone = ctrl.$options.getOption('timezone'); - - if (timezone) { - previousTimezone = timezone; - previousDate = convertTimezoneToLocal(previousDate, timezone, true); - } - - return formatter(value, timezone); - } else { - previousDate = null; - previousTimezone = null; - return ''; - } - }); - - if (isDefined(attr.min) || attr.ngMin) { - var minVal = attr.min || $parse(attr.ngMin)(scope); - var parsedMinVal = parseObservedDateValue(minVal); - - ctrl.$validators.min = function(value) { - return !isValidDate(value) || isUndefined(parsedMinVal) || parseDate(value) >= parsedMinVal; - }; - attr.$observe('min', function(val) { - if (val !== minVal) { - parsedMinVal = parseObservedDateValue(val); - minVal = val; - ctrl.$validate(); - } - }); - } - - if (isDefined(attr.max) || attr.ngMax) { - var maxVal = attr.max || $parse(attr.ngMax)(scope); - var parsedMaxVal = parseObservedDateValue(maxVal); - - ctrl.$validators.max = function(value) { - return !isValidDate(value) || isUndefined(parsedMaxVal) || parseDate(value) <= parsedMaxVal; - }; - attr.$observe('max', function(val) { - if (val !== maxVal) { - parsedMaxVal = parseObservedDateValue(val); - maxVal = val; - ctrl.$validate(); - } - }); - } - - function isValidDate(value) { - // Invalid Date: getTime() returns NaN - return value && !(value.getTime && value.getTime() !== value.getTime()); - } - - function parseObservedDateValue(val) { - return isDefined(val) && !isDate(val) ? parseDateAndConvertTimeZoneToLocal(val) || undefined : val; - } - - function parseDateAndConvertTimeZoneToLocal(value, previousDate) { - var timezone = ctrl.$options.getOption('timezone'); - - if (previousTimezone && previousTimezone !== timezone) { - // If the timezone has changed, adjust the previousDate to the default timezone - // so that the new date is converted with the correct timezone offset - previousDate = addDateMinutes(previousDate, timezoneToOffset(previousTimezone)); - } - - var parsedDate = parseDate(value, previousDate); - - if (!isNaN(parsedDate) && timezone) { - parsedDate = convertTimezoneToLocal(parsedDate, timezone); - } - return parsedDate; - } - - function formatter(value, timezone) { - var targetFormat = format; - - if (isTimeType && isString(ctrl.$options.getOption('timeSecondsFormat'))) { - targetFormat = format - .replace('ss.sss', ctrl.$options.getOption('timeSecondsFormat')) - .replace(/:$/, ''); - } - - var formatted = $filter('date')(value, targetFormat, timezone); - - if (isTimeType && ctrl.$options.getOption('timeStripZeroSeconds')) { - formatted = formatted.replace(/(?::00)?(?:\.000)?$/, ''); - } - - return formatted; - } - }; -} - -function badInputChecker(scope, element, attr, ctrl, parserName) { - var node = element[0]; - var nativeValidation = ctrl.$$hasNativeValidators = isObject(node.validity); - if (nativeValidation) { - ctrl.$parsers.push(function(value) { - var validity = element.prop(VALIDITY_STATE_PROPERTY) || {}; - if (validity.badInput || validity.typeMismatch) { - ctrl.$$parserName = parserName; - return undefined; - } - - return value; - }); - } -} - -function numberFormatterParser(ctrl) { - ctrl.$parsers.push(function(value) { - if (ctrl.$isEmpty(value)) return null; - if (NUMBER_REGEXP.test(value)) return parseFloat(value); - - ctrl.$$parserName = 'number'; - return undefined; - }); - - ctrl.$formatters.push(function(value) { - if (!ctrl.$isEmpty(value)) { - if (!isNumber(value)) { - throw ngModelMinErr('numfmt', 'Expected `{0}` to be a number', value); - } - value = value.toString(); - } - return value; - }); -} - -function parseNumberAttrVal(val) { - if (isDefined(val) && !isNumber(val)) { - val = parseFloat(val); - } - return !isNumberNaN(val) ? val : undefined; -} - -function isNumberInteger(num) { - // See http://stackoverflow.com/questions/14636536/how-to-check-if-a-variable-is-an-integer-in-javascript#14794066 - // (minus the assumption that `num` is a number) - - // eslint-disable-next-line no-bitwise - return (num | 0) === num; -} - -function countDecimals(num) { - var numString = num.toString(); - var decimalSymbolIndex = numString.indexOf('.'); - - if (decimalSymbolIndex === -1) { - if (-1 < num && num < 1) { - // It may be in the exponential notation format (`1e-X`) - var match = /e-(\d+)$/.exec(numString); - - if (match) { - return Number(match[1]); - } - } - - return 0; - } - - return numString.length - decimalSymbolIndex - 1; -} - -function isValidForStep(viewValue, stepBase, step) { - // At this point `stepBase` and `step` are expected to be non-NaN values - // and `viewValue` is expected to be a valid stringified number. - var value = Number(viewValue); - - var isNonIntegerValue = !isNumberInteger(value); - var isNonIntegerStepBase = !isNumberInteger(stepBase); - var isNonIntegerStep = !isNumberInteger(step); - - // Due to limitations in Floating Point Arithmetic (e.g. `0.3 - 0.2 !== 0.1` or - // `0.5 % 0.1 !== 0`), we need to convert all numbers to integers. - if (isNonIntegerValue || isNonIntegerStepBase || isNonIntegerStep) { - var valueDecimals = isNonIntegerValue ? countDecimals(value) : 0; - var stepBaseDecimals = isNonIntegerStepBase ? countDecimals(stepBase) : 0; - var stepDecimals = isNonIntegerStep ? countDecimals(step) : 0; - - var decimalCount = Math.max(valueDecimals, stepBaseDecimals, stepDecimals); - var multiplier = Math.pow(10, decimalCount); - - value = value * multiplier; - stepBase = stepBase * multiplier; - step = step * multiplier; - - if (isNonIntegerValue) value = Math.round(value); - if (isNonIntegerStepBase) stepBase = Math.round(stepBase); - if (isNonIntegerStep) step = Math.round(step); - } - - return (value - stepBase) % step === 0; -} - -function numberInputType(scope, element, attr, ctrl, $sniffer, $browser, $filter, $parse) { - badInputChecker(scope, element, attr, ctrl, 'number'); - numberFormatterParser(ctrl); - baseInputType(scope, element, attr, ctrl, $sniffer, $browser); - - var parsedMinVal; - - if (isDefined(attr.min) || attr.ngMin) { - var minVal = attr.min || $parse(attr.ngMin)(scope); - parsedMinVal = parseNumberAttrVal(minVal); - - ctrl.$validators.min = function(modelValue, viewValue) { - return ctrl.$isEmpty(viewValue) || isUndefined(parsedMinVal) || viewValue >= parsedMinVal; - }; - - attr.$observe('min', function(val) { - if (val !== minVal) { - parsedMinVal = parseNumberAttrVal(val); - minVal = val; - // TODO(matsko): implement validateLater to reduce number of validations - ctrl.$validate(); - } - }); - } - - if (isDefined(attr.max) || attr.ngMax) { - var maxVal = attr.max || $parse(attr.ngMax)(scope); - var parsedMaxVal = parseNumberAttrVal(maxVal); - - ctrl.$validators.max = function(modelValue, viewValue) { - return ctrl.$isEmpty(viewValue) || isUndefined(parsedMaxVal) || viewValue <= parsedMaxVal; - }; - - attr.$observe('max', function(val) { - if (val !== maxVal) { - parsedMaxVal = parseNumberAttrVal(val); - maxVal = val; - // TODO(matsko): implement validateLater to reduce number of validations - ctrl.$validate(); - } - }); - } - - if (isDefined(attr.step) || attr.ngStep) { - var stepVal = attr.step || $parse(attr.ngStep)(scope); - var parsedStepVal = parseNumberAttrVal(stepVal); - - ctrl.$validators.step = function(modelValue, viewValue) { - return ctrl.$isEmpty(viewValue) || isUndefined(parsedStepVal) || - isValidForStep(viewValue, parsedMinVal || 0, parsedStepVal); - }; - - attr.$observe('step', function(val) { - // TODO(matsko): implement validateLater to reduce number of validations - if (val !== stepVal) { - parsedStepVal = parseNumberAttrVal(val); - stepVal = val; - ctrl.$validate(); - } - - }); - - } -} - -function rangeInputType(scope, element, attr, ctrl, $sniffer, $browser) { - badInputChecker(scope, element, attr, ctrl, 'range'); - numberFormatterParser(ctrl); - baseInputType(scope, element, attr, ctrl, $sniffer, $browser); - - var supportsRange = ctrl.$$hasNativeValidators && element[0].type === 'range', - minVal = supportsRange ? 0 : undefined, - maxVal = supportsRange ? 100 : undefined, - stepVal = supportsRange ? 1 : undefined, - validity = element[0].validity, - hasMinAttr = isDefined(attr.min), - hasMaxAttr = isDefined(attr.max), - hasStepAttr = isDefined(attr.step); - - var originalRender = ctrl.$render; - - ctrl.$render = supportsRange && isDefined(validity.rangeUnderflow) && isDefined(validity.rangeOverflow) ? - //Browsers that implement range will set these values automatically, but reading the adjusted values after - //$render would cause the min / max validators to be applied with the wrong value - function rangeRender() { - originalRender(); - ctrl.$setViewValue(element.val()); - } : - originalRender; - - if (hasMinAttr) { - minVal = parseNumberAttrVal(attr.min); - - ctrl.$validators.min = supportsRange ? - // Since all browsers set the input to a valid value, we don't need to check validity - function noopMinValidator() { return true; } : - // non-support browsers validate the min val - function minValidator(modelValue, viewValue) { - return ctrl.$isEmpty(viewValue) || isUndefined(minVal) || viewValue >= minVal; - }; - - setInitialValueAndObserver('min', minChange); - } - - if (hasMaxAttr) { - maxVal = parseNumberAttrVal(attr.max); - - ctrl.$validators.max = supportsRange ? - // Since all browsers set the input to a valid value, we don't need to check validity - function noopMaxValidator() { return true; } : - // non-support browsers validate the max val - function maxValidator(modelValue, viewValue) { - return ctrl.$isEmpty(viewValue) || isUndefined(maxVal) || viewValue <= maxVal; - }; - - setInitialValueAndObserver('max', maxChange); - } - - if (hasStepAttr) { - stepVal = parseNumberAttrVal(attr.step); - - ctrl.$validators.step = supportsRange ? - function nativeStepValidator() { - // Currently, only FF implements the spec on step change correctly (i.e. adjusting the - // input element value to a valid value). It's possible that other browsers set the stepMismatch - // validity error instead, so we can at least report an error in that case. - return !validity.stepMismatch; - } : - // ngStep doesn't set the setp attr, so the browser doesn't adjust the input value as setting step would - function stepValidator(modelValue, viewValue) { - return ctrl.$isEmpty(viewValue) || isUndefined(stepVal) || - isValidForStep(viewValue, minVal || 0, stepVal); - }; - - setInitialValueAndObserver('step', stepChange); - } - - function setInitialValueAndObserver(htmlAttrName, changeFn) { - // interpolated attributes set the attribute value only after a digest, but we need the - // attribute value when the input is first rendered, so that the browser can adjust the - // input value based on the min/max value - element.attr(htmlAttrName, attr[htmlAttrName]); - var oldVal = attr[htmlAttrName]; - attr.$observe(htmlAttrName, function wrappedObserver(val) { - if (val !== oldVal) { - oldVal = val; - changeFn(val); - } - }); - } - - function minChange(val) { - minVal = parseNumberAttrVal(val); - // ignore changes before model is initialized - if (isNumberNaN(ctrl.$modelValue)) { - return; - } - - if (supportsRange) { - var elVal = element.val(); - // IE11 doesn't set the el val correctly if the minVal is greater than the element value - if (minVal > elVal) { - elVal = minVal; - element.val(elVal); - } - ctrl.$setViewValue(elVal); - } else { - // TODO(matsko): implement validateLater to reduce number of validations - ctrl.$validate(); - } - } - - function maxChange(val) { - maxVal = parseNumberAttrVal(val); - // ignore changes before model is initialized - if (isNumberNaN(ctrl.$modelValue)) { - return; - } - - if (supportsRange) { - var elVal = element.val(); - // IE11 doesn't set the el val correctly if the maxVal is less than the element value - if (maxVal < elVal) { - element.val(maxVal); - // IE11 and Chrome don't set the value to the minVal when max < min - elVal = maxVal < minVal ? minVal : maxVal; - } - ctrl.$setViewValue(elVal); - } else { - // TODO(matsko): implement validateLater to reduce number of validations - ctrl.$validate(); - } - } - - function stepChange(val) { - stepVal = parseNumberAttrVal(val); - // ignore changes before model is initialized - if (isNumberNaN(ctrl.$modelValue)) { - return; - } - - // Some browsers don't adjust the input value correctly, but set the stepMismatch error - if (!supportsRange) { - // TODO(matsko): implement validateLater to reduce number of validations - ctrl.$validate(); - } else if (ctrl.$viewValue !== element.val()) { - ctrl.$setViewValue(element.val()); - } - } -} - -function urlInputType(scope, element, attr, ctrl, $sniffer, $browser) { - // Note: no badInputChecker here by purpose as `url` is only a validation - // in browsers, i.e. we can always read out input.value even if it is not valid! - baseInputType(scope, element, attr, ctrl, $sniffer, $browser); - stringBasedInputType(ctrl); - - ctrl.$validators.url = function(modelValue, viewValue) { - var value = modelValue || viewValue; - return ctrl.$isEmpty(value) || URL_REGEXP.test(value); - }; -} - -function emailInputType(scope, element, attr, ctrl, $sniffer, $browser) { - // Note: no badInputChecker here by purpose as `url` is only a validation - // in browsers, i.e. we can always read out input.value even if it is not valid! - baseInputType(scope, element, attr, ctrl, $sniffer, $browser); - stringBasedInputType(ctrl); - - ctrl.$validators.email = function(modelValue, viewValue) { - var value = modelValue || viewValue; - return ctrl.$isEmpty(value) || EMAIL_REGEXP.test(value); - }; -} - -function radioInputType(scope, element, attr, ctrl) { - var doTrim = !attr.ngTrim || trim(attr.ngTrim) !== 'false'; - // make the name unique, if not defined - if (isUndefined(attr.name)) { - element.attr('name', nextUid()); - } - - var listener = function(ev) { - var value; - if (element[0].checked) { - value = attr.value; - if (doTrim) { - value = trim(value); - } - ctrl.$setViewValue(value, ev && ev.type); - } - }; - - element.on('change', listener); - - ctrl.$render = function() { - var value = attr.value; - if (doTrim) { - value = trim(value); - } - element[0].checked = (value === ctrl.$viewValue); - }; - - attr.$observe('value', ctrl.$render); -} - -function parseConstantExpr($parse, context, name, expression, fallback) { - var parseFn; - if (isDefined(expression)) { - parseFn = $parse(expression); - if (!parseFn.constant) { - throw ngModelMinErr('constexpr', 'Expected constant expression for `{0}`, but saw ' + - '`{1}`.', name, expression); - } - return parseFn(context); - } - return fallback; -} - -function checkboxInputType(scope, element, attr, ctrl, $sniffer, $browser, $filter, $parse) { - var trueValue = parseConstantExpr($parse, scope, 'ngTrueValue', attr.ngTrueValue, true); - var falseValue = parseConstantExpr($parse, scope, 'ngFalseValue', attr.ngFalseValue, false); - - var listener = function(ev) { - ctrl.$setViewValue(element[0].checked, ev && ev.type); - }; - - element.on('change', listener); - - ctrl.$render = function() { - element[0].checked = ctrl.$viewValue; - }; - - // Override the standard `$isEmpty` because the $viewValue of an empty checkbox is always set to `false` - // This is because of the parser below, which compares the `$modelValue` with `trueValue` to convert - // it to a boolean. - ctrl.$isEmpty = function(value) { - return value === false; - }; - - ctrl.$formatters.push(function(value) { - return equals(value, trueValue); - }); - - ctrl.$parsers.push(function(value) { - return value ? trueValue : falseValue; - }); -} - - -/** - * @ngdoc directive - * @name textarea - * @restrict E - * - * @description - * HTML textarea element control with AngularJS data-binding. The data-binding and validation - * properties of this element are exactly the same as those of the - * {@link ng.directive:input input element}. - * - * @param {string} ngModel Assignable AngularJS expression to data-bind to. - * @param {string=} name Property name of the form under which the control is published. - * @param {string=} required Sets `required` validation error key if the value is not entered. - * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to - * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of - * `required` when you want to data-bind to the `required` attribute. - * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than - * minlength. - * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than - * maxlength. Setting the attribute to a negative or non-numeric value, allows view values of any - * length. - * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel {@link ngModel.NgModelController#$viewValue $viewValue} - * does not match a RegExp found by evaluating the AngularJS expression given in the attribute value. - * If the expression evaluates to a RegExp object, then this is used directly. - * If the expression evaluates to a string, then it will be converted to a RegExp - * after wrapping it in `^` and `$` characters. For instance, `"abc"` will be converted to - * `new RegExp('^abc$')`.
    - * **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to - * start at the index of the last search's match, thus not taking the whole input value into - * account. - * @param {string=} ngChange AngularJS expression to be executed when input changes due to user - * interaction with the input element. - * @param {boolean=} [ngTrim=true] If set to false AngularJS will not automatically trim the input. - * - * @knownIssue - * - * When specifying the `placeholder` attribute of ` - *
    {{ list | json }}
    - * - * - * it("should split the text by newlines", function() { - * var listInput = element(by.model('list')); - * var output = element(by.binding('list | json')); - * listInput.sendKeys('abc\ndef\nghi'); - * expect(output.getText()).toContain('[\n "abc",\n "def",\n "ghi"\n]'); - * }); - * - * - * - */ -var ngListDirective = function() { - return { - restrict: 'A', - priority: 100, - require: 'ngModel', - link: function(scope, element, attr, ctrl) { - var ngList = attr.ngList || ', '; - var trimValues = attr.ngTrim !== 'false'; - var separator = trimValues ? trim(ngList) : ngList; - - var parse = function(viewValue) { - // If the viewValue is invalid (say required but empty) it will be `undefined` - if (isUndefined(viewValue)) return; - - var list = []; - - if (viewValue) { - forEach(viewValue.split(separator), function(value) { - if (value) list.push(trimValues ? trim(value) : value); - }); - } - - return list; - }; - - ctrl.$parsers.push(parse); - ctrl.$formatters.push(function(value) { - if (isArray(value)) { - return value.join(ngList); - } - - return undefined; - }); - - // Override the standard $isEmpty because an empty array means the input is empty. - ctrl.$isEmpty = function(value) { - return !value || !value.length; - }; - } - }; -}; - -/* global VALID_CLASS: true, - INVALID_CLASS: true, - PRISTINE_CLASS: true, - DIRTY_CLASS: true, - UNTOUCHED_CLASS: true, - TOUCHED_CLASS: true, - PENDING_CLASS: true, - addSetValidityMethod: true, - setupValidity: true, - defaultModelOptions: false -*/ - - -var VALID_CLASS = 'ng-valid', - INVALID_CLASS = 'ng-invalid', - PRISTINE_CLASS = 'ng-pristine', - DIRTY_CLASS = 'ng-dirty', - UNTOUCHED_CLASS = 'ng-untouched', - TOUCHED_CLASS = 'ng-touched', - EMPTY_CLASS = 'ng-empty', - NOT_EMPTY_CLASS = 'ng-not-empty'; - -var ngModelMinErr = minErr('ngModel'); - -/** - * @ngdoc type - * @name ngModel.NgModelController - * @property {*} $viewValue The actual value from the control's view. For `input` elements, this is a - * String. See {@link ngModel.NgModelController#$setViewValue} for information about when the $viewValue - * is set. - * - * @property {*} $modelValue The value in the model that the control is bound to. - * - * @property {Array.} $parsers Array of functions to execute, as a pipeline, whenever - * the control updates the ngModelController with a new {@link ngModel.NgModelController#$viewValue - `$viewValue`} from the DOM, usually via user input. - See {@link ngModel.NgModelController#$setViewValue `$setViewValue()`} for a detailed lifecycle explanation. - Note that the `$parsers` are not called when the bound ngModel expression changes programmatically. - - The functions are called in array order, each passing - its return value through to the next. The last return value is forwarded to the - {@link ngModel.NgModelController#$validators `$validators`} collection. - - Parsers are used to sanitize / convert the {@link ngModel.NgModelController#$viewValue - `$viewValue`}. - - Returning `undefined` from a parser means a parse error occurred. In that case, - no {@link ngModel.NgModelController#$validators `$validators`} will run and the `ngModel` - will be set to `undefined` unless {@link ngModelOptions `ngModelOptions.allowInvalid`} - is set to `true`. The parse error is stored in `ngModel.$error.parse`. - - This simple example shows a parser that would convert text input value to lowercase: - * ```js - * function parse(value) { - * if (value) { - * return value.toLowerCase(); - * } - * } - * ngModelController.$parsers.push(parse); - * ``` - - * - * @property {Array.} $formatters Array of functions to execute, as a pipeline, whenever - the bound ngModel expression changes programmatically. The `$formatters` are not called when the - value of the control is changed by user interaction. - - Formatters are used to format / convert the {@link ngModel.NgModelController#$modelValue - `$modelValue`} for display in the control. - - The functions are called in reverse array order, each passing the value through to the - next. The last return value is used as the actual DOM value. - - This simple example shows a formatter that would convert the model value to uppercase: - - * ```js - * function format(value) { - * if (value) { - * return value.toUpperCase(); - * } - * } - * ngModel.$formatters.push(format); - * ``` - * - * @property {Object.} $validators A collection of validators that are applied - * whenever the model value changes. The key value within the object refers to the name of the - * validator while the function refers to the validation operation. The validation operation is - * provided with the model value as an argument and must return a true or false value depending - * on the response of that validation. - * - * ```js - * ngModel.$validators.validCharacters = function(modelValue, viewValue) { - * var value = modelValue || viewValue; - * return /[0-9]+/.test(value) && - * /[a-z]+/.test(value) && - * /[A-Z]+/.test(value) && - * /\W+/.test(value); - * }; - * ``` - * - * @property {Object.} $asyncValidators A collection of validations that are expected to - * perform an asynchronous validation (e.g. a HTTP request). The validation function that is provided - * is expected to return a promise when it is run during the model validation process. Once the promise - * is delivered then the validation status will be set to true when fulfilled and false when rejected. - * When the asynchronous validators are triggered, each of the validators will run in parallel and the model - * value will only be updated once all validators have been fulfilled. As long as an asynchronous validator - * is unfulfilled, its key will be added to the controllers `$pending` property. Also, all asynchronous validators - * will only run once all synchronous validators have passed. - * - * Please note that if $http is used then it is important that the server returns a success HTTP response code - * in order to fulfill the validation and a status level of `4xx` in order to reject the validation. - * - * ```js - * ngModel.$asyncValidators.uniqueUsername = function(modelValue, viewValue) { - * var value = modelValue || viewValue; - * - * // Lookup user by username - * return $http.get('/api/users/' + value). - * then(function resolved() { - * //username exists, this means validation fails - * return $q.reject('exists'); - * }, function rejected() { - * //username does not exist, therefore this validation passes - * return true; - * }); - * }; - * ``` - * - * @property {Array.} $viewChangeListeners Array of functions to execute whenever - * a change to {@link ngModel.NgModelController#$viewValue `$viewValue`} has caused a change - * to {@link ngModel.NgModelController#$modelValue `$modelValue`}. - * It is called with no arguments, and its return value is ignored. - * This can be used in place of additional $watches against the model value. - * - * @property {Object} $error An object hash with all failing validator ids as keys. - * @property {Object} $pending An object hash with all pending validator ids as keys. - * - * @property {boolean} $untouched True if control has not lost focus yet. - * @property {boolean} $touched True if control has lost focus. - * @property {boolean} $pristine True if user has not interacted with the control yet. - * @property {boolean} $dirty True if user has already interacted with the control. - * @property {boolean} $valid True if there is no error. - * @property {boolean} $invalid True if at least one error on the control. - * @property {string} $name The name attribute of the control. - * - * @description - * - * `NgModelController` provides API for the {@link ngModel `ngModel`} directive. - * The controller contains services for data-binding, validation, CSS updates, and value formatting - * and parsing. It purposefully does not contain any logic which deals with DOM rendering or - * listening to DOM events. - * Such DOM related logic should be provided by other directives which make use of - * `NgModelController` for data-binding to control elements. - * AngularJS provides this DOM logic for most {@link input `input`} elements. - * At the end of this page you can find a {@link ngModel.NgModelController#custom-control-example - * custom control example} that uses `ngModelController` to bind to `contenteditable` elements. - * - * @example - * ### Custom Control Example - * This example shows how to use `NgModelController` with a custom control to achieve - * data-binding. Notice how different directives (`contenteditable`, `ng-model`, and `required`) - * collaborate together to achieve the desired result. - * - * `contenteditable` is an HTML5 attribute, which tells the browser to let the element - * contents be edited in place by the user. - * - * We are using the {@link ng.service:$sce $sce} service here and include the {@link ngSanitize $sanitize} - * module to automatically remove "bad" content like inline event listener (e.g. ``). - * However, as we are using `$sce` the model can still decide to provide unsafe content if it marks - * that content using the `$sce` service. - * - * - - [contenteditable] { - border: 1px solid black; - background-color: white; - min-height: 20px; - } - - .ng-invalid { - border: 1px solid red; - } - - - - angular.module('customControl', ['ngSanitize']). - directive('contenteditable', ['$sce', function($sce) { - return { - restrict: 'A', // only activate on element attribute - require: '?ngModel', // get a hold of NgModelController - link: function(scope, element, attrs, ngModel) { - if (!ngModel) return; // do nothing if no ng-model - - // Specify how UI should be updated - ngModel.$render = function() { - element.html($sce.getTrustedHtml(ngModel.$viewValue || '')); - }; - - // Listen for change events to enable binding - element.on('blur keyup change', function() { - scope.$evalAsync(read); - }); - read(); // initialize - - // Write data to the model - function read() { - var html = element.html(); - // When we clear the content editable the browser leaves a
    behind - // If strip-br attribute is provided then we strip this out - if (attrs.stripBr && html === '
    ') { - html = ''; - } - ngModel.$setViewValue(html); - } - } - }; - }]); -
    - -
    -
    Change me!
    - Required! -
    - -
    -
    - - it('should data-bind and become invalid', function() { - if (browser.params.browser === 'safari' || browser.params.browser === 'firefox') { - // SafariDriver can't handle contenteditable - // and Firefox driver can't clear contenteditables very well - return; - } - var contentEditable = element(by.css('[contenteditable]')); - var content = 'Change me!'; - - expect(contentEditable.getText()).toEqual(content); - - contentEditable.clear(); - contentEditable.sendKeys(protractor.Key.BACK_SPACE); - expect(contentEditable.getText()).toEqual(''); - expect(contentEditable.getAttribute('class')).toMatch(/ng-invalid-required/); - }); - - *
    - * - * - */ -NgModelController.$inject = ['$scope', '$exceptionHandler', '$attrs', '$element', '$parse', '$animate', '$timeout', '$q', '$interpolate']; -function NgModelController($scope, $exceptionHandler, $attr, $element, $parse, $animate, $timeout, $q, $interpolate) { - this.$viewValue = Number.NaN; - this.$modelValue = Number.NaN; - this.$$rawModelValue = undefined; // stores the parsed modelValue / model set from scope regardless of validity. - this.$validators = {}; - this.$asyncValidators = {}; - this.$parsers = []; - this.$formatters = []; - this.$viewChangeListeners = []; - this.$untouched = true; - this.$touched = false; - this.$pristine = true; - this.$dirty = false; - this.$valid = true; - this.$invalid = false; - this.$error = {}; // keep invalid keys here - this.$$success = {}; // keep valid keys here - this.$pending = undefined; // keep pending keys here - this.$name = $interpolate($attr.name || '', false)($scope); - this.$$parentForm = nullFormCtrl; - this.$options = defaultModelOptions; - this.$$updateEvents = ''; - // Attach the correct context to the event handler function for updateOn - this.$$updateEventHandler = this.$$updateEventHandler.bind(this); - - this.$$parsedNgModel = $parse($attr.ngModel); - this.$$parsedNgModelAssign = this.$$parsedNgModel.assign; - this.$$ngModelGet = this.$$parsedNgModel; - this.$$ngModelSet = this.$$parsedNgModelAssign; - this.$$pendingDebounce = null; - this.$$parserValid = undefined; - this.$$parserName = 'parse'; - - this.$$currentValidationRunId = 0; - - this.$$scope = $scope; - this.$$rootScope = $scope.$root; - this.$$attr = $attr; - this.$$element = $element; - this.$$animate = $animate; - this.$$timeout = $timeout; - this.$$parse = $parse; - this.$$q = $q; - this.$$exceptionHandler = $exceptionHandler; - - setupValidity(this); - setupModelWatcher(this); -} - -NgModelController.prototype = { - $$initGetterSetters: function() { - if (this.$options.getOption('getterSetter')) { - var invokeModelGetter = this.$$parse(this.$$attr.ngModel + '()'), - invokeModelSetter = this.$$parse(this.$$attr.ngModel + '($$$p)'); - - this.$$ngModelGet = function($scope) { - var modelValue = this.$$parsedNgModel($scope); - if (isFunction(modelValue)) { - modelValue = invokeModelGetter($scope); - } - return modelValue; - }; - this.$$ngModelSet = function($scope, newValue) { - if (isFunction(this.$$parsedNgModel($scope))) { - invokeModelSetter($scope, {$$$p: newValue}); - } else { - this.$$parsedNgModelAssign($scope, newValue); - } - }; - } else if (!this.$$parsedNgModel.assign) { - throw ngModelMinErr('nonassign', 'Expression \'{0}\' is non-assignable. Element: {1}', - this.$$attr.ngModel, startingTag(this.$$element)); - } - }, - - - /** - * @ngdoc method - * @name ngModel.NgModelController#$render - * - * @description - * Called when the view needs to be updated. It is expected that the user of the ng-model - * directive will implement this method. - * - * The `$render()` method is invoked in the following situations: - * - * * `$rollbackViewValue()` is called. If we are rolling back the view value to the last - * committed value then `$render()` is called to update the input control. - * * The value referenced by `ng-model` is changed programmatically and both the `$modelValue` and - * the `$viewValue` are different from last time. - * - * Since `ng-model` does not do a deep watch, `$render()` is only invoked if the values of - * `$modelValue` and `$viewValue` are actually different from their previous values. If `$modelValue` - * or `$viewValue` are objects (rather than a string or number) then `$render()` will not be - * invoked if you only change a property on the objects. - */ - $render: noop, - - /** - * @ngdoc method - * @name ngModel.NgModelController#$isEmpty - * - * @description - * This is called when we need to determine if the value of an input is empty. - * - * For instance, the required directive does this to work out if the input has data or not. - * - * The default `$isEmpty` function checks whether the value is `undefined`, `''`, `null` or `NaN`. - * - * You can override this for input directives whose concept of being empty is different from the - * default. The `checkboxInputType` directive does this because in its case a value of `false` - * implies empty. - * - * @param {*} value The value of the input to check for emptiness. - * @returns {boolean} True if `value` is "empty". - */ - $isEmpty: function(value) { - // eslint-disable-next-line no-self-compare - return isUndefined(value) || value === '' || value === null || value !== value; - }, - - $$updateEmptyClasses: function(value) { - if (this.$isEmpty(value)) { - this.$$animate.removeClass(this.$$element, NOT_EMPTY_CLASS); - this.$$animate.addClass(this.$$element, EMPTY_CLASS); - } else { - this.$$animate.removeClass(this.$$element, EMPTY_CLASS); - this.$$animate.addClass(this.$$element, NOT_EMPTY_CLASS); - } - }, - - /** - * @ngdoc method - * @name ngModel.NgModelController#$setPristine - * - * @description - * Sets the control to its pristine state. - * - * This method can be called to remove the `ng-dirty` class and set the control to its pristine - * state (`ng-pristine` class). A model is considered to be pristine when the control - * has not been changed from when first compiled. - */ - $setPristine: function() { - this.$dirty = false; - this.$pristine = true; - this.$$animate.removeClass(this.$$element, DIRTY_CLASS); - this.$$animate.addClass(this.$$element, PRISTINE_CLASS); - }, - - /** - * @ngdoc method - * @name ngModel.NgModelController#$setDirty - * - * @description - * Sets the control to its dirty state. - * - * This method can be called to remove the `ng-pristine` class and set the control to its dirty - * state (`ng-dirty` class). A model is considered to be dirty when the control has been changed - * from when first compiled. - */ - $setDirty: function() { - this.$dirty = true; - this.$pristine = false; - this.$$animate.removeClass(this.$$element, PRISTINE_CLASS); - this.$$animate.addClass(this.$$element, DIRTY_CLASS); - this.$$parentForm.$setDirty(); - }, - - /** - * @ngdoc method - * @name ngModel.NgModelController#$setUntouched - * - * @description - * Sets the control to its untouched state. - * - * This method can be called to remove the `ng-touched` class and set the control to its - * untouched state (`ng-untouched` class). Upon compilation, a model is set as untouched - * by default, however this function can be used to restore that state if the model has - * already been touched by the user. - */ - $setUntouched: function() { - this.$touched = false; - this.$untouched = true; - this.$$animate.setClass(this.$$element, UNTOUCHED_CLASS, TOUCHED_CLASS); - }, - - /** - * @ngdoc method - * @name ngModel.NgModelController#$setTouched - * - * @description - * Sets the control to its touched state. - * - * This method can be called to remove the `ng-untouched` class and set the control to its - * touched state (`ng-touched` class). A model is considered to be touched when the user has - * first focused the control element and then shifted focus away from the control (blur event). - */ - $setTouched: function() { - this.$touched = true; - this.$untouched = false; - this.$$animate.setClass(this.$$element, TOUCHED_CLASS, UNTOUCHED_CLASS); - }, - - /** - * @ngdoc method - * @name ngModel.NgModelController#$rollbackViewValue - * - * @description - * Cancel an update and reset the input element's value to prevent an update to the `$modelValue`, - * which may be caused by a pending debounced event or because the input is waiting for some - * future event. - * - * If you have an input that uses `ng-model-options` to set up debounced updates or updates that - * depend on special events such as `blur`, there can be a period when the `$viewValue` is out of - * sync with the ngModel's `$modelValue`. - * - * In this case, you can use `$rollbackViewValue()` to manually cancel the debounced / future update - * and reset the input to the last committed view value. - * - * It is also possible that you run into difficulties if you try to update the ngModel's `$modelValue` - * programmatically before these debounced/future events have resolved/occurred, because AngularJS's - * dirty checking mechanism is not able to tell whether the model has actually changed or not. - * - * The `$rollbackViewValue()` method should be called before programmatically changing the model of an - * input which may have such events pending. This is important in order to make sure that the - * input field will be updated with the new model value and any pending operations are cancelled. - * - * @example - * - * - * angular.module('cancel-update-example', []) - * - * .controller('CancelUpdateController', ['$scope', function($scope) { - * $scope.model = {value1: '', value2: ''}; - * - * $scope.setEmpty = function(e, value, rollback) { - * if (e.keyCode === 27) { - * e.preventDefault(); - * if (rollback) { - * $scope.myForm[value].$rollbackViewValue(); - * } - * $scope.model[value] = ''; - * } - * }; - * }]); - * - * - *
    - *

    Both of these inputs are only updated if they are blurred. Hitting escape should - * empty them. Follow these steps and observe the difference:

    - *
      - *
    1. Type something in the input. You will see that the model is not yet updated
    2. - *
    3. Press the Escape key. - *
        - *
      1. In the first example, nothing happens, because the model is already '', and no - * update is detected. If you blur the input, the model will be set to the current view. - *
      2. - *
      3. In the second example, the pending update is cancelled, and the input is set back - * to the last committed view value (''). Blurring the input does nothing. - *
      4. - *
      - *
    4. - *
    - * - *
    - *
    - *

    Without $rollbackViewValue():

    - * - * value1: "{{ model.value1 }}" - *
    - * - *
    - *

    With $rollbackViewValue():

    - * - * value2: "{{ model.value2 }}" - *
    - *
    - *
    - *
    - - div { - display: table-cell; - } - div:nth-child(1) { - padding-right: 30px; - } - - - *
    - */ - $rollbackViewValue: function() { - this.$$timeout.cancel(this.$$pendingDebounce); - this.$viewValue = this.$$lastCommittedViewValue; - this.$render(); - }, - - /** - * @ngdoc method - * @name ngModel.NgModelController#$validate - * - * @description - * Runs each of the registered validators (first synchronous validators and then - * asynchronous validators). - * If the validity changes to invalid, the model will be set to `undefined`, - * unless {@link ngModelOptions `ngModelOptions.allowInvalid`} is `true`. - * If the validity changes to valid, it will set the model to the last available valid - * `$modelValue`, i.e. either the last parsed value or the last value set from the scope. - */ - $validate: function() { - - // ignore $validate before model is initialized - if (isNumberNaN(this.$modelValue)) { - return; - } - - var viewValue = this.$$lastCommittedViewValue; - // Note: we use the $$rawModelValue as $modelValue might have been - // set to undefined during a view -> model update that found validation - // errors. We can't parse the view here, since that could change - // the model although neither viewValue nor the model on the scope changed - var modelValue = this.$$rawModelValue; - - var prevValid = this.$valid; - var prevModelValue = this.$modelValue; - - var allowInvalid = this.$options.getOption('allowInvalid'); - - var that = this; - this.$$runValidators(modelValue, viewValue, function(allValid) { - // If there was no change in validity, don't update the model - // This prevents changing an invalid modelValue to undefined - if (!allowInvalid && prevValid !== allValid) { - // Note: Don't check this.$valid here, as we could have - // external validators (e.g. calculated on the server), - // that just call $setValidity and need the model value - // to calculate their validity. - that.$modelValue = allValid ? modelValue : undefined; - - if (that.$modelValue !== prevModelValue) { - that.$$writeModelToScope(); - } - } - }); - }, - - $$runValidators: function(modelValue, viewValue, doneCallback) { - this.$$currentValidationRunId++; - var localValidationRunId = this.$$currentValidationRunId; - var that = this; - - // check parser error - if (!processParseErrors()) { - validationDone(false); - return; - } - if (!processSyncValidators()) { - validationDone(false); - return; - } - processAsyncValidators(); - - function processParseErrors() { - var errorKey = that.$$parserName; - - if (isUndefined(that.$$parserValid)) { - setValidity(errorKey, null); - } else { - if (!that.$$parserValid) { - forEach(that.$validators, function(v, name) { - setValidity(name, null); - }); - forEach(that.$asyncValidators, function(v, name) { - setValidity(name, null); - }); - } - - // Set the parse error last, to prevent unsetting it, should a $validators key == parserName - setValidity(errorKey, that.$$parserValid); - return that.$$parserValid; - } - return true; - } - - function processSyncValidators() { - var syncValidatorsValid = true; - forEach(that.$validators, function(validator, name) { - var result = Boolean(validator(modelValue, viewValue)); - syncValidatorsValid = syncValidatorsValid && result; - setValidity(name, result); - }); - if (!syncValidatorsValid) { - forEach(that.$asyncValidators, function(v, name) { - setValidity(name, null); - }); - return false; - } - return true; - } - - function processAsyncValidators() { - var validatorPromises = []; - var allValid = true; - forEach(that.$asyncValidators, function(validator, name) { - var promise = validator(modelValue, viewValue); - if (!isPromiseLike(promise)) { - throw ngModelMinErr('nopromise', - 'Expected asynchronous validator to return a promise but got \'{0}\' instead.', promise); - } - setValidity(name, undefined); - validatorPromises.push(promise.then(function() { - setValidity(name, true); - }, function() { - allValid = false; - setValidity(name, false); - })); - }); - if (!validatorPromises.length) { - validationDone(true); - } else { - that.$$q.all(validatorPromises).then(function() { - validationDone(allValid); - }, noop); - } - } - - function setValidity(name, isValid) { - if (localValidationRunId === that.$$currentValidationRunId) { - that.$setValidity(name, isValid); - } - } - - function validationDone(allValid) { - if (localValidationRunId === that.$$currentValidationRunId) { - - doneCallback(allValid); - } - } - }, - - /** - * @ngdoc method - * @name ngModel.NgModelController#$commitViewValue - * - * @description - * Commit a pending update to the `$modelValue`. - * - * Updates may be pending by a debounced event or because the input is waiting for a some future - * event defined in `ng-model-options`. this method is rarely needed as `NgModelController` - * usually handles calling this in response to input events. - */ - $commitViewValue: function() { - var viewValue = this.$viewValue; - - this.$$timeout.cancel(this.$$pendingDebounce); - - // If the view value has not changed then we should just exit, except in the case where there is - // a native validator on the element. In this case the validation state may have changed even though - // the viewValue has stayed empty. - if (this.$$lastCommittedViewValue === viewValue && (viewValue !== '' || !this.$$hasNativeValidators)) { - return; - } - this.$$updateEmptyClasses(viewValue); - this.$$lastCommittedViewValue = viewValue; - - // change to dirty - if (this.$pristine) { - this.$setDirty(); - } - this.$$parseAndValidate(); - }, - - $$parseAndValidate: function() { - var viewValue = this.$$lastCommittedViewValue; - var modelValue = viewValue; - var that = this; - - this.$$parserValid = isUndefined(modelValue) ? undefined : true; - - // Reset any previous parse error - this.$setValidity(this.$$parserName, null); - this.$$parserName = 'parse'; - - if (this.$$parserValid) { - for (var i = 0; i < this.$parsers.length; i++) { - modelValue = this.$parsers[i](modelValue); - if (isUndefined(modelValue)) { - this.$$parserValid = false; - break; - } - } - } - if (isNumberNaN(this.$modelValue)) { - // this.$modelValue has not been touched yet... - this.$modelValue = this.$$ngModelGet(this.$$scope); - } - var prevModelValue = this.$modelValue; - var allowInvalid = this.$options.getOption('allowInvalid'); - this.$$rawModelValue = modelValue; - - if (allowInvalid) { - this.$modelValue = modelValue; - writeToModelIfNeeded(); - } - - // Pass the $$lastCommittedViewValue here, because the cached viewValue might be out of date. - // This can happen if e.g. $setViewValue is called from inside a parser - this.$$runValidators(modelValue, this.$$lastCommittedViewValue, function(allValid) { - if (!allowInvalid) { - // Note: Don't check this.$valid here, as we could have - // external validators (e.g. calculated on the server), - // that just call $setValidity and need the model value - // to calculate their validity. - that.$modelValue = allValid ? modelValue : undefined; - writeToModelIfNeeded(); - } - }); - - function writeToModelIfNeeded() { - if (that.$modelValue !== prevModelValue) { - that.$$writeModelToScope(); - } - } - }, - - $$writeModelToScope: function() { - this.$$ngModelSet(this.$$scope, this.$modelValue); - forEach(this.$viewChangeListeners, function(listener) { - try { - listener(); - } catch (e) { - // eslint-disable-next-line no-invalid-this - this.$$exceptionHandler(e); - } - }, this); - }, - - /** - * @ngdoc method - * @name ngModel.NgModelController#$setViewValue - * - * @description - * Update the view value. - * - * This method should be called when a control wants to change the view value; typically, - * this is done from within a DOM event handler. For example, the {@link ng.directive:input input} - * directive calls it when the value of the input changes and {@link ng.directive:select select} - * calls it when an option is selected. - * - * When `$setViewValue` is called, the new `value` will be staged for committing through the `$parsers` - * and `$validators` pipelines. If there are no special {@link ngModelOptions} specified then the staged - * value is sent directly for processing through the `$parsers` pipeline. After this, the `$validators` and - * `$asyncValidators` are called and the value is applied to `$modelValue`. - * Finally, the value is set to the **expression** specified in the `ng-model` attribute and - * all the registered change listeners, in the `$viewChangeListeners` list are called. - * - * In case the {@link ng.directive:ngModelOptions ngModelOptions} directive is used with `updateOn` - * and the `default` trigger is not listed, all those actions will remain pending until one of the - * `updateOn` events is triggered on the DOM element. - * All these actions will be debounced if the {@link ng.directive:ngModelOptions ngModelOptions} - * directive is used with a custom debounce for this particular event. - * Note that a `$digest` is only triggered once the `updateOn` events are fired, or if `debounce` - * is specified, once the timer runs out. - * - * When used with standard inputs, the view value will always be a string (which is in some cases - * parsed into another type, such as a `Date` object for `input[date]`.) - * However, custom controls might also pass objects to this method. In this case, we should make - * a copy of the object before passing it to `$setViewValue`. This is because `ngModel` does not - * perform a deep watch of objects, it only looks for a change of identity. If you only change - * the property of the object then ngModel will not realize that the object has changed and - * will not invoke the `$parsers` and `$validators` pipelines. For this reason, you should - * not change properties of the copy once it has been passed to `$setViewValue`. - * Otherwise you may cause the model value on the scope to change incorrectly. - * - *
    - * In any case, the value passed to the method should always reflect the current value - * of the control. For example, if you are calling `$setViewValue` for an input element, - * you should pass the input DOM value. Otherwise, the control and the scope model become - * out of sync. It's also important to note that `$setViewValue` does not call `$render` or change - * the control's DOM value in any way. If we want to change the control's DOM value - * programmatically, we should update the `ngModel` scope expression. Its new value will be - * picked up by the model controller, which will run it through the `$formatters`, `$render` it - * to update the DOM, and finally call `$validate` on it. - *
    - * - * @param {*} value value from the view. - * @param {string} trigger Event that triggered the update. - */ - $setViewValue: function(value, trigger) { - this.$viewValue = value; - if (this.$options.getOption('updateOnDefault')) { - this.$$debounceViewValueCommit(trigger); - } - }, - - $$debounceViewValueCommit: function(trigger) { - var debounceDelay = this.$options.getOption('debounce'); - - if (isNumber(debounceDelay[trigger])) { - debounceDelay = debounceDelay[trigger]; - } else if (isNumber(debounceDelay['default']) && - this.$options.getOption('updateOn').indexOf(trigger) === -1 - ) { - debounceDelay = debounceDelay['default']; - } else if (isNumber(debounceDelay['*'])) { - debounceDelay = debounceDelay['*']; - } - - this.$$timeout.cancel(this.$$pendingDebounce); - var that = this; - if (debounceDelay > 0) { // this fails if debounceDelay is an object - this.$$pendingDebounce = this.$$timeout(function() { - that.$commitViewValue(); - }, debounceDelay); - } else if (this.$$rootScope.$$phase) { - this.$commitViewValue(); - } else { - this.$$scope.$apply(function() { - that.$commitViewValue(); - }); - } - }, - - /** - * @ngdoc method - * - * @name ngModel.NgModelController#$overrideModelOptions - * - * @description - * - * Override the current model options settings programmatically. - * - * The previous `ModelOptions` value will not be modified. Instead, a - * new `ModelOptions` object will inherit from the previous one overriding - * or inheriting settings that are defined in the given parameter. - * - * See {@link ngModelOptions} for information about what options can be specified - * and how model option inheritance works. - * - *
    - * **Note:** this function only affects the options set on the `ngModelController`, - * and not the options on the {@link ngModelOptions} directive from which they might have been - * obtained initially. - *
    - * - *
    - * **Note:** it is not possible to override the `getterSetter` option. - *
    - * - * @param {Object} options a hash of settings to override the previous options - * - */ - $overrideModelOptions: function(options) { - this.$options = this.$options.createChild(options); - this.$$setUpdateOnEvents(); - }, - - /** - * @ngdoc method - * - * @name ngModel.NgModelController#$processModelValue - - * @description - * - * Runs the model -> view pipeline on the current - * {@link ngModel.NgModelController#$modelValue $modelValue}. - * - * The following actions are performed by this method: - * - * - the `$modelValue` is run through the {@link ngModel.NgModelController#$formatters $formatters} - * and the result is set to the {@link ngModel.NgModelController#$viewValue $viewValue} - * - the `ng-empty` or `ng-not-empty` class is set on the element - * - if the `$viewValue` has changed: - * - {@link ngModel.NgModelController#$render $render} is called on the control - * - the {@link ngModel.NgModelController#$validators $validators} are run and - * the validation status is set. - * - * This method is called by ngModel internally when the bound scope value changes. - * Application developers usually do not have to call this function themselves. - * - * This function can be used when the `$viewValue` or the rendered DOM value are not correctly - * formatted and the `$modelValue` must be run through the `$formatters` again. - * - * @example - * Consider a text input with an autocomplete list (for fruit), where the items are - * objects with a name and an id. - * A user enters `ap` and then selects `Apricot` from the list. - * Based on this, the autocomplete widget will call `$setViewValue({name: 'Apricot', id: 443})`, - * but the rendered value will still be `ap`. - * The widget can then call `ctrl.$processModelValue()` to run the model -> view - * pipeline again, which formats the object to the string `Apricot`, - * then updates the `$viewValue`, and finally renders it in the DOM. - * - * - -
    -
    - Search Fruit: - -
    -
    - Model:
    -
    {{selectedFruit | json}}
    -
    -
    -
    - - angular.module('inputExample', []) - .controller('inputController', function($scope) { - $scope.items = [ - {name: 'Apricot', id: 443}, - {name: 'Clementine', id: 972}, - {name: 'Durian', id: 169}, - {name: 'Jackfruit', id: 982}, - {name: 'Strawberry', id: 863} - ]; - }) - .component('basicAutocomplete', { - bindings: { - items: '<', - onSelect: '&' - }, - templateUrl: 'autocomplete.html', - controller: function($element, $scope) { - var that = this; - var ngModel; - - that.$postLink = function() { - ngModel = $element.find('input').controller('ngModel'); - - ngModel.$formatters.push(function(value) { - return (value && value.name) || value; - }); - - ngModel.$parsers.push(function(value) { - var match = value; - for (var i = 0; i < that.items.length; i++) { - if (that.items[i].name === value) { - match = that.items[i]; - break; - } - } - - return match; - }); - }; - - that.selectItem = function(item) { - ngModel.$setViewValue(item); - ngModel.$processModelValue(); - that.onSelect({item: item}); - }; - } - }); - - -
    - -
      -
    • - -
    • -
    -
    -
    - *
    - * - */ - $processModelValue: function() { - var viewValue = this.$$format(); - - if (this.$viewValue !== viewValue) { - this.$$updateEmptyClasses(viewValue); - this.$viewValue = this.$$lastCommittedViewValue = viewValue; - this.$render(); - // It is possible that model and view value have been updated during render - this.$$runValidators(this.$modelValue, this.$viewValue, noop); - } - }, - - /** - * This method is called internally to run the $formatters on the $modelValue - */ - $$format: function() { - var formatters = this.$formatters, - idx = formatters.length; - - var viewValue = this.$modelValue; - while (idx--) { - viewValue = formatters[idx](viewValue); - } - - return viewValue; - }, - - /** - * This method is called internally when the bound scope value changes. - */ - $$setModelValue: function(modelValue) { - this.$modelValue = this.$$rawModelValue = modelValue; - this.$$parserValid = undefined; - this.$processModelValue(); - }, - - $$setUpdateOnEvents: function() { - if (this.$$updateEvents) { - this.$$element.off(this.$$updateEvents, this.$$updateEventHandler); - } - - this.$$updateEvents = this.$options.getOption('updateOn'); - if (this.$$updateEvents) { - this.$$element.on(this.$$updateEvents, this.$$updateEventHandler); - } - }, - - $$updateEventHandler: function(ev) { - this.$$debounceViewValueCommit(ev && ev.type); - } -}; - -function setupModelWatcher(ctrl) { - // model -> value - // Note: we cannot use a normal scope.$watch as we want to detect the following: - // 1. scope value is 'a' - // 2. user enters 'b' - // 3. ng-change kicks in and reverts scope value to 'a' - // -> scope value did not change since the last digest as - // ng-change executes in apply phase - // 4. view should be changed back to 'a' - ctrl.$$scope.$watch(function ngModelWatch(scope) { - var modelValue = ctrl.$$ngModelGet(scope); - - // if scope model value and ngModel value are out of sync - // This cannot be moved to the action function, because it would not catch the - // case where the model is changed in the ngChange function or the model setter - if (modelValue !== ctrl.$modelValue && - // checks for NaN is needed to allow setting the model to NaN when there's an asyncValidator - // eslint-disable-next-line no-self-compare - (ctrl.$modelValue === ctrl.$modelValue || modelValue === modelValue) - ) { - ctrl.$$setModelValue(modelValue); - } - - return modelValue; - }); -} - -/** - * @ngdoc method - * @name ngModel.NgModelController#$setValidity - * - * @description - * Change the validity state, and notify the form. - * - * This method can be called within $parsers/$formatters or a custom validation implementation. - * However, in most cases it should be sufficient to use the `ngModel.$validators` and - * `ngModel.$asyncValidators` collections which will call `$setValidity` automatically. - * - * @param {string} validationErrorKey Name of the validator. The `validationErrorKey` will be assigned - * to either `$error[validationErrorKey]` or `$pending[validationErrorKey]` - * (for unfulfilled `$asyncValidators`), so that it is available for data-binding. - * The `validationErrorKey` should be in camelCase and will get converted into dash-case - * for class name. Example: `myError` will result in `ng-valid-my-error` and `ng-invalid-my-error` - * classes and can be bound to as `{{ someForm.someControl.$error.myError }}`. - * @param {boolean} isValid Whether the current state is valid (true), invalid (false), pending (undefined), - * or skipped (null). Pending is used for unfulfilled `$asyncValidators`. - * Skipped is used by AngularJS when validators do not run because of parse errors and - * when `$asyncValidators` do not run because any of the `$validators` failed. - */ -addSetValidityMethod({ - clazz: NgModelController, - set: function(object, property) { - object[property] = true; - }, - unset: function(object, property) { - delete object[property]; - } -}); - - -/** - * @ngdoc directive - * @name ngModel - * @restrict A - * @priority 1 - * @param {expression} ngModel assignable {@link guide/expression Expression} to bind to. - * - * @description - * The `ngModel` directive binds an `input`,`select`, `textarea` (or custom form control) to a - * property on the scope using {@link ngModel.NgModelController NgModelController}, - * which is created and exposed by this directive. - * - * `ngModel` is responsible for: - * - * - Binding the view into the model, which other directives such as `input`, `textarea` or `select` - * require. - * - Providing validation behavior (i.e. required, number, email, url). - * - Keeping the state of the control (valid/invalid, dirty/pristine, touched/untouched, validation errors). - * - Setting related css classes on the element (`ng-valid`, `ng-invalid`, `ng-dirty`, `ng-pristine`, `ng-touched`, - * `ng-untouched`, `ng-empty`, `ng-not-empty`) including animations. - * - Registering the control with its parent {@link ng.directive:form form}. - * - * Note: `ngModel` will try to bind to the property given by evaluating the expression on the - * current scope. If the property doesn't already exist on this scope, it will be created - * implicitly and added to the scope. - * - * For best practices on using `ngModel`, see: - * - * - [Understanding Scopes](https://github.com/angular/angular.js/wiki/Understanding-Scopes) - * - * For basic examples, how to use `ngModel`, see: - * - * - {@link ng.directive:input input} - * - {@link input[text] text} - * - {@link input[checkbox] checkbox} - * - {@link input[radio] radio} - * - {@link input[number] number} - * - {@link input[email] email} - * - {@link input[url] url} - * - {@link input[date] date} - * - {@link input[datetime-local] datetime-local} - * - {@link input[time] time} - * - {@link input[month] month} - * - {@link input[week] week} - * - {@link ng.directive:select select} - * - {@link ng.directive:textarea textarea} - * - * ## Complex Models (objects or collections) - * - * By default, `ngModel` watches the model by reference, not value. This is important to know when - * binding inputs to models that are objects (e.g. `Date`) or collections (e.g. arrays). If only properties of the - * object or collection change, `ngModel` will not be notified and so the input will not be re-rendered. - * - * The model must be assigned an entirely new object or collection before a re-rendering will occur. - * - * Some directives have options that will cause them to use a custom `$watchCollection` on the model expression - * - for example, `ngOptions` will do so when a `track by` clause is included in the comprehension expression or - * if the select is given the `multiple` attribute. - * - * The `$watchCollection()` method only does a shallow comparison, meaning that changing properties deeper than the - * first level of the object (or only changing the properties of an item in the collection if it's an array) will still - * not trigger a re-rendering of the model. - * - * ## CSS classes - * The following CSS classes are added and removed on the associated input/select/textarea element - * depending on the validity of the model. - * - * - `ng-valid`: the model is valid - * - `ng-invalid`: the model is invalid - * - `ng-valid-[key]`: for each valid key added by `$setValidity` - * - `ng-invalid-[key]`: for each invalid key added by `$setValidity` - * - `ng-pristine`: the control hasn't been interacted with yet - * - `ng-dirty`: the control has been interacted with - * - `ng-touched`: the control has been blurred - * - `ng-untouched`: the control hasn't been blurred - * - `ng-pending`: any `$asyncValidators` are unfulfilled - * - `ng-empty`: the view does not contain a value or the value is deemed "empty", as defined - * by the {@link ngModel.NgModelController#$isEmpty} method - * - `ng-not-empty`: the view contains a non-empty value - * - * Keep in mind that ngAnimate can detect each of these classes when added and removed. - * - * @animations - * Animations within models are triggered when any of the associated CSS classes are added and removed - * on the input element which is attached to the model. These classes include: `.ng-pristine`, `.ng-dirty`, - * `.ng-invalid` and `.ng-valid` as well as any other validations that are performed on the model itself. - * The animations that are triggered within ngModel are similar to how they work in ngClass and - * animations can be hooked into using CSS transitions, keyframes as well as JS animations. - * - * The following example shows a simple way to utilize CSS transitions to style an input element - * that has been rendered as invalid after it has been validated: - * - *
    - * //be sure to include ngAnimate as a module to hook into more
    - * //advanced animations
    - * .my-input {
    - *   transition:0.5s linear all;
    - *   background: white;
    - * }
    - * .my-input.ng-invalid {
    - *   background: red;
    - *   color:white;
    - * }
    - * 
    - * - * @example - * ### Basic Usage - * - - - -

    - Update input to see transitions when valid/invalid. - Integer is a valid value. -

    -
    - -
    -
    - *
    - * - * @example - * ### Binding to a getter/setter - * - * Sometimes it's helpful to bind `ngModel` to a getter/setter function. A getter/setter is a - * function that returns a representation of the model when called with zero arguments, and sets - * the internal state of a model when called with an argument. It's sometimes useful to use this - * for models that have an internal representation that's different from what the model exposes - * to the view. - * - *
    - * **Best Practice:** It's best to keep getters fast because AngularJS is likely to call them more - * frequently than other parts of your code. - *
    - * - * You use this behavior by adding `ng-model-options="{ getterSetter: true }"` to an element that - * has `ng-model` attached to it. You can also add `ng-model-options="{ getterSetter: true }"` to - * a `
    `, which will enable this behavior for all ``s within it. See - * {@link ng.directive:ngModelOptions `ngModelOptions`} for more. - * - * The following example shows how to use `ngModel` with a getter/setter: - * - * @example - * - -
    - - - -
    user.name = 
    -
    -
    - - angular.module('getterSetterExample', []) - .controller('ExampleController', ['$scope', function($scope) { - var _name = 'Brian'; - $scope.user = { - name: function(newName) { - // Note that newName can be undefined for two reasons: - // 1. Because it is called as a getter and thus called with no arguments - // 2. Because the property should actually be set to undefined. This happens e.g. if the - // input is invalid - return arguments.length ? (_name = newName) : _name; - } - }; - }]); - - *
    - */ -var ngModelDirective = ['$rootScope', function($rootScope) { - return { - restrict: 'A', - require: ['ngModel', '^?form', '^?ngModelOptions'], - controller: NgModelController, - // Prelink needs to run before any input directive - // so that we can set the NgModelOptions in NgModelController - // before anyone else uses it. - priority: 1, - compile: function ngModelCompile(element) { - // Setup initial state of the control - element.addClass(PRISTINE_CLASS).addClass(UNTOUCHED_CLASS).addClass(VALID_CLASS); - - return { - pre: function ngModelPreLink(scope, element, attr, ctrls) { - var modelCtrl = ctrls[0], - formCtrl = ctrls[1] || modelCtrl.$$parentForm, - optionsCtrl = ctrls[2]; - - if (optionsCtrl) { - modelCtrl.$options = optionsCtrl.$options; - } - - modelCtrl.$$initGetterSetters(); - - // notify others, especially parent forms - formCtrl.$addControl(modelCtrl); - - attr.$observe('name', function(newValue) { - if (modelCtrl.$name !== newValue) { - modelCtrl.$$parentForm.$$renameControl(modelCtrl, newValue); - } - }); - - scope.$on('$destroy', function() { - modelCtrl.$$parentForm.$removeControl(modelCtrl); - }); - }, - post: function ngModelPostLink(scope, element, attr, ctrls) { - var modelCtrl = ctrls[0]; - modelCtrl.$$setUpdateOnEvents(); - - function setTouched() { - modelCtrl.$setTouched(); - } - - element.on('blur', function() { - if (modelCtrl.$touched) return; - - if ($rootScope.$$phase) { - scope.$evalAsync(setTouched); - } else { - scope.$apply(setTouched); - } - }); - } - }; - } - }; -}]; - -/* exported defaultModelOptions */ -var defaultModelOptions; -var DEFAULT_REGEXP = /(\s+|^)default(\s+|$)/; - -/** - * @ngdoc type - * @name ModelOptions - * @description - * A container for the options set by the {@link ngModelOptions} directive - */ -function ModelOptions(options) { - this.$$options = options; -} - -ModelOptions.prototype = { - - /** - * @ngdoc method - * @name ModelOptions#getOption - * @param {string} name the name of the option to retrieve - * @returns {*} the value of the option - * @description - * Returns the value of the given option - */ - getOption: function(name) { - return this.$$options[name]; - }, - - /** - * @ngdoc method - * @name ModelOptions#createChild - * @param {Object} options a hash of options for the new child that will override the parent's options - * @return {ModelOptions} a new `ModelOptions` object initialized with the given options. - */ - createChild: function(options) { - var inheritAll = false; - - // make a shallow copy - options = extend({}, options); - - // Inherit options from the parent if specified by the value `"$inherit"` - forEach(options, /** @this */ function(option, key) { - if (option === '$inherit') { - if (key === '*') { - inheritAll = true; - } else { - options[key] = this.$$options[key]; - // `updateOn` is special so we must also inherit the `updateOnDefault` option - if (key === 'updateOn') { - options.updateOnDefault = this.$$options.updateOnDefault; - } - } - } else { - if (key === 'updateOn') { - // If the `updateOn` property contains the `default` event then we have to remove - // it from the event list and set the `updateOnDefault` flag. - options.updateOnDefault = false; - options[key] = trim(option.replace(DEFAULT_REGEXP, function() { - options.updateOnDefault = true; - return ' '; - })); - } - } - }, this); - - if (inheritAll) { - // We have a property of the form: `"*": "$inherit"` - delete options['*']; - defaults(options, this.$$options); - } - - // Finally add in any missing defaults - defaults(options, defaultModelOptions.$$options); - - return new ModelOptions(options); - } -}; - - -defaultModelOptions = new ModelOptions({ - updateOn: '', - updateOnDefault: true, - debounce: 0, - getterSetter: false, - allowInvalid: false, - timezone: null -}); - - -/** - * @ngdoc directive - * @name ngModelOptions - * @restrict A - * @priority 10 - * - * @description - * This directive allows you to modify the behaviour of {@link ngModel} directives within your - * application. You can specify an `ngModelOptions` directive on any element. All {@link ngModel} - * directives will use the options of their nearest `ngModelOptions` ancestor. - * - * The `ngModelOptions` settings are found by evaluating the value of the attribute directive as - * an AngularJS expression. This expression should evaluate to an object, whose properties contain - * the settings. For example: `
    - *
    - * - *
    - *
    - * ``` - * - * the `input` element will have the following settings - * - * ```js - * { allowInvalid: true, updateOn: 'default', debounce: 0 } - * ``` - * - * Notice that the `debounce` setting was not inherited and used the default value instead. - * - * You can specify that all undefined settings are automatically inherited from an ancestor by - * including a property with key of `"*"` and value of `"$inherit"`. - * - * For example given the following fragment of HTML - * - * - * ```html - *
    - *
    - * - *
    - *
    - * ``` - * - * the `input` element will have the following settings - * - * ```js - * { allowInvalid: true, updateOn: 'default', debounce: 200 } - * ``` - * - * Notice that the `debounce` setting now inherits the value from the outer `
    ` element. - * - * If you are creating a reusable component then you should be careful when using `"*": "$inherit"` - * since you may inadvertently inherit a setting in the future that changes the behavior of your component. - * - * - * ## Triggering and debouncing model updates - * - * The `updateOn` and `debounce` properties allow you to specify a custom list of events that will - * trigger a model update and/or a debouncing delay so that the actual update only takes place when - * a timer expires; this timer will be reset after another change takes place. - * - * Given the nature of `ngModelOptions`, the value displayed inside input fields in the view might - * be different from the value in the actual model. This means that if you update the model you - * should also invoke {@link ngModel.NgModelController#$rollbackViewValue} on the relevant input field in - * order to make sure it is synchronized with the model and that any debounced action is canceled. - * - * The easiest way to reference the control's {@link ngModel.NgModelController#$rollbackViewValue} - * method is by making sure the input is placed inside a form that has a `name` attribute. This is - * important because `form` controllers are published to the related scope under the name in their - * `name` attribute. - * - * Any pending changes will take place immediately when an enclosing form is submitted via the - * `submit` event. Note that `ngClick` events will occur before the model is updated. Use `ngSubmit` - * to have access to the updated model. - * - * ### Overriding immediate updates - * - * The following example shows how to override immediate updates. Changes on the inputs within the - * form will update the model only when the control loses focus (blur event). If `escape` key is - * pressed while the input field is focused, the value is reset to the value in the current model. - * - * - * - *
    - *
    - *
    - *
    - *
    - *
    user.name = 
    - *
    - *
    - * - * angular.module('optionsExample', []) - * .controller('ExampleController', ['$scope', function($scope) { - * $scope.user = { name: 'say', data: '' }; - * - * $scope.cancel = function(e) { - * if (e.keyCode === 27) { - * $scope.userForm.userName.$rollbackViewValue(); - * } - * }; - * }]); - * - * - * var model = element(by.binding('user.name')); - * var input = element(by.model('user.name')); - * var other = element(by.model('user.data')); - * - * it('should allow custom events', function() { - * input.sendKeys(' hello'); - * input.click(); - * expect(model.getText()).toEqual('say'); - * other.click(); - * expect(model.getText()).toEqual('say hello'); - * }); - * - * it('should $rollbackViewValue when model changes', function() { - * input.sendKeys(' hello'); - * expect(input.getAttribute('value')).toEqual('say hello'); - * input.sendKeys(protractor.Key.ESCAPE); - * expect(input.getAttribute('value')).toEqual('say'); - * other.click(); - * expect(model.getText()).toEqual('say'); - * }); - * - *
    - * - * ### Debouncing updates - * - * The next example shows how to debounce model changes. Model will be updated only 1 sec after last change. - * If the `Clear` button is pressed, any debounced action is canceled and the value becomes empty. - * - * - * - *
    - *
    - * Name: - * - *
    - *
    - *
    user.name = 
    - *
    - *
    - * - * angular.module('optionsExample', []) - * .controller('ExampleController', ['$scope', function($scope) { - * $scope.user = { name: 'say' }; - * }]); - * - *
    - * - * ### Default events, extra triggers, and catch-all debounce values - * - * This example shows the relationship between "default" update events and - * additional `updateOn` triggers. - * - * `default` events are those that are bound to the control, and when fired, update the `$viewValue` - * via {@link ngModel.NgModelController#$setViewValue $setViewValue}. Every event that is not listed - * in `updateOn` is considered a "default" event, since different control types have different - * default events. - * - * The control in this example updates by "default", "click", and "blur", with different `debounce` - * values. You can see that "click" doesn't have an individual `debounce` value - - * therefore it uses the `*` debounce value. - * - * There is also a button that calls {@link ngModel.NgModelController#$setViewValue $setViewValue} - * directly with a "custom" event. Since "custom" is not defined in the `updateOn` list, - * it is considered a "default" event and will update the - * control if "default" is defined in `updateOn`, and will receive the "default" debounce value. - * Note that this is just to illustrate how custom controls would possibly call `$setViewValue`. - * - * You can change the `updateOn` and `debounce` configuration to test different scenarios. This - * is done with {@link ngModel.NgModelController#$overrideModelOptions $overrideModelOptions}. - * - - - - - - angular.module('optionsExample', []) - .component('modelUpdateDemo', { - templateUrl: 'template.html', - controller: function() { - this.name = 'Chinua'; - - this.options = { - updateOn: 'default blur click', - debounce: { - default: 2000, - blur: 0, - '*': 1000 - } - }; - - this.updateEvents = function() { - var eventList = this.options.updateOn.split(' '); - eventList.push('*'); - var events = {}; - - for (var i = 0; i < eventList.length; i++) { - events[eventList[i]] = this.options.debounce[eventList[i]]; - } - - this.events = events; - }; - - this.updateOptions = function() { - var options = angular.extend(this.options, { - updateOn: Object.keys(this.events).join(' ').replace('*', ''), - debounce: this.events - }); - - this.form.input.$overrideModelOptions(options); - }; - - // Initialize the event form - this.updateEvents(); - } - }); - - -
    - Input: -
    - Model: {{$ctrl.name}} -
    - - -
    -
    - updateOn
    - - - - - - - - - - - -
    OptionDebounce value
    {{key}}
    - -
    - -
    -
    -
    - * - * - * ## Model updates and validation - * - * The default behaviour in `ngModel` is that the model value is set to `undefined` when the - * validation determines that the value is invalid. By setting the `allowInvalid` property to true, - * the model will still be updated even if the value is invalid. - * - * - * ## Connecting to the scope - * - * By setting the `getterSetter` property to true you are telling ngModel that the `ngModel` expression - * on the scope refers to a "getter/setter" function rather than the value itself. - * - * The following example shows how to bind to getter/setters: - * - * - * - *
    - *
    - * - *
    - *
    user.name = 
    - *
    - *
    - * - * angular.module('getterSetterExample', []) - * .controller('ExampleController', ['$scope', function($scope) { - * var _name = 'Brian'; - * $scope.user = { - * name: function(newName) { - * return angular.isDefined(newName) ? (_name = newName) : _name; - * } - * }; - * }]); - * - *
    - * - * - * ## Programmatically changing options - * - * The `ngModelOptions` expression is only evaluated once when the directive is linked; it is not - * watched for changes. However, it is possible to override the options on a single - * {@link ngModel.NgModelController} instance with - * {@link ngModel.NgModelController#$overrideModelOptions `NgModelController#$overrideModelOptions()`}. - * See also the example for - * {@link ngModelOptions#default-events-extra-triggers-and-catch-all-debounce-values - * Default events, extra triggers, and catch-all debounce values}. - * - * - * ## Specifying timezones - * - * You can specify the timezone that date/time input directives expect by providing its name in the - * `timezone` property. - * - * - * ## Formatting the value of `time` and `datetime-local` - * - * With the options `timeSecondsFormat` and `timeStripZeroSeconds` it is possible to adjust the value - * that is displayed in the control. Note that browsers may apply their own formatting - * in the user interface. - * - - - - - - angular.module('timeExample', []) - .component('timeExample', { - templateUrl: 'timeExample.html', - controller: function() { - this.time = new Date(1970, 0, 1, 14, 57, 0); - - this.options = { - timeSecondsFormat: 'ss', - timeStripZeroSeconds: true - }; - - this.optionChange = function() { - this.timeForm.timeFormatted.$overrideModelOptions(this.options); - this.time = new Date(this.time); - }; - } - }); - - -
    - Default: -
    - With options: - -
    - - Options:
    - timeSecondsFormat: - -
    - timeStripZeroSeconds: - -
    -
    - *
    - * - * @param {Object} ngModelOptions options to apply to {@link ngModel} directives on this element and - * and its descendents. - * - * **General options**: - * - * - `updateOn`: string specifying which event should the input be bound to. You can set several - * events using an space delimited list. There is a special event called `default` that - * matches the default events belonging to the control. These are the events that are bound to - * the control, and when fired, update the `$viewValue` via `$setViewValue`. - * - * `ngModelOptions` considers every event that is not listed in `updateOn` a "default" event, - * since different control types use different default events. - * - * See also the section {@link ngModelOptions#triggering-and-debouncing-model-updates - * Triggering and debouncing model updates}. - * - * - `debounce`: integer value which contains the debounce model update value in milliseconds. A - * value of 0 triggers an immediate update. If an object is supplied instead, you can specify a - * custom value for each event. For example: - * ``` - * ng-model-options="{ - * updateOn: 'default blur', - * debounce: { 'default': 500, 'blur': 0 } - * }" - * ``` - * You can use the `*` key to specify a debounce value that applies to all events that are not - * specifically listed. In the following example, `mouseup` would have a debounce delay of 1000: - * ``` - * ng-model-options="{ - * updateOn: 'default blur mouseup', - * debounce: { 'default': 500, 'blur': 0, '*': 1000 } - * }" - * ``` - * - `allowInvalid`: boolean value which indicates that the model can be set with values that did - * not validate correctly instead of the default behavior of setting the model to undefined. - * - `getterSetter`: boolean value which determines whether or not to treat functions bound to - * `ngModel` as getters/setters. - * - * - * **Input-type specific options**: - * - * - `timezone`: Defines the timezone to be used to read/write the `Date` instance in the model for - * ``, ``, ... . It understands UTC/GMT and the - * continental US time zone abbreviations, but for general use, use a time zone offset, for - * example, `'+0430'` (4 hours, 30 minutes east of the Greenwich meridian) - * If not specified, the timezone of the browser will be used. - * Note that changing the timezone will have no effect on the current date, and is only applied after - * the next input / model change. - * - * - `timeSecondsFormat`: Defines if the `time` and `datetime-local` types should show seconds and - * milliseconds. The option follows the format string of {@link date date filter}. - * By default, the options is `undefined` which is equal to `'ss.sss'` (seconds and milliseconds). - * The other options are `'ss'` (strips milliseconds), and `''` (empty string), which strips both - * seconds and milliseconds. - * Note that browsers that support `time` and `datetime-local` require the hour and minutes - * part of the time string, and may show the value differently in the user interface. - * {@link ngModelOptions#formatting-the-value-of-time-and-datetime-local- See the example}. - * - * - `timeStripZeroSeconds`: Defines if the `time` and `datetime-local` types should strip the - * seconds and milliseconds from the formatted value if they are zero. This option is applied - * after `timeSecondsFormat`. - * This option can be used to make the formatting consistent over different browsers, as some - * browsers with support for `time` will natively hide the milliseconds and - * seconds if they are zero, but others won't, and browsers that don't implement these input - * types will always show the full string. - * {@link ngModelOptions#formatting-the-value-of-time-and-datetime-local- See the example}. - * - */ -var ngModelOptionsDirective = function() { - NgModelOptionsController.$inject = ['$attrs', '$scope']; - function NgModelOptionsController($attrs, $scope) { - this.$$attrs = $attrs; - this.$$scope = $scope; - } - NgModelOptionsController.prototype = { - $onInit: function() { - var parentOptions = this.parentCtrl ? this.parentCtrl.$options : defaultModelOptions; - var modelOptionsDefinition = this.$$scope.$eval(this.$$attrs.ngModelOptions); - - this.$options = parentOptions.createChild(modelOptionsDefinition); - } - }; - - return { - restrict: 'A', - // ngModelOptions needs to run before ngModel and input directives - priority: 10, - require: {parentCtrl: '?^^ngModelOptions'}, - bindToController: true, - controller: NgModelOptionsController - }; -}; - - -// shallow copy over values from `src` that are not already specified on `dst` -function defaults(dst, src) { - forEach(src, function(value, key) { - if (!isDefined(dst[key])) { - dst[key] = value; - } - }); -} - -/** - * @ngdoc directive - * @name ngNonBindable - * @restrict AC - * @priority 1000 - * @element ANY - * - * @description - * The `ngNonBindable` directive tells AngularJS not to compile or bind the contents of the current - * DOM element, including directives on the element itself that have a lower priority than - * `ngNonBindable`. This is useful if the element contains what appears to be AngularJS directives - * and bindings but which should be ignored by AngularJS. This could be the case if you have a site - * that displays snippets of code, for instance. - * - * @example - * In this example there are two locations where a simple interpolation binding (`{{}}`) is present, - * but the one wrapped in `ngNonBindable` is left alone. - * - - -
    Normal: {{1 + 2}}
    -
    Ignored: {{1 + 2}}
    -
    - - it('should check ng-non-bindable', function() { - expect(element(by.binding('1 + 2')).getText()).toContain('3'); - expect(element.all(by.css('div')).last().getText()).toMatch(/1 \+ 2/); - }); - -
    - */ -var ngNonBindableDirective = ngDirective({ terminal: true, priority: 1000 }); - -/* exported ngOptionsDirective */ - -/* global jqLiteRemove */ - -var ngOptionsMinErr = minErr('ngOptions'); - -/** - * @ngdoc directive - * @name ngOptions - * @restrict A - * - * @description - * - * The `ngOptions` attribute can be used to dynamically generate a list of `` - * DOM element. - * * `disable`: The result of this expression will be used to disable the rendered `
    ").append(a).html();try{return a[0].nodeType===Pa?K(b):b.match(/^(<[^>]+>)/)[1].replace(/^<([\w-]+)/,function(a,b){return"<"+K(b)})}catch(d){return K(b)}}function Tc(a){try{return decodeURIComponent(a)}catch(b){}}function gc(a){var b={};r((a||"").split("&"), -function(a){var c,e,f;a&&(e=a=a.replace(/\+/g,"%20"),c=a.indexOf("="),-1!==c&&(e=a.substring(0,c),f=a.substring(c+1)),e=Tc(e),w(e)&&(f=w(f)?Tc(f):!0,ta.call(b,e)?H(b[e])?b[e].push(f):b[e]=[b[e],f]:b[e]=f))});return b}function ye(a){var b=[];r(a,function(a,c){H(a)?r(a,function(a){b.push(ba(c,!0)+(!0===a?"":"="+ba(a,!0)))}):b.push(ba(c,!0)+(!0===a?"":"="+ba(a,!0)))});return b.length?b.join("&"):""}function hc(a){return ba(a,!0).replace(/%26/gi,"&").replace(/%3D/gi,"=").replace(/%2B/gi,"+")}function ba(a, -b){return encodeURIComponent(a).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%3B/gi,";").replace(/%20/g,b?"%20":"+")}function ze(a,b){var d,c,e=Qa.length;for(c=0;c protocol indicates an extension, document.location.href does not match."))}function Uc(a,b,d){D(d)||(d={});d=S({strictDi:!1},d);var c=function(){a=x(a);if(a.injector()){var c=a[0]===C.document?"document":za(a);throw pa("btstrpd",c.replace(//,">"));}b=b||[];b.unshift(["$provide",function(b){b.value("$rootElement",a)}]);d.debugInfoEnabled&&b.push(["$compileProvider", -function(a){a.debugInfoEnabled(!0)}]);b.unshift("ng");c=fb(b,d.strictDi);c.invoke(["$rootScope","$rootElement","$compile","$injector",function(a,b,c,d){a.$apply(function(){b.data("$injector",d);c(b)(a)})}]);return c},e=/^NG_ENABLE_DEBUG_INFO!/,f=/^NG_DEFER_BOOTSTRAP!/;C&&e.test(C.name)&&(d.debugInfoEnabled=!0,C.name=C.name.replace(e,""));if(C&&!f.test(C.name))return c();C.name=C.name.replace(f,"");ca.resumeBootstrap=function(a){r(a,function(a){b.push(a)});return c()};B(ca.resumeDeferredBootstrap)&& -ca.resumeDeferredBootstrap()}function Ce(){C.name="NG_ENABLE_DEBUG_INFO!"+C.name;C.location.reload()}function De(a){a=ca.element(a).injector();if(!a)throw pa("test");return a.get("$$testability")}function Vc(a,b){b=b||"_";return a.replace(Ee,function(a,c){return(c?b:"")+a.toLowerCase()})}function Fe(){var a;if(!Wc){var b=qb();(rb=z(b)?C.jQuery:b?C[b]:void 0)&&rb.fn.on?(x=rb,S(rb.fn,{scope:Wa.scope,isolateScope:Wa.isolateScope,controller:Wa.controller,injector:Wa.injector,inheritedData:Wa.inheritedData})): -x=Y;a=x.cleanData;x.cleanData=function(b){for(var c,e=0,f;null!=(f=b[e]);e++)(c=(x._data(f)||{}).events)&&c.$destroy&&x(f).triggerHandler("$destroy");a(b)};ca.element=x;Wc=!0}}function gb(a,b,d){if(!a)throw pa("areq",b||"?",d||"required");return a}function sb(a,b,d){d&&H(a)&&(a=a[a.length-1]);gb(B(a),b,"not a function, got "+(a&&"object"===typeof a?a.constructor.name||"Object":typeof a));return a}function Ja(a,b){if("hasOwnProperty"===a)throw pa("badname",b);}function Ge(a,b,d){if(!b)return a;b=b.split("."); -for(var c,e=a,f=b.length,g=0;g")+c[2];for(c=c[0];c--;)d=d.lastChild;f=db(f,d.childNodes);d=e.firstChild;d.textContent=""}else f.push(b.createTextNode(a));e.textContent="";e.innerHTML="";r(f,function(a){e.appendChild(a)});return e}function Y(a){if(a instanceof Y)return a;var b;A(a)&&(a=U(a),b=!0);if(!(this instanceof Y)){if(b&&"<"!==a.charAt(0))throw nc("nosel");return new Y(a)}if(b){b= -C.document;var d;a=(d=og.exec(a))?[b.createElement(d[1])]:(d=ed(a,b))?d.childNodes:[];oc(this,a)}else B(a)?fd(a):oc(this,a)}function pc(a){return a.cloneNode(!0)}function yb(a,b){!b&&lc(a)&&x.cleanData([a]);a.querySelectorAll&&x.cleanData(a.querySelectorAll("*"))}function gd(a){for(var b in a)return!1;return!0}function hd(a){var b=a.ng339,d=b&&Ka[b],c=d&&d.events,d=d&&d.data;d&&!gd(d)||c&&!gd(c)||(delete Ka[b],a.ng339=void 0)}function id(a,b,d,c){if(w(c))throw nc("offargs");var e=(c=zb(a))&&c.events, -f=c&&c.handle;if(f){if(b){var g=function(b){var c=e[b];w(d)&&cb(c||[],d);w(d)&&c&&0l&&this.remove(n.key);return b}},get:function(a){if(l";b=Fa.firstChild.attributes;var d=b[0];b.removeNamedItem(d.name);d.value=c;a.attributes.setNamedItem(d)}function sa(a,b){try{a.addClass(b)}catch(c){}} -function da(a,b,c,d,e){a instanceof x||(a=x(a));var f=Xa(a,b,a,c,d,e);da.$$addScopeClass(a);var g=null;return function(b,c,d){if(!a)throw $("multilink");gb(b,"scope");e&&e.needsNewScope&&(b=b.$parent.$new());d=d||{};var h=d.parentBoundTranscludeFn,k=d.transcludeControllers;d=d.futureParentElement;h&&h.$$boundTransclude&&(h=h.$$boundTransclude);g||(g=(d=d&&d[0])?"foreignobject"!==ua(d)&&la.call(d).match(/SVG/)?"svg":"html":"html");d="html"!==g?x(ja(g,x("
    ").append(a).html())):c?Wa.clone.call(a): -a;if(k)for(var l in k)d.data("$"+l+"Controller",k[l].instance);da.$$addScopeInfo(d,b);c&&c(d,b);f&&f(b,d,d,h);c||(a=f=null);return d}}function Xa(a,b,c,d,e,f){function g(a,c,d,e){var f,k,l,m,p,I,t;if(n)for(t=Array(c.length),m=0;mu.priority)break;if(O=u.scope)u.templateUrl||(D(O)?(ba("new/isolated scope",s||t,u,y),s=u):ba("new/isolated scope",s,u,y)),t=t||u;Q=u.name;if(!ma&&(u.replace&&(u.templateUrl||u.template)||u.transclude&&!u.$$tlb)){for(O=sa+1;ma=a[O++];)if(ma.transclude&&!ma.$$tlb||ma.replace&&(ma.templateUrl||ma.template)){Ib=!0;break}ma=!0}!u.templateUrl&&u.controller&&(J=J||T(),ba("'"+Q+"' controller", -J[Q],u,y),J[Q]=u);if(O=u.transclude)if(G=!0,u.$$tlb||(ba("transclusion",L,u,y),L=u),"element"===O)N=!0,n=u.priority,M=y,y=d.$$element=x(da.$$createComment(Q,d[Q])),b=y[0],pa(f,Ha.call(M,0),b),R=Z(Ib,M,e,n,g&&g.name,{nonTlbTranscludeDirective:L});else{var ka=T();if(D(O)){M=C.document.createDocumentFragment();var Xa=T(),F=T();r(O,function(a,b){var c="?"===a.charAt(0);a=c?a.substring(1):a;Xa[a]=b;ka[b]=null;F[b]=c});r(y.contents(),function(a){var b=Xa[wa(ua(a))];b?(F[b]=!0,ka[b]=ka[b]||C.document.createDocumentFragment(), -ka[b].appendChild(a)):M.appendChild(a)});r(F,function(a,b){if(!a)throw $("reqslot",b);});for(var K in ka)ka[K]&&(R=x(ka[K].childNodes),ka[K]=Z(Ib,R,e));M=x(M.childNodes)}else M=x(pc(b)).contents();y.empty();R=Z(Ib,M,e,void 0,void 0,{needsNewScope:u.$$isolateScope||u.$$newScope});R.$$slots=ka}if(u.template)if(P=!0,ba("template",v,u,y),v=u,O=B(u.template)?u.template(y,d):u.template,O=Na(O),u.replace){g=u;M=mc.test(O)?rd(ja(u.templateNamespace,U(O))):[];b=M[0];if(1!==M.length||1!==b.nodeType)throw $("tplrt", -Q,"");pa(f,y,b);A={$attr:{}};O=sc(b,[],A);var Dg=a.splice(sa+1,a.length-(sa+1));(s||t)&&fa(O,s,t);a=a.concat(O).concat(Dg);ga(d,A);A=a.length}else y.html(O);if(u.templateUrl)P=!0,ba("template",v,u,y),v=u,u.replace&&(g=u),p=ha(a.splice(sa,a.length-sa),y,d,f,G&&R,h,k,{controllerDirectives:J,newScopeDirective:t!==u&&t,newIsolateScopeDirective:s,templateDirective:v,nonTlbTranscludeDirective:L}),A=a.length;else if(u.compile)try{q=u.compile(y,d,R);var X=u.$$originalDirective||u;B(q)?m(null,Va(X,q),E,ib): -q&&m(Va(X,q.pre),Va(X,q.post),E,ib)}catch(ca){c(ca,za(y))}u.terminal&&(p.terminal=!0,n=Math.max(n,u.priority))}p.scope=t&&!0===t.scope;p.transcludeOnThisElement=G;p.templateOnThisElement=P;p.transclude=R;l.hasElementTranscludeDirective=N;return p}function W(a,b,c,d){var e;if(A(b)){var f=b.match(l);b=b.substring(f[0].length);var g=f[1]||f[3],f="?"===f[2];"^^"===g?c=c.parent():e=(e=d&&d[b])&&e.instance;if(!e){var h="$"+b+"Controller";e="^^"===g&&c[0]&&9===c[0].nodeType?null:g?c.inheritedData(h):c.data(h)}if(!e&& -!f)throw $("ctreq",b,a);}else if(H(b))for(e=[],g=0,f=b.length;gc.priority)&&-1!==c.restrict.indexOf(e)){k&&(c=ac(c,{$$start:k,$$end:l}));if(!c.$$bindings){var I=m=c,t=c.name,u={isolateScope:null,bindToController:null};D(I.scope)&&(!0===I.bindToController?(u.bindToController=d(I.scope,t,!0),u.isolateScope={}):u.isolateScope=d(I.scope,t,!1));D(I.bindToController)&&(u.bindToController=d(I.bindToController, -t,!0));if(u.bindToController&&!I.controller)throw $("noctrl",t);m=m.$$bindings=u;D(m.isolateScope)&&(c.$$isolateBindings=m.isolateScope)}b.push(c);m=c}}return m}function ca(b){if(f.hasOwnProperty(b))for(var c=a.get(b+"Directive"),d=0,e=c.length;d"+b+"";return c.childNodes[0].childNodes;default:return b}}function oa(a,b){if("srcdoc"===b)return u.HTML;if("src"===b||"ngSrc"===b)return-1===["img","video","audio","source","track"].indexOf(a)?u.RESOURCE_URL:u.MEDIA_URL;if("xlinkHref"===b)return"image"===a?u.MEDIA_URL: -"a"===a?u.URL:u.RESOURCE_URL;if("form"===a&&"action"===b||"base"===a&&"href"===b||"link"===a&&"href"===b)return u.RESOURCE_URL;if("a"===a&&("href"===b||"ngHref"===b))return u.URL}function xa(a,b){var c=b.toLowerCase();return v[a+"|"+c]||v["*|"+c]}function ya(a){return ma(u.valueOf(a),"ng-prop-srcset")}function Ea(a,b,c,d){if(m.test(d))throw $("nodomevents");a=ua(a);var e=xa(a,d),f=Ta;"srcset"!==d||"img"!==a&&"source"!==a?e&&(f=u.getTrusted.bind(u,e)):f=ya;b.push({priority:100,compile:function(a,b){var e= -p(b[c]),g=p(b[c],function(a){return u.valueOf(a)});return{pre:function(a,b){function c(){var g=e(a);b[0][d]=f(g)}c();a.$watch(g,c)}}}})}function Ia(a,c,d,e,f){var g=ua(a),k=oa(g,e),l=h[e]||f,p=b(d,!f,k,l);if(p){if("multiple"===e&&"select"===g)throw $("selmulti",za(a));if(m.test(e))throw $("nodomevents");c.push({priority:100,compile:function(){return{pre:function(a,c,f){c=f.$$observers||(f.$$observers=T());var g=f[e];g!==d&&(p=g&&b(g,!0,k,l),d=g);p&&(f[e]=p(a),(c[e]||(c[e]=[])).$$inter=!0,(f.$$observers&& -f.$$observers[e].$$scope||a).$watch(p,function(a,b){"class"===e&&a!==b?f.$updateClass(a,b):f.$set(e,a)}))}}}})}}function pa(a,b,c){var d=b[0],e=b.length,f=d.parentNode,g,h;if(a)for(g=0,h=a.length;g=b)return a;for(;b--;){var d=a[b];(8===d.nodeType||d.nodeType===Pa&&""===d.nodeValue.trim())&&Fg.call(a,b,1)}return a}function Bg(a,b){if(b&&A(b))return b;if(A(a)){var d=ud.exec(a);if(d)return d[3]}}function Ff(){var a={};this.has=function(b){return a.hasOwnProperty(b)};this.register=function(b,d){Ja(b, -"controller");D(b)?S(a,b):a[b]=d};this.$get=["$injector",function(b){function d(a,b,d,g){if(!a||!D(a.$scope))throw F("$controller")("noscp",g,b);a.$scope[b]=d}return function(c,e,f,g){var k,h,l;f=!0===f;g&&A(g)&&(l=g);if(A(c)){g=c.match(ud);if(!g)throw vd("ctrlfmt",c);h=g[1];l=l||g[3];c=a.hasOwnProperty(h)?a[h]:Ge(e.$scope,h,!0);if(!c)throw vd("ctrlreg",h);sb(c,h,!0)}if(f)return f=(H(c)?c[c.length-1]:c).prototype,k=Object.create(f||null),l&&d(e,l,k,h||c.name),S(function(){var a=b.invoke(c,k,e,h); -a!==k&&(D(a)||B(a))&&(k=a,l&&d(e,l,k,h||c.name));return k},{instance:k,identifier:l});k=b.instantiate(c,e,h);l&&d(e,l,k,h||c.name);return k}}]}function Gf(){this.$get=["$window",function(a){return x(a.document)}]}function Hf(){this.$get=["$document","$rootScope",function(a,b){function d(){e=c.hidden}var c=a[0],e=c&&c.hidden;a.on("visibilitychange",d);b.$on("$destroy",function(){a.off("visibilitychange",d)});return function(){return e}}]}function If(){this.$get=["$log",function(a){return function(b, -d){a.error.apply(a,arguments)}}]}function uc(a){return D(a)?ha(a)?a.toISOString():eb(a):a}function Of(){this.$get=function(){return function(a){if(!a)return"";var b=[];Oc(a,function(a,c){null===a||z(a)||B(a)||(H(a)?r(a,function(a){b.push(ba(c)+"="+ba(uc(a)))}):b.push(ba(c)+"="+ba(uc(a))))});return b.join("&")}}}function Pf(){this.$get=function(){return function(a){function b(a,e,f){H(a)?r(a,function(a,c){b(a,e+"["+(D(a)?c:"")+"]")}):D(a)&&!ha(a)?Oc(a,function(a,c){b(a,e+(f?"":"[")+c+(f?"":"]"))}): -(B(a)&&(a=a()),d.push(ba(e)+"="+(null==a?"":ba(uc(a)))))}if(!a)return"";var d=[];b(a,"",!0);return d.join("&")}}}function vc(a,b){if(A(a)){var d=a.replace(Gg,"").trim();if(d){var c=b("Content-Type"),c=c&&0===c.indexOf(wd),e;(e=c)||(e=(e=d.match(Hg))&&Ig[e[0]].test(d));if(e)try{a=Rc(d)}catch(f){if(!c)return a;throw Kb("baddata",a,f);}}}return a}function xd(a){var b=T(),d;A(a)?r(a.split("\n"),function(a){d=a.indexOf(":");var e=K(U(a.substr(0,d)));a=U(a.substr(d+1));e&&(b[e]=b[e]?b[e]+", "+a:a)}):D(a)&& -r(a,function(a,d){var f=K(d),g=U(a);f&&(b[f]=b[f]?b[f]+", "+g:g)});return b}function yd(a){var b;return function(d){b||(b=xd(a));return d?(d=b[K(d)],void 0===d&&(d=null),d):b}}function zd(a,b,d,c){if(B(c))return c(a,b,d);r(c,function(c){a=c(a,b,d)});return a}function Nf(){var a=this.defaults={transformResponse:[vc],transformRequest:[function(a){return D(a)&&"[object File]"!==la.call(a)&&"[object Blob]"!==la.call(a)&&"[object FormData]"!==la.call(a)?eb(a):a}],headers:{common:{Accept:"application/json, text/plain, */*"}, -post:ja(wc),put:ja(wc),patch:ja(wc)},xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",paramSerializer:"$httpParamSerializer",jsonpCallbackParam:"callback"},b=!1;this.useApplyAsync=function(a){return w(a)?(b=!!a,this):b};var d=this.interceptors=[],c=this.xsrfWhitelistedOrigins=[];this.$get=["$browser","$httpBackend","$$cookieReader","$cacheFactory","$rootScope","$q","$injector","$sce",function(e,f,g,k,h,l,m,p){function n(b){function c(a,b){for(var d=0,e=b.length;da?b:l.reject(b)}if(!D(b))throw F("$http")("badreq",b);if(!A(p.valueOf(b.url)))throw F("$http")("badreq",b.url);var g=S({method:"get",transformRequest:a.transformRequest,transformResponse:a.transformResponse,paramSerializer:a.paramSerializer,jsonpCallbackParam:a.jsonpCallbackParam}, -b);g.headers=function(b){var c=a.headers,e=S({},b.headers),f,g,h,c=S({},c.common,c[K(b.method)]);a:for(f in c){g=K(f);for(h in e)if(K(h)===g)continue a;e[f]=c[f]}return d(e,ja(b))}(b);g.method=ub(g.method);g.paramSerializer=A(g.paramSerializer)?m.get(g.paramSerializer):g.paramSerializer;e.$$incOutstandingRequestCount("$http");var h=[],k=[];b=l.resolve(g);r(v,function(a){(a.request||a.requestError)&&h.unshift(a.request,a.requestError);(a.response||a.responseError)&&k.push(a.response,a.responseError)}); -b=c(b,h);b=b.then(function(b){var c=b.headers,d=zd(b.data,yd(c),void 0,b.transformRequest);z(d)&&r(c,function(a,b){"content-type"===K(b)&&delete c[b]});z(b.withCredentials)&&!z(a.withCredentials)&&(b.withCredentials=a.withCredentials);return s(b,d).then(f,f)});b=c(b,k);return b=b.finally(function(){e.$$completeOutstandingRequest(E,"$http")})}function s(c,d){function e(a){if(a){var c={};r(a,function(a,d){c[d]=function(c){function d(){a(c)}b?h.$applyAsync(d):h.$$phase?d():h.$apply(d)}});return c}}function k(a, -c,d,e,f){function g(){m(c,a,d,e,f)}R&&(200<=a&&300>a?R.put(O,[a,c,xd(d),e,f]):R.remove(O));b?h.$applyAsync(g):(g(),h.$$phase||h.$apply())}function m(a,b,d,e,f){b=-1<=b?b:0;(200<=b&&300>b?L.resolve:L.reject)({data:a,status:b,headers:yd(d),config:c,statusText:e,xhrStatus:f})}function s(a){m(a.data,a.status,ja(a.headers()),a.statusText,a.xhrStatus)}function v(){var a=n.pendingRequests.indexOf(c);-1!==a&&n.pendingRequests.splice(a,1)}var L=l.defer(),u=L.promise,R,q,ma=c.headers,x="jsonp"===K(c.method), -O=c.url;x?O=p.getTrustedResourceUrl(O):A(O)||(O=p.valueOf(O));O=G(O,c.paramSerializer(c.params));x&&(O=t(O,c.jsonpCallbackParam));n.pendingRequests.push(c);u.then(v,v);!c.cache&&!a.cache||!1===c.cache||"GET"!==c.method&&"JSONP"!==c.method||(R=D(c.cache)?c.cache:D(a.cache)?a.cache:N);R&&(q=R.get(O),w(q)?q&&B(q.then)?q.then(s,s):H(q)?m(q[1],q[0],ja(q[2]),q[3],q[4]):m(q,200,{},"OK","complete"):R.put(O,u));z(q)&&((q=jc(c.url)?g()[c.xsrfCookieName||a.xsrfCookieName]:void 0)&&(ma[c.xsrfHeaderName||a.xsrfHeaderName]= -q),f(c.method,O,d,k,ma,c.timeout,c.withCredentials,c.responseType,e(c.eventHandlers),e(c.uploadEventHandlers)));return u}function G(a,b){0=h&&(t.resolve(s),f(r.$$intervalId));G||c.$apply()},k,t,G);return r}}}]}function Ad(a,b){var d=ga(a);b.$$protocol=d.protocol;b.$$host=d.hostname;b.$$port=fa(d.port)||Mg[d.protocol]||null}function Bd(a,b,d){if(Ng.test(a))throw jb("badpath",a);var c="/"!==a.charAt(0);c&&(a="/"+a);a=ga(a);for(var c=(c&&"/"===a.pathname.charAt(0)?a.pathname.substring(1):a.pathname).split("/"),e=c.length;e--;)c[e]=decodeURIComponent(c[e]),d&&(c[e]=c[e].replace(/\//g,"%2F"));d=c.join("/");b.$$path=d;b.$$search=gc(a.search); -b.$$hash=decodeURIComponent(a.hash);b.$$path&&"/"!==b.$$path.charAt(0)&&(b.$$path="/"+b.$$path)}function xc(a,b){return a.slice(0,b.length)===b}function xa(a,b){if(xc(b,a))return b.substr(a.length)}function Da(a){var b=a.indexOf("#");return-1===b?a:a.substr(0,b)}function yc(a,b,d){this.$$html5=!0;d=d||"";Ad(a,this);this.$$parse=function(a){var d=xa(b,a);if(!A(d))throw jb("ipthprfx",a,b);Bd(d,this,!0);this.$$path||(this.$$path="/");this.$$compose()};this.$$normalizeUrl=function(a){return b+a.substr(1)}; -this.$$parseLinkUrl=function(c,e){if(e&&"#"===e[0])return this.hash(e.slice(1)),!0;var f,g;w(f=xa(a,c))?(g=f,g=d&&w(f=xa(d,f))?b+(xa("/",f)||f):a+g):w(f=xa(b,c))?g=b+f:b===c+"/"&&(g=b);g&&this.$$parse(g);return!!g}}function zc(a,b,d){Ad(a,this);this.$$parse=function(c){var e=xa(a,c)||xa(b,c),f;z(e)||"#"!==e.charAt(0)?this.$$html5?f=e:(f="",z(e)&&(a=c,this.replace())):(f=xa(d,e),z(f)&&(f=e));Bd(f,this,!1);c=this.$$path;var e=a,g=/^\/[A-Z]:(\/.*)/;xc(f,e)&&(f=f.replace(e,""));g.exec(f)||(c=(f=g.exec(c))? -f[1]:c);this.$$path=c;this.$$compose()};this.$$normalizeUrl=function(b){return a+(b?d+b:"")};this.$$parseLinkUrl=function(b,d){return Da(a)===Da(b)?(this.$$parse(b),!0):!1}}function Cd(a,b,d){this.$$html5=!0;zc.apply(this,arguments);this.$$parseLinkUrl=function(c,e){if(e&&"#"===e[0])return this.hash(e.slice(1)),!0;var f,g;a===Da(c)?f=c:(g=xa(b,c))?f=a+d+g:b===c+"/"&&(f=b);f&&this.$$parse(f);return!!f};this.$$normalizeUrl=function(b){return a+d+b}}function Lb(a){return function(){return this[a]}}function Dd(a, -b){return function(d){if(z(d))return this[a];this[a]=b(d);this.$$compose();return this}}function Tf(){var a="!",b={enabled:!1,requireBase:!0,rewriteLinks:!0};this.hashPrefix=function(b){return w(b)?(a=b,this):a};this.html5Mode=function(a){if(Ga(a))return b.enabled=a,this;if(D(a)){Ga(a.enabled)&&(b.enabled=a.enabled);Ga(a.requireBase)&&(b.requireBase=a.requireBase);if(Ga(a.rewriteLinks)||A(a.rewriteLinks))b.rewriteLinks=a.rewriteLinks;return this}return b};this.$get=["$rootScope","$browser","$sniffer", -"$rootElement","$window",function(d,c,e,f,g){function k(a,b){return a===b||ga(a).href===ga(b).href}function h(a,b,d){var e=m.url(),f=m.$$state;try{c.url(a,b,d),m.$$state=c.state()}catch(g){throw m.url(e),m.$$state=f,g;}}function l(a,b){d.$broadcast("$locationChangeSuccess",m.absUrl(),a,m.$$state,b)}var m,p;p=c.baseHref();var n=c.url(),s;if(b.enabled){if(!p&&b.requireBase)throw jb("nobase");s=n.substring(0,n.indexOf("/",n.indexOf("//")+2))+(p||"/");p=e.history?yc:Cd}else s=Da(n),p=zc;var r=s.substr(0, -Da(s).lastIndexOf("/")+1);m=new p(s,r,"#"+a);m.$$parseLinkUrl(n,n);m.$$state=c.state();var t=/^\s*(javascript|mailto):/i;f.on("click",function(a){var e=b.rewriteLinks;if(e&&!a.ctrlKey&&!a.metaKey&&!a.shiftKey&&2!==a.which&&2!==a.button){for(var g=x(a.target);"a"!==ua(g[0]);)if(g[0]===f[0]||!(g=g.parent())[0])return;if(!A(e)||!z(g.attr(e))){var e=g.prop("href"),h=g.attr("href")||g.attr("xlink:href");D(e)&&"[object SVGAnimatedString]"===e.toString()&&(e=ga(e.animVal).href);t.test(e)||!e||g.attr("target")|| -a.isDefaultPrevented()||!m.$$parseLinkUrl(e,h)||(a.preventDefault(),m.absUrl()!==c.url()&&d.$apply())}}});m.absUrl()!==n&&c.url(m.absUrl(),!0);var N=!0;c.onUrlChange(function(a,b){xc(a,r)?(d.$evalAsync(function(){var c=m.absUrl(),e=m.$$state,f;m.$$parse(a);m.$$state=b;f=d.$broadcast("$locationChangeStart",a,c,b,e).defaultPrevented;m.absUrl()===a&&(f?(m.$$parse(c),m.$$state=e,h(c,!1,e)):(N=!1,l(c,e)))}),d.$$phase||d.$digest()):g.location.href=a});d.$watch(function(){if(N||m.$$urlUpdatedByLocation){m.$$urlUpdatedByLocation= -!1;var a=c.url(),b=m.absUrl(),f=c.state(),g=m.$$replace,n=!k(a,b)||m.$$html5&&e.history&&f!==m.$$state;if(N||n)N=!1,d.$evalAsync(function(){var b=m.absUrl(),c=d.$broadcast("$locationChangeStart",b,a,m.$$state,f).defaultPrevented;m.absUrl()===b&&(c?(m.$$parse(a),m.$$state=f):(n&&h(b,g,f===m.$$state?null:m.$$state),l(a,f)))})}m.$$replace=!1});return m}]}function Uf(){var a=!0,b=this;this.debugEnabled=function(b){return w(b)?(a=b,this):a};this.$get=["$window",function(d){function c(a){cc(a)&&(a.stack&& -f?a=a.message&&-1===a.stack.indexOf(a.message)?"Error: "+a.message+"\n"+a.stack:a.stack:a.sourceURL&&(a=a.message+"\n"+a.sourceURL+":"+a.line));return a}function e(a){var b=d.console||{},e=b[a]||b.log||E;return function(){var a=[];r(arguments,function(b){a.push(c(b))});return Function.prototype.apply.call(e,b,a)}}var f=Ca||/\bEdge\//.test(d.navigator&&d.navigator.userAgent);return{log:e("log"),info:e("info"),warn:e("warn"),error:e("error"),debug:function(){var c=e("debug");return function(){a&&c.apply(b, -arguments)}}()}}]}function Og(a){return a+""}function Pg(a,b){return"undefined"!==typeof a?a:b}function Ed(a,b){return"undefined"===typeof a?b:"undefined"===typeof b?a:a+b}function Qg(a,b){switch(a.type){case q.MemberExpression:if(a.computed)return!1;break;case q.UnaryExpression:return 1;case q.BinaryExpression:return"+"!==a.operator?1:!1;case q.CallExpression:return!1}return void 0===b?Fd:b}function Z(a,b,d){var c,e,f=a.isPure=Qg(a,d);switch(a.type){case q.Program:c=!0;r(a.body,function(a){Z(a.expression, -b,f);c=c&&a.expression.constant});a.constant=c;break;case q.Literal:a.constant=!0;a.toWatch=[];break;case q.UnaryExpression:Z(a.argument,b,f);a.constant=a.argument.constant;a.toWatch=a.argument.toWatch;break;case q.BinaryExpression:Z(a.left,b,f);Z(a.right,b,f);a.constant=a.left.constant&&a.right.constant;a.toWatch=a.left.toWatch.concat(a.right.toWatch);break;case q.LogicalExpression:Z(a.left,b,f);Z(a.right,b,f);a.constant=a.left.constant&&a.right.constant;a.toWatch=a.constant?[]:[a];break;case q.ConditionalExpression:Z(a.test, -b,f);Z(a.alternate,b,f);Z(a.consequent,b,f);a.constant=a.test.constant&&a.alternate.constant&&a.consequent.constant;a.toWatch=a.constant?[]:[a];break;case q.Identifier:a.constant=!1;a.toWatch=[a];break;case q.MemberExpression:Z(a.object,b,f);a.computed&&Z(a.property,b,f);a.constant=a.object.constant&&(!a.computed||a.property.constant);a.toWatch=a.constant?[]:[a];break;case q.CallExpression:c=d=a.filter?!b(a.callee.name).$stateful:!1;e=[];r(a.arguments,function(a){Z(a,b,f);c=c&&a.constant;e.push.apply(e, -a.toWatch)});a.constant=c;a.toWatch=d?e:[a];break;case q.AssignmentExpression:Z(a.left,b,f);Z(a.right,b,f);a.constant=a.left.constant&&a.right.constant;a.toWatch=[a];break;case q.ArrayExpression:c=!0;e=[];r(a.elements,function(a){Z(a,b,f);c=c&&a.constant;e.push.apply(e,a.toWatch)});a.constant=c;a.toWatch=e;break;case q.ObjectExpression:c=!0;e=[];r(a.properties,function(a){Z(a.value,b,f);c=c&&a.value.constant;e.push.apply(e,a.value.toWatch);a.computed&&(Z(a.key,b,!1),c=c&&a.key.constant,e.push.apply(e, -a.key.toWatch))});a.constant=c;a.toWatch=e;break;case q.ThisExpression:a.constant=!1;a.toWatch=[];break;case q.LocalsExpression:a.constant=!1,a.toWatch=[]}}function Gd(a){if(1===a.length){a=a[0].expression;var b=a.toWatch;return 1!==b.length?b:b[0]!==a?b:void 0}}function Hd(a){return a.type===q.Identifier||a.type===q.MemberExpression}function Id(a){if(1===a.body.length&&Hd(a.body[0].expression))return{type:q.AssignmentExpression,left:a.body[0].expression,right:{type:q.NGValueParameter},operator:"="}} -function Jd(a){this.$filter=a}function Kd(a){this.$filter=a}function Mb(a,b,d){this.ast=new q(a,d);this.astCompiler=d.csp?new Kd(b):new Jd(b)}function Ac(a){return B(a.valueOf)?a.valueOf():Rg.call(a)}function Vf(){var a=T(),b={"true":!0,"false":!1,"null":null,undefined:void 0},d,c;this.addLiteral=function(a,c){b[a]=c};this.setIdentifierFns=function(a,b){d=a;c=b;return this};this.$get=["$filter",function(e){function f(b,c){var d,f;switch(typeof b){case "string":return f=b=b.trim(),d=a[f],d||(d=new Nb(G), -d=(new Mb(d,e,G)).parse(b),a[f]=p(d)),s(d,c);case "function":return s(b,c);default:return s(E,c)}}function g(a,b,c){return null==a||null==b?a===b:"object"!==typeof a||(a=Ac(a),"object"!==typeof a||c)?a===b||a!==a&&b!==b:!1}function k(a,b,c,d,e){var f=d.inputs,h;if(1===f.length){var k=g,f=f[0];return a.$watch(function(a){var b=f(a);g(b,k,f.isPure)||(h=d(a,void 0,void 0,[b]),k=b&&Ac(b));return h},b,c,e)}for(var l=[],m=[],n=0,p=f.length;n=c.$$state.status&&e&&e.length&&a(function(){for(var a,c,f=0,g=e.length;fa)for(b in l++,f)ta.call(e,b)||(t--,delete f[b])}else f!==e&&(f=e,l++);return l}}c.$$pure=g(a).literal;c.$stateful=!c.$$pure;var d=this,e,f,h,k=1r&&(z=4-r,N[z]|| -(N[z]=[]),N[z].push({msg:B(a.exp)?"fn: "+(a.exp.name||a.exp.toString()):a.exp,newVal:g,oldVal:h}));else if(a===c){s=!1;break a}}catch(E){f(E)}if(!(n=!q.$$suspended&&q.$$watchersCount&&q.$$childHead||q!==y&&q.$$nextSibling))for(;q!==y&&!(n=q.$$nextSibling);)q=q.$parent}while(q=n);if((s||w.length)&&!r--)throw v.$$phase=null,d("infdig",b,N);}while(s||w.length);for(v.$$phase=null;JCa)throw Ea("iequirks");var c=ja(V);c.isEnabled=function(){return a}; -c.trustAs=d.trustAs;c.getTrusted=d.getTrusted;c.valueOf=d.valueOf;a||(c.trustAs=c.getTrusted=function(a,b){return b},c.valueOf=Ta);c.parseAs=function(a,d){var e=b(d);return e.literal&&e.constant?e:b(d,function(b){return c.getTrusted(a,b)})};var e=c.parseAs,f=c.getTrusted,g=c.trustAs;r(V,function(a,b){var d=K(b);c[("parse_as_"+d).replace(Cc,wb)]=function(b){return e(a,b)};c[("get_trusted_"+d).replace(Cc,wb)]=function(b){return f(a,b)};c[("trust_as_"+d).replace(Cc,wb)]=function(b){return g(a,b)}}); -return c}]}function ag(){this.$get=["$window","$document",function(a,b){var d={},c=!((!a.nw||!a.nw.process)&&a.chrome&&(a.chrome.app&&a.chrome.app.runtime||!a.chrome.app&&a.chrome.runtime&&a.chrome.runtime.id))&&a.history&&a.history.pushState,e=fa((/android (\d+)/.exec(K((a.navigator||{}).userAgent))||[])[1]),f=/Boxee/i.test((a.navigator||{}).userAgent),g=b[0]||{},k=g.body&&g.body.style,h=!1,l=!1;k&&(h=!!("transition"in k||"webkitTransition"in k),l=!!("animation"in k||"webkitAnimation"in k));return{history:!(!c|| -4>e||f),hasEvent:function(a){if("input"===a&&Ca)return!1;if(z(d[a])){var b=g.createElement("div");d[a]="on"+a in b}return d[a]},csp:Aa(),transitions:h,animations:l,android:e}}]}function bg(){this.$get=ia(function(a){return new Tg(a)})}function Tg(a){function b(){var a=e.pop();return a&&a.cb}function d(a){for(var b=e.length-1;0<=b;--b){var c=e[b];if(c.type===a)return e.splice(b,1),c.cb}}var c={},e=[],f=this.ALL_TASKS_TYPE="$$all$$",g=this.DEFAULT_TASK_TYPE="$$default$$";this.completeTask=function(e, -h){h=h||g;try{e()}finally{var l;l=h||g;c[l]&&(c[l]--,c[f]--);l=c[h];var m=c[f];if(!m||!l)for(l=m?d:b;m=l(h);)try{m()}catch(p){a.error(p)}}};this.incTaskCount=function(a){a=a||g;c[a]=(c[a]||0)+1;c[f]=(c[f]||0)+1};this.notifyWhenNoPendingTasks=function(a,b){b=b||f;c[b]?e.push({type:b,cb:a}):a()}}function dg(){var a;this.httpOptions=function(b){return b?(a=b,this):a};this.$get=["$exceptionHandler","$templateCache","$http","$q","$sce",function(b,d,c,e,f){function g(k,h){g.totalPendingRequests++;if(!A(k)|| -z(d.get(k)))k=f.getTrustedResourceUrl(k);var l=c.defaults&&c.defaults.transformResponse;H(l)?l=l.filter(function(a){return a!==vc}):l===vc&&(l=null);return c.get(k,S({cache:d,transformResponse:l},a)).finally(function(){g.totalPendingRequests--}).then(function(a){return d.put(k,a.data)},function(a){h||(a=Ug("tpload",k,a.status,a.statusText),b(a));return e.reject(a)})}g.totalPendingRequests=0;return g}]}function eg(){this.$get=["$rootScope","$browser","$location",function(a,b,d){return{findBindings:function(a, -b,d){a=a.getElementsByClassName("ng-binding");var g=[];r(a,function(a){var c=ca.element(a).data("$binding");c&&r(c,function(c){d?(new RegExp("(^|\\s)"+Md(b)+"(\\s|\\||$)")).test(c)&&g.push(a):-1!==c.indexOf(b)&&g.push(a)})});return g},findModels:function(a,b,d){for(var g=["ng-","data-ng-","ng\\:"],k=0;kc&&(c=e),c+=+a.slice(e+1),a=a.substring(0,e)):0>c&&(c=a.length);for(e=0;a.charAt(e)===Ec;e++);if(e===(g=a.length))d=[0],c=1;else{for(g--;a.charAt(g)===Ec;)g--;c-=e;d=[];for(f=0;e<=g;e++,f++)d[f]=+a.charAt(e)}c>Wd&&(d=d.splice(0,Wd-1),b=c-1,c=1);return{d:d,e:b,i:c}}function dh(a,b,d,c){var e=a.d,f=e.length-a.i;b=z(b)?Math.min(Math.max(d,f),c):+b;d=b+a.i;c=e[d];if(0d-1){for(c=0;c>d;c--)e.unshift(0),a.i++;e.unshift(1);a.i++}else e[d-1]++;for(;fk;)h.unshift(0),k++;0=b.lgSize&&k.unshift(h.splice(-b.lgSize,h.length).join(""));h.length>b.gSize;)k.unshift(h.splice(-b.gSize,h.length).join(""));h.length&&k.unshift(h.join(""));h=k.join(d);f.length&&(h+=c+f.join(""));e&&(h+="e+"+e)}return 0>a&&!g?b.negPre+h+b.negSuf:b.posPre+h+b.posSuf}function Ob(a,b,d,c){var e="";if(0>a||c&&0>=a)c?a=-a+1:(a=-a,e="-");for(a=""+a;a.length-d)f+=d;0===f&&-12===d&&(f=12);return Ob(f,b,c,e)}}function kb(a,b,d){return function(c,e){var f=c["get"+a](),g=ub((d?"STANDALONE":"")+(b?"SHORT":"")+a);return e[g][f]}}function Xd(a){var b=(new Date(a,0,1)).getDay();return new Date(a,0,(4>=b?5:12)-b)}function Yd(a){return function(b){var d=Xd(b.getFullYear());b=+new Date(b.getFullYear(),b.getMonth(),b.getDate()+(4-b.getDay()))-+d;b=1+Math.round(b/6048E5);return Ob(b,a)}}function Fc(a,b){return 0>= -a.getFullYear()?b.ERAS[0]:b.ERAS[1]}function Rd(a){function b(a){var b;if(b=a.match(d)){a=new Date(0);var f=0,g=0,k=b[8]?a.setUTCFullYear:a.setFullYear,h=b[8]?a.setUTCHours:a.setHours;b[9]&&(f=fa(b[9]+b[10]),g=fa(b[9]+b[11]));k.call(a,fa(b[1]),fa(b[2])-1,fa(b[3]));f=fa(b[4]||0)-f;g=fa(b[5]||0)-g;k=fa(b[6]||0);b=Math.round(1E3*parseFloat("0."+(b[7]||0)));h.call(a,f,g,k,b)}return a}var d=/^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/;return function(c, -d,f){var g="",k=[],h,l;d=d||"mediumDate";d=a.DATETIME_FORMATS[d]||d;A(c)&&(c=eh.test(c)?fa(c):b(c));W(c)&&(c=new Date(c));if(!ha(c)||!isFinite(c.getTime()))return c;for(;d;)(l=fh.exec(d))?(k=db(k,l,1),d=k.pop()):(k.push(d),d=null);var m=c.getTimezoneOffset();f&&(m=ec(f,m),c=fc(c,f,!0));r(k,function(b){h=gh[b];g+=h?h(c,a.DATETIME_FORMATS,m):"''"===b?"'":b.replace(/(^'|'$)/g,"").replace(/''/g,"'")});return g}}function Yg(){return function(a,b){z(b)&&(b=2);return eb(a,b)}}function Zg(){return function(a, -b,d){b=Infinity===Math.abs(Number(b))?Number(b):fa(b);if(X(b))return a;W(a)&&(a=a.toString());if(!ya(a))return a;d=!d||isNaN(d)?0:fa(d);d=0>d?Math.max(0,a.length+d):d;return 0<=b?Gc(a,d,d+b):0===d?Gc(a,b,a.length):Gc(a,Math.max(0,d+b),d)}}function Gc(a,b,d){return A(a)?a.slice(b,d):Ha.call(a,b,d)}function Td(a){function b(b){return b.map(function(b){var c=1,d=Ta;if(B(b))d=b;else if(A(b)){if("+"===b.charAt(0)||"-"===b.charAt(0))c="-"===b.charAt(0)?-1:1,b=b.substring(1);if(""!==b&&(d=a(b),d.constant))var e= -d(),d=function(a){return a[e]}}return{get:d,descending:c}})}function d(a){switch(typeof a){case "number":case "boolean":case "string":return!0;default:return!1}}function c(a,b){var c=0,d=a.type,h=b.type;if(d===h){var h=a.value,l=b.value;"string"===d?(h=h.toLowerCase(),l=l.toLowerCase()):"object"===d&&(D(h)&&(h=a.index),D(l)&&(l=b.index));h!==l&&(c=hb||37<=b&&40>=b||m(a,this,this.value)});if(e.hasEvent("paste"))b.on("paste cut drop",m)}b.on("change",l);if(ce[g]&&c.$$hasNativeValidators&&g===d.type)b.on("keydown wheel mousedown",function(a){if(!h){var b=this.validity, -c=b.badInput,d=b.typeMismatch;h=f.defer(function(){h=null;b.badInput===c&&b.typeMismatch===d||l(a)})}});c.$render=function(){var a=c.$isEmpty(c.$viewValue)?"":c.$viewValue;b.val()!==a&&b.val(a)}}function Qb(a,b){return function(d,c){var e,f;if(ha(d))return d;if(A(d)){'"'===d.charAt(0)&&'"'===d.charAt(d.length-1)&&(d=d.substring(1,d.length-1));if(hh.test(d))return new Date(d);a.lastIndex=0;if(e=a.exec(d))return e.shift(),f=c?{yyyy:c.getFullYear(),MM:c.getMonth()+1,dd:c.getDate(),HH:c.getHours(),mm:c.getMinutes(), -ss:c.getSeconds(),sss:c.getMilliseconds()/1E3}:{yyyy:1970,MM:1,dd:1,HH:0,mm:0,ss:0,sss:0},r(e,function(a,c){cf.yyyy&&e.setFullYear(f.yyyy),e}return NaN}}function nb(a,b,d,c){return function(e,f,g,k,h,l,m,p){function n(a){return a&&!(a.getTime&&a.getTime()!==a.getTime())}function s(a){return w(a)&&!ha(a)?r(a)||void 0:a}function r(a,b){var c=k.$options.getOption("timezone");v&&v!==c&&(b=Sc(b,ec(v)));var e=d(a, -b);!isNaN(e)&&c&&(e=fc(e,c));return e}Ic(e,f,g,k,a);Sa(e,f,g,k,h,l);var t="time"===a||"datetimelocal"===a,q,v;k.$parsers.push(function(c){if(k.$isEmpty(c))return null;if(b.test(c))return r(c,q);k.$$parserName=a});k.$formatters.push(function(a){if(a&&!ha(a))throw ob("datefmt",a);if(n(a)){q=a;var b=k.$options.getOption("timezone");b&&(v=b,q=fc(q,b,!0));var d=c;t&&A(k.$options.getOption("timeSecondsFormat"))&&(d=c.replace("ss.sss",k.$options.getOption("timeSecondsFormat")).replace(/:$/,""));a=m("date")(a, -d,b);t&&k.$options.getOption("timeStripZeroSeconds")&&(a=a.replace(/(?::00)?(?:\.000)?$/,""));return a}v=q=null;return""});if(w(g.min)||g.ngMin){var x=g.min||p(g.ngMin)(e),B=s(x);k.$validators.min=function(a){return!n(a)||z(B)||d(a)>=B};g.$observe("min",function(a){a!==x&&(B=s(a),x=a,k.$validate())})}if(w(g.max)||g.ngMax){var y=g.max||p(g.ngMax)(e),J=s(y);k.$validators.max=function(a){return!n(a)||z(J)||d(a)<=J};g.$observe("max",function(a){a!==y&&(J=s(a),y=a,k.$validate())})}}}function Ic(a,b,d, -c,e){(c.$$hasNativeValidators=D(b[0].validity))&&c.$parsers.push(function(a){var d=b.prop("validity")||{};if(d.badInput||d.typeMismatch)c.$$parserName=e;else return a})}function de(a){a.$parsers.push(function(b){if(a.$isEmpty(b))return null;if(ih.test(b))return parseFloat(b);a.$$parserName="number"});a.$formatters.push(function(b){if(!a.$isEmpty(b)){if(!W(b))throw ob("numfmt",b);b=b.toString()}return b})}function na(a){w(a)&&!W(a)&&(a=parseFloat(a));return X(a)?void 0:a}function Jc(a){var b=a.toString(), -d=b.indexOf(".");return-1===d?-1a&&(a=/e-(\d+)$/.exec(b))?Number(a[1]):0:b.length-d-1}function ee(a,b,d){a=Number(a);var c=(a|0)!==a,e=(b|0)!==b,f=(d|0)!==d;if(c||e||f){var g=c?Jc(a):0,k=e?Jc(b):0,h=f?Jc(d):0,g=Math.max(g,k,h),g=Math.pow(10,g);a*=g;b*=g;d*=g;c&&(a=Math.round(a));e&&(b=Math.round(b));f&&(d=Math.round(d))}return 0===(a-b)%d}function fe(a,b,d,c,e){if(w(c)){a=a(c);if(!a.constant)throw ob("constexpr",d,c);return a(b)}return e}function Kc(a,b){function d(a,b){if(!a||!a.length)return[]; -if(!b||!b.length)return a;var c=[],d=0;a:for(;d(?:<\/\1>|)$/,mc=/<|&#?\w+;/,mg=/<([\w:-]+)/,ng=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,oa={option:[1,'"],thead:[1,"","
    "],col:[2,"","
    "],tr:[2,"","
    "],td:[3,"", -"
    "],_default:[0,"",""]};oa.optgroup=oa.option;oa.tbody=oa.tfoot=oa.colgroup=oa.caption=oa.thead;oa.th=oa.td;var ug=C.Node.prototype.contains||function(a){return!!(this.compareDocumentPosition(a)&16)},Wa=Y.prototype={ready:fd,toString:function(){var a=[];r(this,function(b){a.push(""+b)});return"["+a.join(", ")+"]"},eq:function(a){return 0<=a?x(this[a]):x(this[this.length+a])},length:0,push:kh,sort:[].sort,splice:[].splice},Gb={};r("multiple selected checked disabled readOnly required open".split(" "), -function(a){Gb[K(a)]=a});var md={};r("input select option textarea button form details".split(" "),function(a){md[a]=!0});var td={ngMinlength:"minlength",ngMaxlength:"maxlength",ngMin:"min",ngMax:"max",ngPattern:"pattern",ngStep:"step"};r({data:rc,removeData:qc,hasData:function(a){for(var b in Ka[a.ng339])return!0;return!1},cleanData:function(a){for(var b=0,d=a.length;b/,xg=/^[^(]*\(\s*([^)]*)\)/m,nh=/,/,oh=/^\s*(_?)(\S+?)\1\s*$/,vg=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg,Ba=F("$injector"); -fb.$$annotate=function(a,b,d){var c;if("function"===typeof a){if(!(c=a.$inject)){c=[];if(a.length){if(b)throw A(d)&&d||(d=a.name||yg(a)),Ba("strictdi",d);b=od(a);r(b[1].split(nh),function(a){a.replace(oh,function(a,b,d){c.push(d)})})}a.$inject=c}}else H(a)?(b=a.length-1,sb(a[b],"fn"),c=a.slice(0,b)):sb(a,"fn",!0);return c};var je=F("$animate"),zf=function(){this.$get=E},Af=function(){var a=new Hb,b=[];this.$get=["$$AnimateRunner","$rootScope",function(d,c){function e(a,b,c){var d=!1;b&&(b=A(b)?b.split(" "): -H(b)?b:[],r(b,function(b){b&&(d=!0,a[b]=c)}));return d}function f(){r(b,function(b){var c=a.get(b);if(c){var d=zg(b.attr("class")),e="",f="";r(c,function(a,b){a!==!!d[b]&&(a?e+=(e.length?" ":"")+b:f+=(f.length?" ":"")+b)});r(b,function(a){e&&Db(a,e);f&&Cb(a,f)});a.delete(b)}});b.length=0}return{enabled:E,on:E,off:E,pin:E,push:function(g,k,h,l){l&&l();h=h||{};h.from&&g.css(h.from);h.to&&g.css(h.to);if(h.addClass||h.removeClass)if(k=h.addClass,l=h.removeClass,h=a.get(g)||{},k=e(h,k,!0),l=e(h,l,!1), -k||l)a.set(g,h),b.push(g),1===b.length&&c.$$postDigest(f);g=new d;g.complete();return g}}}]},xf=["$provide",function(a){var b=this,d=null,c=null;this.$$registeredAnimations=Object.create(null);this.register=function(c,d){if(c&&"."!==c.charAt(0))throw je("notcsel",c);var g=c+"-animation";b.$$registeredAnimations[c.substr(1)]=g;a.factory(g,d)};this.customFilter=function(a){1===arguments.length&&(c=B(a)?a:null);return c};this.classNameFilter=function(a){if(1===arguments.length&&(d=a instanceof RegExp? -a:null)&&/[(\s|\/)]ng-animate[(\s|\/)]/.test(d.toString()))throw d=null,je("nongcls","ng-animate");return d};this.$get=["$$animateQueue",function(a){function b(a,c,d){if(d){var e;a:{for(e=0;e <= >= && || ! = |".split(" "),function(a){Ub[a]=!0});var rh={n:"\n",f:"\f",r:"\r",t:"\t",v:"\v","'":"'",'"':'"'},Nb=function(a){this.options=a};Nb.prototype={constructor:Nb, -lex:function(a){this.text=a;this.index=0;for(this.tokens=[];this.index=a&&"string"===typeof a},isWhitespace:function(a){return" "===a||"\r"===a||"\t"===a||"\n"===a||"\v"===a||"\u00a0"===a},isIdentifierStart:function(a){return this.options.isIdentifierStart? -this.options.isIdentifierStart(a,this.codePointAt(a)):this.isValidIdentifierStart(a)},isValidIdentifierStart:function(a){return"a"<=a&&"z">=a||"A"<=a&&"Z">=a||"_"===a||"$"===a},isIdentifierContinue:function(a){return this.options.isIdentifierContinue?this.options.isIdentifierContinue(a,this.codePointAt(a)):this.isValidIdentifierContinue(a)},isValidIdentifierContinue:function(a,b){return this.isValidIdentifierStart(a,b)||this.isNumber(a)},codePointAt:function(a){return 1===a.length?a.charCodeAt(0): -(a.charCodeAt(0)<<10)+a.charCodeAt(1)-56613888},peekMultichar:function(){var a=this.text.charAt(this.index),b=this.peek();if(!b)return a;var d=a.charCodeAt(0),c=b.charCodeAt(0);return 55296<=d&&56319>=d&&56320<=c&&57343>=c?a+b:a},isExpOperator:function(a){return"-"===a||"+"===a||this.isNumber(a)},throwError:function(a,b,d){d=d||this.index;b=w(b)?"s "+b+"-"+this.index+" ["+this.text.substring(b,d)+"]":" "+d;throw Ya("lexerr",a,b,this.text);},readNumber:function(){for(var a="",b=this.index;this.index< -this.text.length;){var d=K(this.text.charAt(this.index));if("."===d||this.isNumber(d))a+=d;else{var c=this.peek();if("e"===d&&this.isExpOperator(c))a+=d;else if(this.isExpOperator(d)&&c&&this.isNumber(c)&&"e"===a.charAt(a.length-1))a+=d;else if(!this.isExpOperator(d)||c&&this.isNumber(c)||"e"!==a.charAt(a.length-1))break;else this.throwError("Invalid exponent")}this.index++}this.tokens.push({index:b,text:a,constant:!0,value:Number(a)})},readIdent:function(){var a=this.index;for(this.index+=this.peekMultichar().length;this.index< -this.text.length;){var b=this.peekMultichar();if(!this.isIdentifierContinue(b))break;this.index+=b.length}this.tokens.push({index:a,text:this.text.slice(a,this.index),identifier:!0})},readString:function(a){var b=this.index;this.index++;for(var d="",c=a,e=!1;this.index","<=",">=");)a={type:q.BinaryExpression,operator:b.text,left:a,right:this.additive()};return a},additive:function(){for(var a=this.multiplicative(),b;b=this.expect("+","-");)a={type:q.BinaryExpression, -operator:b.text,left:a,right:this.multiplicative()};return a},multiplicative:function(){for(var a=this.unary(),b;b=this.expect("*","/","%");)a={type:q.BinaryExpression,operator:b.text,left:a,right:this.unary()};return a},unary:function(){var a;return(a=this.expect("+","-","!"))?{type:q.UnaryExpression,operator:a.text,prefix:!0,argument:this.unary()}:this.primary()},primary:function(){var a;this.expect("(")?(a=this.filterChain(),this.consume(")")):this.expect("[")?a=this.arrayDeclaration():this.expect("{")? -a=this.object():this.selfReferential.hasOwnProperty(this.peek().text)?a=Ia(this.selfReferential[this.consume().text]):this.options.literals.hasOwnProperty(this.peek().text)?a={type:q.Literal,value:this.options.literals[this.consume().text]}:this.peek().identifier?a=this.identifier():this.peek().constant?a=this.constant():this.throwError("not a primary expression",this.peek());for(var b;b=this.expect("(","[",".");)"("===b.text?(a={type:q.CallExpression,callee:a,arguments:this.parseArguments()},this.consume(")")): -"["===b.text?(a={type:q.MemberExpression,object:a,property:this.expression(),computed:!0},this.consume("]")):"."===b.text?a={type:q.MemberExpression,object:a,property:this.identifier(),computed:!1}:this.throwError("IMPOSSIBLE");return a},filter:function(a){a=[a];for(var b={type:q.CallExpression,callee:this.identifier(),arguments:a,filter:!0};this.expect(":");)a.push(this.expression());return b},parseArguments:function(){var a=[];if(")"!==this.peekToken().text){do a.push(this.filterChain());while(this.expect(",")) -}return a},identifier:function(){var a=this.consume();a.identifier||this.throwError("is not a valid identifier",a);return{type:q.Identifier,name:a.text}},constant:function(){return{type:q.Literal,value:this.consume().value}},arrayDeclaration:function(){var a=[];if("]"!==this.peekToken().text){do{if(this.peek("]"))break;a.push(this.expression())}while(this.expect(","))}this.consume("]");return{type:q.ArrayExpression,elements:a}},object:function(){var a=[],b;if("}"!==this.peekToken().text){do{if(this.peek("}"))break; -b={type:q.Property,kind:"init"};this.peek().constant?(b.key=this.constant(),b.computed=!1,this.consume(":"),b.value=this.expression()):this.peek().identifier?(b.key=this.identifier(),b.computed=!1,this.peek(":")?(this.consume(":"),b.value=this.expression()):b.value=b.key):this.peek("[")?(this.consume("["),b.key=this.expression(),this.consume("]"),b.computed=!0,this.consume(":"),b.value=this.expression()):this.throwError("invalid key",this.peek());a.push(b)}while(this.expect(","))}this.consume("}"); -return{type:q.ObjectExpression,properties:a}},throwError:function(a,b){throw Ya("syntax",b.text,a,b.index+1,this.text,this.text.substring(b.index));},consume:function(a){if(0===this.tokens.length)throw Ya("ueoe",this.text);var b=this.expect(a);b||this.throwError("is unexpected, expecting ["+a+"]",this.peek());return b},peekToken:function(){if(0===this.tokens.length)throw Ya("ueoe",this.text);return this.tokens[0]},peek:function(a,b,d,c){return this.peekAhead(0,a,b,d,c)},peekAhead:function(a,b,d,c, -e){if(this.tokens.length>a){a=this.tokens[a];var f=a.text;if(f===b||f===d||f===c||f===e||!(b||d||c||e))return a}return!1},expect:function(a,b,d,c){return(a=this.peek(a,b,d,c))?(this.tokens.shift(),a):!1},selfReferential:{"this":{type:q.ThisExpression},$locals:{type:q.LocalsExpression}}};var Fd=2;Jd.prototype={compile:function(a){var b=this;this.state={nextId:0,filters:{},fn:{vars:[],body:[],own:{}},assign:{vars:[],body:[],own:{}},inputs:[]};Z(a,b.$filter);var d="",c;this.stage="assign";if(c=Id(a))this.state.computing= -"assign",d=this.nextId(),this.recurse(c,d),this.return_(d),d="fn.assign="+this.generateFunction("assign","s,v,l");c=Gd(a.body);b.stage="inputs";r(c,function(a,c){var d="fn"+c;b.state[d]={vars:[],body:[],own:{}};b.state.computing=d;var k=b.nextId();b.recurse(a,k);b.return_(k);b.state.inputs.push({name:d,isPure:a.isPure});a.watchId=c});this.state.computing="fn";this.stage="main";this.recurse(a);a='"'+this.USE+" "+this.STRICT+'";\n'+this.filterPrefix()+"var fn="+this.generateFunction("fn","s,l,a,i")+ -d+this.watchFns()+"return fn;";a=(new Function("$filter","getStringValue","ifDefined","plus",a))(this.$filter,Og,Pg,Ed);this.state=this.stage=void 0;return a},USE:"use",STRICT:"strict",watchFns:function(){var a=[],b=this.state.inputs,d=this;r(b,function(b){a.push("var "+b.name+"="+d.generateFunction(b.name,"s"));b.isPure&&a.push(b.name,".isPure="+JSON.stringify(b.isPure)+";")});b.length&&a.push("fn.inputs=["+b.map(function(a){return a.name}).join(",")+"];");return a.join("")},generateFunction:function(a, -b){return"function("+b+"){"+this.varsPrefix(a)+this.body(a)+"};"},filterPrefix:function(){var a=[],b=this;r(this.state.filters,function(d,c){a.push(d+"=$filter("+b.escape(c)+")")});return a.length?"var "+a.join(",")+";":""},varsPrefix:function(a){return this.state[a].vars.length?"var "+this.state[a].vars.join(",")+";":""},body:function(a){return this.state[a].body.join("")},recurse:function(a,b,d,c,e,f){var g,k,h=this,l,m,p;c=c||E;if(!f&&w(a.watchId))b=b||this.nextId(),this.if_("i",this.lazyAssign(b, -this.computedMember("i",a.watchId)),this.lazyRecurse(a,b,d,c,e,!0));else switch(a.type){case q.Program:r(a.body,function(b,c){h.recurse(b.expression,void 0,void 0,function(a){k=a});c!==a.body.length-1?h.current().body.push(k,";"):h.return_(k)});break;case q.Literal:m=this.escape(a.value);this.assign(b,m);c(b||m);break;case q.UnaryExpression:this.recurse(a.argument,void 0,void 0,function(a){k=a});m=a.operator+"("+this.ifDefined(k,0)+")";this.assign(b,m);c(m);break;case q.BinaryExpression:this.recurse(a.left, -void 0,void 0,function(a){g=a});this.recurse(a.right,void 0,void 0,function(a){k=a});m="+"===a.operator?this.plus(g,k):"-"===a.operator?this.ifDefined(g,0)+a.operator+this.ifDefined(k,0):"("+g+")"+a.operator+"("+k+")";this.assign(b,m);c(m);break;case q.LogicalExpression:b=b||this.nextId();h.recurse(a.left,b);h.if_("&&"===a.operator?b:h.not(b),h.lazyRecurse(a.right,b));c(b);break;case q.ConditionalExpression:b=b||this.nextId();h.recurse(a.test,b);h.if_(b,h.lazyRecurse(a.alternate,b),h.lazyRecurse(a.consequent, -b));c(b);break;case q.Identifier:b=b||this.nextId();d&&(d.context="inputs"===h.stage?"s":this.assign(this.nextId(),this.getHasOwnProperty("l",a.name)+"?l:s"),d.computed=!1,d.name=a.name);h.if_("inputs"===h.stage||h.not(h.getHasOwnProperty("l",a.name)),function(){h.if_("inputs"===h.stage||"s",function(){e&&1!==e&&h.if_(h.isNull(h.nonComputedMember("s",a.name)),h.lazyAssign(h.nonComputedMember("s",a.name),"{}"));h.assign(b,h.nonComputedMember("s",a.name))})},b&&h.lazyAssign(b,h.nonComputedMember("l", -a.name)));c(b);break;case q.MemberExpression:g=d&&(d.context=this.nextId())||this.nextId();b=b||this.nextId();h.recurse(a.object,g,void 0,function(){h.if_(h.notNull(g),function(){a.computed?(k=h.nextId(),h.recurse(a.property,k),h.getStringValue(k),e&&1!==e&&h.if_(h.not(h.computedMember(g,k)),h.lazyAssign(h.computedMember(g,k),"{}")),m=h.computedMember(g,k),h.assign(b,m),d&&(d.computed=!0,d.name=k)):(e&&1!==e&&h.if_(h.isNull(h.nonComputedMember(g,a.property.name)),h.lazyAssign(h.nonComputedMember(g, -a.property.name),"{}")),m=h.nonComputedMember(g,a.property.name),h.assign(b,m),d&&(d.computed=!1,d.name=a.property.name))},function(){h.assign(b,"undefined")});c(b)},!!e);break;case q.CallExpression:b=b||this.nextId();a.filter?(k=h.filter(a.callee.name),l=[],r(a.arguments,function(a){var b=h.nextId();h.recurse(a,b);l.push(b)}),m=k+"("+l.join(",")+")",h.assign(b,m),c(b)):(k=h.nextId(),g={},l=[],h.recurse(a.callee,k,g,function(){h.if_(h.notNull(k),function(){r(a.arguments,function(b){h.recurse(b,a.constant? -void 0:h.nextId(),void 0,function(a){l.push(a)})});m=g.name?h.member(g.context,g.name,g.computed)+"("+l.join(",")+")":k+"("+l.join(",")+")";h.assign(b,m)},function(){h.assign(b,"undefined")});c(b)}));break;case q.AssignmentExpression:k=this.nextId();g={};this.recurse(a.left,void 0,g,function(){h.if_(h.notNull(g.context),function(){h.recurse(a.right,k);m=h.member(g.context,g.name,g.computed)+a.operator+k;h.assign(b,m);c(b||m)})},1);break;case q.ArrayExpression:l=[];r(a.elements,function(b){h.recurse(b, -a.constant?void 0:h.nextId(),void 0,function(a){l.push(a)})});m="["+l.join(",")+"]";this.assign(b,m);c(b||m);break;case q.ObjectExpression:l=[];p=!1;r(a.properties,function(a){a.computed&&(p=!0)});p?(b=b||this.nextId(),this.assign(b,"{}"),r(a.properties,function(a){a.computed?(g=h.nextId(),h.recurse(a.key,g)):g=a.key.type===q.Identifier?a.key.name:""+a.key.value;k=h.nextId();h.recurse(a.value,k);h.assign(h.member(b,g,a.computed),k)})):(r(a.properties,function(b){h.recurse(b.value,a.constant?void 0: -h.nextId(),void 0,function(a){l.push(h.escape(b.key.type===q.Identifier?b.key.name:""+b.key.value)+":"+a)})}),m="{"+l.join(",")+"}",this.assign(b,m));c(b||m);break;case q.ThisExpression:this.assign(b,"s");c(b||"s");break;case q.LocalsExpression:this.assign(b,"l");c(b||"l");break;case q.NGValueParameter:this.assign(b,"v"),c(b||"v")}},getHasOwnProperty:function(a,b){var d=a+"."+b,c=this.current().own;c.hasOwnProperty(d)||(c[d]=this.nextId(!1,a+"&&("+this.escape(b)+" in "+a+")"));return c[d]},assign:function(a, -b){if(a)return this.current().body.push(a,"=",b,";"),a},filter:function(a){this.state.filters.hasOwnProperty(a)||(this.state.filters[a]=this.nextId(!0));return this.state.filters[a]},ifDefined:function(a,b){return"ifDefined("+a+","+this.escape(b)+")"},plus:function(a,b){return"plus("+a+","+b+")"},return_:function(a){this.current().body.push("return ",a,";")},if_:function(a,b,d){if(!0===a)b();else{var c=this.current().body;c.push("if(",a,"){");b();c.push("}");d&&(c.push("else{"),d(),c.push("}"))}}, -not:function(a){return"!("+a+")"},isNull:function(a){return a+"==null"},notNull:function(a){return a+"!=null"},nonComputedMember:function(a,b){var d=/[^$_a-zA-Z0-9]/g;return/^[$_a-zA-Z][$_a-zA-Z0-9]*$/.test(b)?a+"."+b:a+'["'+b.replace(d,this.stringEscapeFn)+'"]'},computedMember:function(a,b){return a+"["+b+"]"},member:function(a,b,d){return d?this.computedMember(a,b):this.nonComputedMember(a,b)},getStringValue:function(a){this.assign(a,"getStringValue("+a+")")},lazyRecurse:function(a,b,d,c,e,f){var g= -this;return function(){g.recurse(a,b,d,c,e,f)}},lazyAssign:function(a,b){var d=this;return function(){d.assign(a,b)}},stringEscapeRegex:/[^ a-zA-Z0-9]/g,stringEscapeFn:function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)},escape:function(a){if(A(a))return"'"+a.replace(this.stringEscapeRegex,this.stringEscapeFn)+"'";if(W(a))return a.toString();if(!0===a)return"true";if(!1===a)return"false";if(null===a)return"null";if("undefined"===typeof a)return"undefined";throw Ya("esc");},nextId:function(a, -b){var d="v"+this.state.nextId++;a||this.current().vars.push(d+(b?"="+b:""));return d},current:function(){return this.state[this.state.computing]}};Kd.prototype={compile:function(a){var b=this;Z(a,b.$filter);var d,c;if(d=Id(a))c=this.recurse(d);d=Gd(a.body);var e;d&&(e=[],r(d,function(a,c){var d=b.recurse(a);d.isPure=a.isPure;a.input=d;e.push(d);a.watchId=c}));var f=[];r(a.body,function(a){f.push(b.recurse(a.expression))});a=0===a.body.length?E:1===a.body.length?f[0]:function(a,b){var c;r(f,function(d){c= -d(a,b)});return c};c&&(a.assign=function(a,b,d){return c(a,d,b)});e&&(a.inputs=e);return a},recurse:function(a,b,d){var c,e,f=this,g;if(a.input)return this.inputs(a.input,a.watchId);switch(a.type){case q.Literal:return this.value(a.value,b);case q.UnaryExpression:return e=this.recurse(a.argument),this["unary"+a.operator](e,b);case q.BinaryExpression:return c=this.recurse(a.left),e=this.recurse(a.right),this["binary"+a.operator](c,e,b);case q.LogicalExpression:return c=this.recurse(a.left),e=this.recurse(a.right), -this["binary"+a.operator](c,e,b);case q.ConditionalExpression:return this["ternary?:"](this.recurse(a.test),this.recurse(a.alternate),this.recurse(a.consequent),b);case q.Identifier:return f.identifier(a.name,b,d);case q.MemberExpression:return c=this.recurse(a.object,!1,!!d),a.computed||(e=a.property.name),a.computed&&(e=this.recurse(a.property)),a.computed?this.computedMember(c,e,b,d):this.nonComputedMember(c,e,b,d);case q.CallExpression:return g=[],r(a.arguments,function(a){g.push(f.recurse(a))}), -a.filter&&(e=this.$filter(a.callee.name)),a.filter||(e=this.recurse(a.callee,!0)),a.filter?function(a,c,d,f){for(var p=[],n=0;n":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)>b(c,e,f,g);return d?{value:c}:c}},"binary<=":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)<=b(c,e,f,g);return d?{value:c}:c}},"binary>=":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)>=b(c,e,f,g);return d?{value:c}:c}},"binary&&":function(a,b,d){return function(c,e,f,g){c= -a(c,e,f,g)&&b(c,e,f,g);return d?{value:c}:c}},"binary||":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)||b(c,e,f,g);return d?{value:c}:c}},"ternary?:":function(a,b,d,c){return function(e,f,g,k){e=a(e,f,g,k)?b(e,f,g,k):d(e,f,g,k);return c?{value:e}:e}},value:function(a,b){return function(){return b?{context:void 0,name:void 0,value:a}:a}},identifier:function(a,b,d){return function(c,e,f,g){c=e&&a in e?e:c;d&&1!==d&&c&&null==c[a]&&(c[a]={});e=c?c[a]:void 0;return b?{context:c,name:a,value:e}: -e}},computedMember:function(a,b,d,c){return function(e,f,g,k){var h=a(e,f,g,k),l,m;null!=h&&(l=b(e,f,g,k),l+="",c&&1!==c&&h&&!h[l]&&(h[l]={}),m=h[l]);return d?{context:h,name:l,value:m}:m}},nonComputedMember:function(a,b,d,c){return function(e,f,g,k){e=a(e,f,g,k);c&&1!==c&&e&&null==e[b]&&(e[b]={});f=null!=e?e[b]:void 0;return d?{context:e,name:b,value:f}:f}},inputs:function(a,b){return function(d,c,e,f){return f?f[b]:a(d,c,e)}}};Mb.prototype={constructor:Mb,parse:function(a){a=this.getAst(a);var b= -this.astCompiler.compile(a.ast),d=a.ast;b.literal=0===d.body.length||1===d.body.length&&(d.body[0].expression.type===q.Literal||d.body[0].expression.type===q.ArrayExpression||d.body[0].expression.type===q.ObjectExpression);b.constant=a.ast.constant;b.oneTime=a.oneTime;return b},getAst:function(a){var b=!1;a=a.trim();":"===a.charAt(0)&&":"===a.charAt(1)&&(b=!0,a=a.substring(2));return{ast:this.ast.ast(a),oneTime:b}}};var Ea=F("$sce"),V={HTML:"html",CSS:"css",MEDIA_URL:"mediaUrl",URL:"url",RESOURCE_URL:"resourceUrl", -JS:"js"},Cc=/_([a-z])/g,Ug=F("$templateRequest"),Vg=F("$timeout"),aa=C.document.createElement("a"),Od=ga(C.location.href),Na;aa.href="http://[::1]";var Wg="[::1]"===aa.hostname;Pd.$inject=["$document"];dd.$inject=["$provide"];var Wd=22,Vd=".",Ec="0";Qd.$inject=["$locale"];Sd.$inject=["$locale"];var gh={yyyy:ea("FullYear",4,0,!1,!0),yy:ea("FullYear",2,0,!0,!0),y:ea("FullYear",1,0,!1,!0),MMMM:kb("Month"),MMM:kb("Month",!0),MM:ea("Month",2,1),M:ea("Month",1,1),LLLL:kb("Month",!1,!0),dd:ea("Date",2), -d:ea("Date",1),HH:ea("Hours",2),H:ea("Hours",1),hh:ea("Hours",2,-12),h:ea("Hours",1,-12),mm:ea("Minutes",2),m:ea("Minutes",1),ss:ea("Seconds",2),s:ea("Seconds",1),sss:ea("Milliseconds",3),EEEE:kb("Day"),EEE:kb("Day",!0),a:function(a,b){return 12>a.getHours()?b.AMPMS[0]:b.AMPMS[1]},Z:function(a,b,d){a=-1*d;return a=(0<=a?"+":"")+(Ob(Math[0=a.getFullYear()?b.ERANAMES[0]:b.ERANAMES[1]}}, -fh=/((?:[^yMLdHhmsaZEwG']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|L+|d+|H+|h+|m+|s+|a|Z|G+|w+))([\s\S]*)/,eh=/^-?\d+$/;Rd.$inject=["$locale"];var $g=ia(K),ah=ia(ub);Td.$inject=["$parse"];var Me=ia({restrict:"E",compile:function(a,b){if(!b.href&&!b.xlinkHref)return function(a,b){if("a"===b[0].nodeName.toLowerCase()){var e="[object SVGAnimatedString]"===la.call(b.prop("href"))?"xlink:href":"href";b.on("click",function(a){b.attr(e)||a.preventDefault()})}}}}),vb={};r(Gb,function(a,b){function d(a,d,e){a.$watch(e[c], -function(a){e.$set(b,!!a)})}if("multiple"!==a){var c=wa("ng-"+b),e=d;"checked"===a&&(e=function(a,b,e){e.ngModel!==e[c]&&d(a,b,e)});vb[c]=function(){return{restrict:"A",priority:100,link:e}}}});r(td,function(a,b){vb[b]=function(){return{priority:100,link:function(a,c,e){if("ngPattern"===b&&"/"===e.ngPattern.charAt(0)&&(c=e.ngPattern.match(ie))){e.$set("ngPattern",new RegExp(c[1],c[2]));return}a.$watch(e[b],function(a){e.$set(b,a)})}}}});r(["src","srcset","href"],function(a){var b=wa("ng-"+a);vb[b]= -["$sce",function(d){return{priority:99,link:function(c,e,f){var g=a,k=a;"href"===a&&"[object SVGAnimatedString]"===la.call(e.prop("href"))&&(k="xlinkHref",f.$attr[k]="xlink:href",g=null);f.$set(b,d.getTrustedMediaUrl(f[b]));f.$observe(b,function(b){b?(f.$set(k,b),Ca&&g&&e.prop(g,f[k])):"href"===a&&f.$set(k,null)})}}}]});var lb={$addControl:E,$getControls:ia([]),$$renameControl:function(a,b){a.$name=b},$removeControl:E,$setValidity:E,$setDirty:E,$setPristine:E,$setSubmitted:E,$$setSubmitted:E};Pb.$inject= -["$element","$attrs","$scope","$animate","$interpolate"];Pb.prototype={$rollbackViewValue:function(){r(this.$$controls,function(a){a.$rollbackViewValue()})},$commitViewValue:function(){r(this.$$controls,function(a){a.$commitViewValue()})},$addControl:function(a){Ja(a.$name,"input");this.$$controls.push(a);a.$name&&(this[a.$name]=a);a.$$parentForm=this},$getControls:function(){return ja(this.$$controls)},$$renameControl:function(a,b){var d=a.$name;this[d]===a&&delete this[d];this[b]=a;a.$name=b},$removeControl:function(a){a.$name&& -this[a.$name]===a&&delete this[a.$name];r(this.$pending,function(b,d){this.$setValidity(d,null,a)},this);r(this.$error,function(b,d){this.$setValidity(d,null,a)},this);r(this.$$success,function(b,d){this.$setValidity(d,null,a)},this);cb(this.$$controls,a);a.$$parentForm=lb},$setDirty:function(){this.$$animate.removeClass(this.$$element,Za);this.$$animate.addClass(this.$$element,Vb);this.$dirty=!0;this.$pristine=!1;this.$$parentForm.$setDirty()},$setPristine:function(){this.$$animate.setClass(this.$$element, -Za,Vb+" ng-submitted");this.$dirty=!1;this.$pristine=!0;this.$submitted=!1;r(this.$$controls,function(a){a.$setPristine()})},$setUntouched:function(){r(this.$$controls,function(a){a.$setUntouched()})},$setSubmitted:function(){for(var a=this;a.$$parentForm&&a.$$parentForm!==lb;)a=a.$$parentForm;a.$$setSubmitted()},$$setSubmitted:function(){this.$$animate.addClass(this.$$element,"ng-submitted");this.$submitted=!0;r(this.$$controls,function(a){a.$$setSubmitted&&a.$$setSubmitted()})}};ae({clazz:Pb,set:function(a, -b,d){var c=a[b];c?-1===c.indexOf(d)&&c.push(d):a[b]=[d]},unset:function(a,b,d){var c=a[b];c&&(cb(c,d),0===c.length&&delete a[b])}});var ke=function(a){return["$timeout","$parse",function(b,d){function c(a){return""===a?d('this[""]').assign:d(a).assign||E}return{name:"form",restrict:a?"EAC":"E",require:["form","^^?form"],controller:Pb,compile:function(d,f){d.addClass(Za).addClass(mb);var g=f.name?"name":a&&f.ngForm?"ngForm":!1;return{pre:function(a,d,e,f){var p=f[0];if(!("action"in e)){var n=function(b){a.$apply(function(){p.$commitViewValue(); -p.$setSubmitted()});b.preventDefault()};d[0].addEventListener("submit",n);d.on("$destroy",function(){b(function(){d[0].removeEventListener("submit",n)},0,!1)})}(f[1]||p.$$parentForm).$addControl(p);var s=g?c(p.$name):E;g&&(s(a,p),e.$observe(g,function(b){p.$name!==b&&(s(a,void 0),p.$$parentForm.$$renameControl(p,b),s=c(p.$name),s(a,p))}));d.on("$destroy",function(){p.$$parentForm.$removeControl(p);s(a,void 0);S(p,lb)})}}}}}]},Ne=ke(),Ze=ke(!0),hh=/^\d{4,}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+(?:[+-][0-2]\d:[0-5]\d|Z)$/, -sh=/^[a-z][a-z\d.+-]*:\/*(?:[^:@]+(?::[^@]+)?@)?(?:[^\s:/?#]+|\[[a-f\d:]+])(?::\d+)?(?:\/[^?#]*)?(?:\?[^#]*)?(?:#.*)?$/i,th=/^(?=.{1,254}$)(?=.{1,64}@)[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+(\.[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+)*@[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?(\.[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?)*$/,ih=/^\s*(-|\+)?(\d+|(\d*(\.\d*)))([eE][+-]?\d+)?\s*$/,le=/^(\d{4,})-(\d{2})-(\d{2})$/,me=/^(\d{4,})-(\d\d)-(\d\d)T(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/,Mc=/^(\d{4,})-W(\d\d)$/,ne=/^(\d{4,})-(\d\d)$/, -oe=/^(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/,ce=T();r(["date","datetime-local","month","time","week"],function(a){ce[a]=!0});var pe={text:function(a,b,d,c,e,f){Sa(a,b,d,c,e,f);Hc(c)},date:nb("date",le,Qb(le,["yyyy","MM","dd"]),"yyyy-MM-dd"),"datetime-local":nb("datetimelocal",me,Qb(me,"yyyy MM dd HH mm ss sss".split(" ")),"yyyy-MM-ddTHH:mm:ss.sss"),time:nb("time",oe,Qb(oe,["HH","mm","ss","sss"]),"HH:mm:ss.sss"),week:nb("week",Mc,function(a,b){if(ha(a))return a;if(A(a)){Mc.lastIndex=0;var d=Mc.exec(a); -if(d){var c=+d[1],e=+d[2],f=d=0,g=0,k=0,h=Xd(c),e=7*(e-1);b&&(d=b.getHours(),f=b.getMinutes(),g=b.getSeconds(),k=b.getMilliseconds());return new Date(c,0,h.getDate()+e,d,f,g,k)}}return NaN},"yyyy-Www"),month:nb("month",ne,Qb(ne,["yyyy","MM"]),"yyyy-MM"),number:function(a,b,d,c,e,f,g,k){Ic(a,b,d,c,"number");de(c);Sa(a,b,d,c,e,f);var h;if(w(d.min)||d.ngMin){var l=d.min||k(d.ngMin)(a);h=na(l);c.$validators.min=function(a,b){return c.$isEmpty(b)||z(h)||b>=h};d.$observe("min",function(a){a!==l&&(h=na(a), -l=a,c.$validate())})}if(w(d.max)||d.ngMax){var m=d.max||k(d.ngMax)(a),p=na(m);c.$validators.max=function(a,b){return c.$isEmpty(b)||z(p)||b<=p};d.$observe("max",function(a){a!==m&&(p=na(a),m=a,c.$validate())})}if(w(d.step)||d.ngStep){var n=d.step||k(d.ngStep)(a),s=na(n);c.$validators.step=function(a,b){return c.$isEmpty(b)||z(s)||ee(b,h||0,s)};d.$observe("step",function(a){a!==n&&(s=na(a),n=a,c.$validate())})}},url:function(a,b,d,c,e,f){Sa(a,b,d,c,e,f);Hc(c);c.$validators.url=function(a,b){var d= -a||b;return c.$isEmpty(d)||sh.test(d)}},email:function(a,b,d,c,e,f){Sa(a,b,d,c,e,f);Hc(c);c.$validators.email=function(a,b){var d=a||b;return c.$isEmpty(d)||th.test(d)}},radio:function(a,b,d,c){var e=!d.ngTrim||"false"!==U(d.ngTrim);z(d.name)&&b.attr("name",++pb);b.on("change",function(a){var g;b[0].checked&&(g=d.value,e&&(g=U(g)),c.$setViewValue(g,a&&a.type))});c.$render=function(){var a=d.value;e&&(a=U(a));b[0].checked=a===c.$viewValue};d.$observe("value",c.$render)},range:function(a,b,d,c,e,f){function g(a, -c){b.attr(a,d[a]);var e=d[a];d.$observe(a,function(a){a!==e&&(e=a,c(a))})}function k(a){p=na(a);X(c.$modelValue)||(m?(a=b.val(),p>a&&(a=p,b.val(a)),c.$setViewValue(a)):c.$validate())}function h(a){n=na(a);X(c.$modelValue)||(m?(a=b.val(),n=p},g("min",k));e&&(n=na(d.max),c.$validators.max=m?function(){return!0}:function(a,b){return c.$isEmpty(b)||z(n)||b<=n},g("max",h));f&&(s=na(d.step),c.$validators.step=m?function(){return!r.stepMismatch}: -function(a,b){return c.$isEmpty(b)||z(s)||ee(b,p||0,s)},g("step",l))},checkbox:function(a,b,d,c,e,f,g,k){var h=fe(k,a,"ngTrueValue",d.ngTrueValue,!0),l=fe(k,a,"ngFalseValue",d.ngFalseValue,!1);b.on("change",function(a){c.$setViewValue(b[0].checked,a&&a.type)});c.$render=function(){b[0].checked=c.$viewValue};c.$isEmpty=function(a){return!1===a};c.$formatters.push(function(a){return va(a,h)});c.$parsers.push(function(a){return a?h:l})},hidden:E,button:E,submit:E,reset:E,file:E},Yc=["$browser","$sniffer", -"$filter","$parse",function(a,b,d,c){return{restrict:"E",require:["?ngModel"],link:{pre:function(e,f,g,k){k[0]&&(pe[K(g.type)]||pe.text)(e,f,g,k[0],b,a,d,c)}}}}],vf=function(){var a={configurable:!0,enumerable:!1,get:function(){return this.getAttribute("value")||""},set:function(a){this.setAttribute("value",a)}};return{restrict:"E",priority:200,compile:function(b,d){if("hidden"===K(d.type))return{pre:function(b,d,f,g){b=d[0];b.parentNode&&b.parentNode.insertBefore(b,b.nextSibling);Object.defineProperty&& -Object.defineProperty(b,"value",a)}}}}},uh=/^(true|false|\d+)$/,sf=function(){function a(a,d,c){var e=w(c)?c:9===Ca?"":null;a.prop("value",e);d.$set("value",c)}return{restrict:"A",priority:100,compile:function(b,d){return uh.test(d.ngValue)?function(b,d,f){b=b.$eval(f.ngValue);a(d,f,b)}:function(b,d,f){b.$watch(f.ngValue,function(b){a(d,f,b)})}}}},Re=["$compile",function(a){return{restrict:"AC",compile:function(b){a.$$addBindingClass(b);return function(b,c,e){a.$$addBindingInfo(c,e.ngBind);c=c[0]; -b.$watch(e.ngBind,function(a){c.textContent=ic(a)})}}}}],Te=["$interpolate","$compile",function(a,b){return{compile:function(d){b.$$addBindingClass(d);return function(c,d,f){c=a(d.attr(f.$attr.ngBindTemplate));b.$$addBindingInfo(d,c.expressions);d=d[0];f.$observe("ngBindTemplate",function(a){d.textContent=z(a)?"":a})}}}}],Se=["$sce","$parse","$compile",function(a,b,d){return{restrict:"A",compile:function(c,e){var f=b(e.ngBindHtml),g=b(e.ngBindHtml,function(b){return a.valueOf(b)});d.$$addBindingClass(c); -return function(b,c,e){d.$$addBindingInfo(c,e.ngBindHtml);b.$watch(g,function(){var d=f(b);c.html(a.getTrustedHtml(d)||"")})}}}}],rf=ia({restrict:"A",require:"ngModel",link:function(a,b,d,c){c.$viewChangeListeners.push(function(){a.$eval(d.ngChange)})}}),Ue=Kc("",!0),We=Kc("Odd",0),Ve=Kc("Even",1),Xe=Ra({compile:function(a,b){b.$set("ngCloak",void 0);a.removeClass("ng-cloak")}}),Ye=[function(){return{restrict:"A",scope:!0,controller:"@",priority:500}}],cd={},vh={blur:!0,focus:!0};r("click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave keydown keyup keypress submit focus blur copy cut paste".split(" "), -function(a){var b=wa("ng-"+a);cd[b]=["$parse","$rootScope","$exceptionHandler",function(d,c,e){return qd(d,c,e,b,a,vh[a])}]});var af=["$animate","$compile",function(a,b){return{multiElement:!0,transclude:"element",priority:600,terminal:!0,restrict:"A",$$tlb:!0,link:function(d,c,e,f,g){var k,h,l;d.$watch(e.ngIf,function(d){d?h||g(function(d,f){h=f;d[d.length++]=b.$$createComment("end ngIf",e.ngIf);k={clone:d};a.enter(d,c.parent(),c)}):(l&&(l.remove(),l=null),h&&(h.$destroy(),h=null),k&&(l=tb(k.clone), -a.leave(l).done(function(a){!1!==a&&(l=null)}),k=null))})}}}],bf=["$templateRequest","$anchorScroll","$animate",function(a,b,d){return{restrict:"ECA",priority:400,terminal:!0,transclude:"element",controller:ca.noop,compile:function(c,e){var f=e.ngInclude||e.src,g=e.onload||"",k=e.autoscroll;return function(c,e,m,p,n){var r=0,q,t,x,v=function(){t&&(t.remove(),t=null);q&&(q.$destroy(),q=null);x&&(d.leave(x).done(function(a){!1!==a&&(t=null)}),t=x,x=null)};c.$watch(f,function(f){var m=function(a){!1=== -a||!w(k)||k&&!c.$eval(k)||b()},t=++r;f?(a(f,!0).then(function(a){if(!c.$$destroyed&&t===r){var b=c.$new();p.template=a;a=n(b,function(a){v();d.enter(a,null,e).done(m)});q=b;x=a;q.$emit("$includeContentLoaded",f);c.$eval(g)}},function(){c.$$destroyed||t!==r||(v(),c.$emit("$includeContentError",f))}),c.$emit("$includeContentRequested",f)):(v(),p.template=null)})}}}}],uf=["$compile",function(a){return{restrict:"ECA",priority:-400,require:"ngInclude",link:function(b,d,c,e){la.call(d[0]).match(/SVG/)? -(d.empty(),a(ed(e.template,C.document).childNodes)(b,function(a){d.append(a)},{futureParentElement:d})):(d.html(e.template),a(d.contents())(b))}}}],cf=Ra({priority:450,compile:function(){return{pre:function(a,b,d){a.$eval(d.ngInit)}}}}),qf=function(){return{restrict:"A",priority:100,require:"ngModel",link:function(a,b,d,c){var e=d.ngList||", ",f="false"!==d.ngTrim,g=f?U(e):e;c.$parsers.push(function(a){if(!z(a)){var b=[];a&&r(a.split(g),function(a){a&&b.push(f?U(a):a)});return b}});c.$formatters.push(function(a){if(H(a))return a.join(e)}); -c.$isEmpty=function(a){return!a||!a.length}}}},mb="ng-valid",$d="ng-invalid",Za="ng-pristine",Vb="ng-dirty",ob=F("ngModel");Rb.$inject="$scope $exceptionHandler $attrs $element $parse $animate $timeout $q $interpolate".split(" ");Rb.prototype={$$initGetterSetters:function(){if(this.$options.getOption("getterSetter")){var a=this.$$parse(this.$$attr.ngModel+"()"),b=this.$$parse(this.$$attr.ngModel+"($$$p)");this.$$ngModelGet=function(b){var c=this.$$parsedNgModel(b);B(c)&&(c=a(b));return c};this.$$ngModelSet= -function(a,c){B(this.$$parsedNgModel(a))?b(a,{$$$p:c}):this.$$parsedNgModelAssign(a,c)}}else if(!this.$$parsedNgModel.assign)throw ob("nonassign",this.$$attr.ngModel,za(this.$$element));},$render:E,$isEmpty:function(a){return z(a)||""===a||null===a||a!==a},$$updateEmptyClasses:function(a){this.$isEmpty(a)?(this.$$animate.removeClass(this.$$element,"ng-not-empty"),this.$$animate.addClass(this.$$element,"ng-empty")):(this.$$animate.removeClass(this.$$element,"ng-empty"),this.$$animate.addClass(this.$$element, -"ng-not-empty"))},$setPristine:function(){this.$dirty=!1;this.$pristine=!0;this.$$animate.removeClass(this.$$element,Vb);this.$$animate.addClass(this.$$element,Za)},$setDirty:function(){this.$dirty=!0;this.$pristine=!1;this.$$animate.removeClass(this.$$element,Za);this.$$animate.addClass(this.$$element,Vb);this.$$parentForm.$setDirty()},$setUntouched:function(){this.$touched=!1;this.$untouched=!0;this.$$animate.setClass(this.$$element,"ng-untouched","ng-touched")},$setTouched:function(){this.$touched= -!0;this.$untouched=!1;this.$$animate.setClass(this.$$element,"ng-touched","ng-untouched")},$rollbackViewValue:function(){this.$$timeout.cancel(this.$$pendingDebounce);this.$viewValue=this.$$lastCommittedViewValue;this.$render()},$validate:function(){if(!X(this.$modelValue)){var a=this.$$lastCommittedViewValue,b=this.$$rawModelValue,d=this.$valid,c=this.$modelValue,e=this.$options.getOption("allowInvalid"),f=this;this.$$runValidators(b,a,function(a){e||d===a||(f.$modelValue=a?b:void 0,f.$modelValue!== -c&&f.$$writeModelToScope())})}},$$runValidators:function(a,b,d){function c(){var c=!0;r(h.$validators,function(d,e){var g=Boolean(d(a,b));c=c&&g;f(e,g)});return c?!0:(r(h.$asyncValidators,function(a,b){f(b,null)}),!1)}function e(){var c=[],d=!0;r(h.$asyncValidators,function(e,g){var h=e(a,b);if(!h||!B(h.then))throw ob("nopromise",h);f(g,void 0);c.push(h.then(function(){f(g,!0)},function(){d=!1;f(g,!1)}))});c.length?h.$$q.all(c).then(function(){g(d)},E):g(!0)}function f(a,b){k===h.$$currentValidationRunId&& -h.$setValidity(a,b)}function g(a){k===h.$$currentValidationRunId&&d(a)}this.$$currentValidationRunId++;var k=this.$$currentValidationRunId,h=this;(function(){var a=h.$$parserName;if(z(h.$$parserValid))f(a,null);else return h.$$parserValid||(r(h.$validators,function(a,b){f(b,null)}),r(h.$asyncValidators,function(a,b){f(b,null)})),f(a,h.$$parserValid),h.$$parserValid;return!0})()?c()?e():g(!1):g(!1)},$commitViewValue:function(){var a=this.$viewValue;this.$$timeout.cancel(this.$$pendingDebounce);if(this.$$lastCommittedViewValue!== -a||""===a&&this.$$hasNativeValidators)this.$$updateEmptyClasses(a),this.$$lastCommittedViewValue=a,this.$pristine&&this.$setDirty(),this.$$parseAndValidate()},$$parseAndValidate:function(){var a=this.$$lastCommittedViewValue,b=this;this.$$parserValid=z(a)?void 0:!0;this.$setValidity(this.$$parserName,null);this.$$parserName="parse";if(this.$$parserValid)for(var d=0;dg||e.$isEmpty(b)||b.length<=g}}}}}],ad=["$parse",function(a){return{restrict:"A",require:"?ngModel",link:function(b,d,c,e){if(e){var f=c.minlength||a(c.ngMinlength)(b),g=Tb(f)||-1;c.$observe("minlength",function(a){f!==a&&(g=Tb(a)||-1,f=a,e.$validate())}); -e.$validators.minlength=function(a,b){return e.$isEmpty(b)||b.length>=g}}}}}];C.angular.bootstrap?C.console&&console.log("WARNING: Tried to load AngularJS more than once."):(Fe(),Je(ca),ca.module("ngLocale",[],["$provide",function(a){function b(a){a+="";var b=a.indexOf(".");return-1==b?0:a.length-b-1}a.value("$locale",{DATETIME_FORMATS:{AMPMS:["AM","PM"],DAY:"Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),ERANAMES:["Before Christ","Anno Domini"],ERAS:["BC","AD"],FIRSTDAYOFWEEK:6, -MONTH:"January February March April May June July August September October November December".split(" "),SHORTDAY:"Sun Mon Tue Wed Thu Fri Sat".split(" "),SHORTMONTH:"Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),STANDALONEMONTH:"January February March April May June July August September October November December".split(" "),WEEKENDRANGE:[5,6],fullDate:"EEEE, MMMM d, y",longDate:"MMMM d, y",medium:"MMM d, y h:mm:ss a",mediumDate:"MMM d, y",mediumTime:"h:mm:ss a","short":"M/d/yy h:mm a", -shortDate:"M/d/yy",shortTime:"h:mm a"},NUMBER_FORMATS:{CURRENCY_SYM:"$",DECIMAL_SEP:".",GROUP_SEP:",",PATTERNS:[{gSize:3,lgSize:3,maxFrac:3,minFrac:0,minInt:1,negPre:"-",negSuf:"",posPre:"",posSuf:""},{gSize:3,lgSize:3,maxFrac:2,minFrac:2,minInt:1,negPre:"-\u00a4",negSuf:"",posPre:"\u00a4",posSuf:""}]},id:"en-us",localeID:"en_US",pluralCat:function(a,c){var e=a|0,f=c;void 0===f&&(f=Math.min(b(a),3));Math.pow(10,f);return 1==e&&0==f?"one":"other"}})}]),x(function(){Ae(C.document,Uc)}))})(window); -!window.angular.$$csp().noInlineStyle&&window.angular.element(document.head).prepend(''); -//# sourceMappingURL=angular.min.js.map diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/angular/angular.min.js.gzip b/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/angular/angular.min.js.gzip deleted file mode 100755 index 9ca10082c..000000000 Binary files a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/angular/angular.min.js.gzip and /dev/null differ diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/angular/angular.min.js.map b/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/angular/angular.min.js.map deleted file mode 100755 index 6e6c3fed7..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/angular/angular.min.js.map +++ /dev/null @@ -1,8 +0,0 @@ -{ -"version":3, -"file":"angular.min.js", -"lineCount":349, -"mappings":"A;;;;;aAKC,SAAQ,CAACA,CAAD,CAAS,CAwClBC,QAASA,GAAmB,CAACC,CAAD,CAAS,CACnC,GAAIC,CAAA,CAASD,CAAT,CAAJ,CACME,CAAA,CAAUF,CAAAG,eAAV,CAGJ,GAFEC,EAAAD,eAEF,CAFgCE,EAAA,CAAsBL,CAAAG,eAAtB,CAAA,CAA+CH,CAAAG,eAA/C,CAAuEG,GAEvG,EAAIJ,CAAA,CAAUF,CAAAO,sBAAV,CAAJ,EAA+CC,EAAA,CAAUR,CAAAO,sBAAV,CAA/C,GACEH,EAAAG,sBADF,CACuCP,CAAAO,sBADvC,CAJF,KAQE,OAAOH,GAT0B,CAkBrCC,QAASA,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AI90B,CAAJ,EAAsB,CAAtB,EA1HnF80B,CA0HmF,CA1ItDuiE,KA0IsD,CA1IFC,OA0IpD,CAvHhB,CAA1B,CApB+D,CAAhC,CAA/B,CA+IE,CAAAt4F,CAAA,CAAO,QAAQ,EAAG,CAChByL,EAAA,CAAY5M,CAAAyJ,SAAZ,CAA6BoD,EAA7B,CADgB,CAAlB,CA7JF,CAp6mCkB,CAAjB,CAAD,CAqknCG7M,MArknCH,CAuknCC2rE;CAAA3rE,MAAA0O,QAAAgrF,MAAA,EAAA/tB,cAAD,EAAyC3rE,MAAA0O,QAAAvI,QAAA,CAAuBsD,QAAAkwF,KAAvB,CAAArqB,QAAA,CAA8C,gRAA9C;", -"sources":["angular.js"], -"names":["window","errorHandlingConfig","config","isObject","isDefined","objectMaxDepth","minErrConfig","isValidObjectMaxDepth","NaN","urlErrorParamsEnabled","isBoolean","maxDepth","isNumber","minErr","isArrayLike","obj","isWindow","isArray","isString","jqLite","length","Object","item","forEach","iterator","context","key","isFunction","hasOwnProperty","call","isPrimitive","isBlankObject","forEachSorted","keys","sort","i","reverseParams","iteratorFn","value","nextUid","uid","baseExtend","dst","objs","deep","h","$$hashKey","ii","j","jj","src","isDate","Date","valueOf","isRegExp","RegExp","nodeName","cloneNode","isElement","clone","extend","slice","arguments","merge","toInt","str","parseInt","inherit","parent","extra","create","noop","identity","$","valueFn","valueRef","hasCustomToString","toString","isUndefined","getPrototypeOf","arr","Array","isError","tag","Error","isScope","$evalAsync","$watch","isTypedArray","TYPED_ARRAY_REGEXP","test","node","prop","attr","find","makeMap","items","split","nodeName_","element","lowercase","arrayRemove","array","index","indexOf","splice","copy","source","destination","copyRecurse","push","copyElement","stackSource","stackDest","ngMinErr","needsRecurse","copyType","undefined","constructor","buffer","byteOffset","copied","ArrayBuffer","byteLength","set","Uint8Array","re","match","lastIndex","type","simpleCompare","a","b","equals","o1","o2","t1","t2","getTime","keySet","createMap","charAt","concat","array1","array2","bind","self","fn","curryArgs","startIndex","apply","toJsonReplacer","val","document","toJson","pretty","JSON","stringify","fromJson","json","parse","timezoneToOffset","timezone","fallback","replace","ALL_COLONS","requestedTimezoneOffset","isNumberNaN","addDateMinutes","date","minutes","setMinutes","getMinutes","convertTimezoneToLocal","reverse","dateTimezoneOffset","getTimezoneOffset","timezoneOffset","startingTag","empty","elemHtml","append","html","nodeType","NODE_TYPE_TEXT","e","tryDecodeURIComponent","decodeURIComponent","parseKeyValue","keyValue","splitPoint","substring","toKeyValue","parts","arrayValue","encodeUriQuery","join","encodeUriSegment","pctEncodeSpaces","encodeURIComponent","getNgAttribute","ngAttr","ngAttrPrefixes","getAttribute","angularInit","bootstrap","appElement","module","prefix","name","hasAttribute","candidate","querySelector","isAutoBootstrapAllowed","strictDi","console","error","modules","defaultConfig","doBootstrap","injector","unshift","$provide","debugInfoEnabled","$compileProvider","createInjector","invoke","bootstrapApply","scope","compile","$apply","data","NG_ENABLE_DEBUG_INFO","NG_DEFER_BOOTSTRAP","angular","resumeBootstrap","angular.resumeBootstrap","extraModules","resumeDeferredBootstrap","reloadWithDebugInfo","location","reload","getTestability","rootElement","get","snake_case","separator","SNAKE_CASE_REGEXP","letter","pos","toLowerCase","bindJQuery","originalCleanData","bindJQueryFired","jqName","jq","jQuery","on","JQLitePrototype","isolateScope","controller","inheritedData","JQLite","cleanData","jqLite.cleanData","elems","events","elem","_data","$destroy","triggerHandler","assertArg","arg","reason","assertArgFn","acceptArrayAnnotation","assertNotHasOwnProperty","getter","path","bindFnToScope","lastInstance","len","getBlockNodes","nodes","endNode","blockNodes","nextSibling","setupModuleLoader","ensure","factory","$injectorMinErr","$$minErr","requires","configFn","info","invokeLater","provider","method","insertMethod","queue","invokeQueue","moduleInstance","invokeLaterAndSetModuleName","recipeName","factoryFunction","$$moduleName","configBlocks","runBlocks","_invokeQueue","_configBlocks","_runBlocks","service","constant","decorator","animation","filter","directive","component","run","block","shallowCopy","serializeObject","seen","publishExternalAPI","version","$$counter","csp","uppercase","angularModule","ngModule","$$sanitizeUri","$$SanitizeUriProvider","$CompileProvider","htmlAnchorDirective","input","inputDirective","textarea","form","formDirective","script","scriptDirective","select","selectDirective","option","optionDirective","ngBind","ngBindDirective","ngBindHtml","ngBindHtmlDirective","ngBindTemplate","ngBindTemplateDirective","ngClass","ngClassDirective","ngClassEven","ngClassEvenDirective","ngClassOdd","ngClassOddDirective","ngCloak","ngCloakDirective","ngController","ngControllerDirective","ngForm","ngFormDirective","ngHide","ngHideDirective","ngIf","ngIfDirective","ngInclude","ngIncludeDirective","ngInit","ngInitDirective","ngNonBindable","ngNonBindableDirective","ngPluralize","ngPluralizeDirective","ngRef","ngRefDirective","ngRepeat","ngRepeatDirective","ngShow","ngShowDirective","ngStyle","ngStyleDirective","ngSwitch","ngSwitchDirective","ngSwitchWhen","ngSwitchWhenDirective","ngSwitchDefault","ngSwitchDefaultDirective","ngOptions","ngOptionsDirective","ngTransclude","ngTranscludeDirective","ngModel","ngModelDirective","ngList","ngListDirective","ngChange","ngChangeDirective","pattern","patternDirective","ngPattern","required","requiredDirective","ngRequired","minlength","minlengthDirective","ngMinlength","maxlength","maxlengthDirective","ngMaxlength","ngValue","ngValueDirective","ngModelOptions","ngModelOptionsDirective","ngIncludeFillContentDirective","hiddenInputBrowserCacheDirective","ngAttributeAliasDirectives","ngEventDirectives","$anchorScroll","$AnchorScrollProvider","$animate","$AnimateProvider","$animateCss","$CoreAnimateCssProvider","$$animateJs","$$CoreAnimateJsProvider","$$animateQueue","$$CoreAnimateQueueProvider","$$AnimateRunner","$$AnimateRunnerFactoryProvider","$$animateAsyncRun","$$AnimateAsyncRunFactoryProvider","$browser","$BrowserProvider","$cacheFactory","$CacheFactoryProvider","$controller","$ControllerProvider","$document","$DocumentProvider","$$isDocumentHidden","$$IsDocumentHiddenProvider","$exceptionHandler","$ExceptionHandlerProvider","$filter","$FilterProvider","$$forceReflow","$$ForceReflowProvider","$interpolate","$InterpolateProvider","$interval","$IntervalProvider","$$intervalFactory","$$IntervalFactoryProvider","$http","$HttpProvider","$httpParamSerializer","$HttpParamSerializerProvider","$httpParamSerializerJQLike","$HttpParamSerializerJQLikeProvider","$httpBackend","$HttpBackendProvider","$xhrFactory","$xhrFactoryProvider","$jsonpCallbacks","$jsonpCallbacksProvider","$location","$LocationProvider","$log","$LogProvider","$parse","$ParseProvider","$rootScope","$RootScopeProvider","$q","$QProvider","$$q","$$QProvider","$sce","$SceProvider","$sceDelegate","$SceDelegateProvider","$sniffer","$SnifferProvider","$$taskTrackerFactory","$$TaskTrackerFactoryProvider","$templateCache","$TemplateCacheProvider","$templateRequest","$TemplateRequestProvider","$$testability","$$TestabilityProvider","$timeout","$TimeoutProvider","$window","$WindowProvider","$$rAF","$$RAFProvider","$$jqLite","$$jqLiteProvider","$$Map","$$MapProvider","$$cookieReader","$$CookieReaderProvider","angularVersion","fnCamelCaseReplace","all","toUpperCase","kebabToCamel","DASH_LOWERCASE_REGEXP","jqLiteAcceptsData","NODE_TYPE_ELEMENT","NODE_TYPE_DOCUMENT","jqLiteBuildFragment","tmp","fragment","createDocumentFragment","HTML_REGEXP","appendChild","createElement","TAG_NAME_REGEXP","exec","wrap","wrapMap","_default","innerHTML","XHTML_TAG_REGEXP","lastChild","childNodes","firstChild","textContent","createTextNode","argIsString","trim","jqLiteMinErr","parsed","SINGLE_TAG_REGEXP","jqLiteAddNodes","jqLiteReady","jqLiteClone","jqLiteDealoc","onlyDescendants","querySelectorAll","isEmptyObject","removeIfEmptyData","expandoId","ng339","expandoStore","jqCache","jqLiteOff","unsupported","jqLiteExpandoStore","handle","removeHandler","listenerFns","removeEventListener","MOUSE_EVENT_MAP","jqLiteRemoveData","createIfNecessary","jqId","jqLiteData","isSimpleSetter","isSimpleGetter","massGetter","jqLiteHasClass","selector","jqLiteRemoveClass","cssClasses","setAttribute","existingClasses","newClasses","cssClass","jqLiteAddClass","root","elements","jqLiteController","jqLiteInheritedData","documentElement","names","parentNode","NODE_TYPE_DOCUMENT_FRAGMENT","host","jqLiteEmpty","removeChild","jqLiteRemove","keepData","jqLiteDocumentLoaded","action","win","readyState","setTimeout","trigger","addEventListener","getBooleanAttrName","booleanAttr","BOOLEAN_ATTR","BOOLEAN_ELEMENTS","createEventHandler","eventHandler","event","isDefaultPrevented","event.isDefaultPrevented","defaultPrevented","eventFns","eventFnsLength","immediatePropagationStopped","originalStopImmediatePropagation","stopImmediatePropagation","event.stopImmediatePropagation","stopPropagation","isImmediatePropagationStopped","event.isImmediatePropagationStopped","handlerWrapper","specialHandlerWrapper","defaultHandlerWrapper","handler","specialMouseHandlerWrapper","target","related","relatedTarget","jqLiteContains","$get","this.$get","hasClass","classes","addClass","removeClass","hashKey","nextUidFn","objType","NgMapShim","_keys","_values","_lastKey","_lastIndex","extractArgs","fnText","Function","prototype","STRIP_COMMENTS","ARROW_ARG","FN_ARGS","anonFn","args","modulesToLoad","supportObject","delegate","provider_","providerInjector","instantiate","providerCache","providerSuffix","enforceReturnValue","enforcedReturnValue","result","instanceInjector","factoryFn","enforce","loadModules","moduleFn","runInvokeQueue","invokeArgs","loadedModules","message","stack","createInternalInjector","cache","getService","serviceName","caller","INSTANTIATING","err","shift","injectionArgs","locals","$inject","$$annotate","msie","func","$$ngIsClass","Type","ctor","annotate","has","NgMap","$injector","instanceCache","decorFn","origProvider","orig$get","origProvider.$get","origInstance","$delegate","protoInstanceInjector","loadNewModules","instanceInjector.loadNewModules","mods","autoScrollingEnabled","disableAutoScrolling","this.disableAutoScrolling","getFirstAnchor","list","some","scrollTo","scrollIntoView","offset","scroll","yOffset","getComputedStyle","style","position","getBoundingClientRect","bottom","elemTop","top","scrollBy","hash","elm","getElementById","getElementsByName","autoScrollWatch","autoScrollWatchAction","newVal","oldVal","mergeClasses","splitClasses","klass","prepareAnimateOptions","options","Browser","cacheStateAndFireUrlChange","pendingLocation","fireStateOrUrlChange","cacheState","cachedState","getCurrentState","lastCachedState","lastHistoryState","prevLastHistoryState","lastBrowserUrl","url","urlChangeListeners","listener","history","clearTimeout","pendingDeferIds","taskTracker","isMock","$$completeOutstandingRequest","completeTask","$$incOutstandingRequestCount","incTaskCount","notifyWhenNoOutstandingRequests","notifyWhenNoPendingTasks","href","baseElement","state","self.url","sameState","urlResolve","sameBase","stripHash","substr","self.state","urlChangeInit","onUrlChange","self.onUrlChange","callback","$$applicationDestroyed","self.$$applicationDestroyed","off","$$checkUrlChange","baseHref","self.baseHref","defer","self.defer","delay","taskType","timeoutId","DEFAULT_TASK_TYPE","cancel","self.defer.cancel","deferId","cacheFactory","cacheId","refresh","entry","freshEnd","staleEnd","n","link","p","nextEntry","prevEntry","caches","size","stats","id","capacity","Number","MAX_VALUE","lruHash","put","lruEntry","remove","removeAll","destroy","cacheFactory.info","cacheFactory.get","$$sanitizeUriProvider","parseIsolateBindings","directiveName","isController","LOCAL_REGEXP","bindings","definition","scopeName","bindingCache","$compileMinErr","mode","collection","optional","attrName","assertValidDirectiveName","getDirectiveRequire","require","REQUIRE_PREFIX_REGEXP","hasDirectives","COMMENT_DIRECTIVE_REGEXP","CLASS_DIRECTIVE_REGEXP","ALL_OR_NOTHING_ATTRS","EVENT_HANDLER_ATTR_REGEXP","this.directive","registerDirective","directiveFactory","Suffix","directives","priority","restrict","this.component","registerComponent","makeInjectable","tElement","tAttrs","$element","$attrs","template","templateUrl","ddo","controllerAs","identifierForController","transclude","bindToController","aHrefSanitizationWhitelist","this.aHrefSanitizationWhitelist","regexp","imgSrcSanitizationWhitelist","this.imgSrcSanitizationWhitelist","this.debugInfoEnabled","enabled","strictComponentBindingsEnabled","this.strictComponentBindingsEnabled","TTL","onChangesTtl","this.onChangesTtl","commentDirectivesEnabledConfig","commentDirectivesEnabled","this.commentDirectivesEnabled","cssClassDirectivesEnabledConfig","cssClassDirectivesEnabled","this.cssClassDirectivesEnabled","PROP_CONTEXTS","addPropertySecurityContext","this.addPropertySecurityContext","elementName","propertyName","ctx","registerNativePropertyContexts","registerContext","values","v","SCE_CONTEXTS","HTML","CSS","URL","MEDIA_URL","RESOURCE_URL","flushOnChangesQueue","onChangesQueue","sanitizeSrcset","invokeType","trimmedSrcset","srcPattern","rawUris","nbrUrisWith2parts","Math","floor","innerIdx","getTrustedMediaUrl","lastTuple","Attributes","attributesToCopy","l","$attr","$$element","setSpecialAttr","specialAttrHolder","attributes","attribute","removeNamedItem","setNamedItem","safeAddClass","className","$compileNodes","transcludeFn","maxPriority","ignoreDirective","previousCompileContext","compositeLinkFn","compileNodes","$$addScopeClass","namespace","publicLinkFn","cloneConnectFn","needsNewScope","$parent","$new","parentBoundTranscludeFn","transcludeControllers","futureParentElement","$$boundTransclude","$linkNode","wrapTemplate","controllerName","instance","$$addScopeInfo","nodeList","$rootElement","childLinkFn","childScope","childBoundTranscludeFn","stableNodeList","nodeLinkFnFound","linkFns","idx","nodeLinkFn","transcludeOnThisElement","createBoundTranscludeFn","templateOnThisElement","notLiveList","attrs","linkFnFound","mergeConsecutiveTextNodes","collectDirectives","applyDirectivesToNode","terminal","sibling","nodeValue","previousBoundTranscludeFn","boundTranscludeFn","transcludedScope","cloneFn","controllers","containingScope","$$transcluded","boundSlots","$$slots","slotName","attrsMap","addDirective","directiveNormalize","nName","ngPrefixMatch","nAttrs","attrStartName","attrEndName","isNgAttr","isNgProp","isNgEvent","multiElementMatch","NG_PREFIX_BINDING","PREFIX_REGEXP","MULTI_ELEMENT_DIR_RE","directiveIsMultiElement","addPropertyDirective","createEventDirective","addAttrInterpolateDirective","animVal","addTextInterpolateDirective","NODE_TYPE_COMMENT","collectCommentDirectives","byPriority","groupScan","attrStart","attrEnd","depth","groupElementsLinkFnWrapper","linkFn","groupedElementsLink","compilationGenerator","eager","compiled","lazyCompilation","compileNode","templateAttrs","jqCollection","originalReplaceDirective","preLinkFns","postLinkFns","addLinkFns","pre","post","newIsolateScopeDirective","$$isolateScope","cloneAndAnnotateFn","linkNode","controllersBoundTransclude","cloneAttachFn","hasElementTranscludeDirective","elementControllers","slotTranscludeFn","scopeToChild","controllerScope","newScopeDirective","isSlotFilled","transcludeFn.isSlotFilled","controllerDirectives","setupControllers","templateDirective","$$originalDirective","$$isolateBindings","scopeBindingInfo","initializeDirectiveBindings","removeWatches","$on","controllerDirective","$$bindings","bindingInfo","getControllers","controllerInstance","$onChanges","initialChanges","$onInit","$doCheck","$onDestroy","callOnDestroyHook","invokeLinkFn","$postLink","terminalPriority","nonTlbTranscludeDirective","hasTranscludeDirective","hasTemplate","$compileNode","$template","childTranscludeFn","didScanForMultipleTransclusion","mightHaveMultipleTransclusionError","directiveValue","$$start","$$end","assertNoDuplicate","$$tlb","scanningIndex","candidateDirective","$$createComment","replaceWith","replaceDirective","slots","slotMap","filledSlots","elementSelector","contents","filled","slotCompileNodes","$$newScope","denormalizeTemplate","removeComments","templateNamespace","newTemplateAttrs","templateDirectives","unprocessedDirectives","markDirectiveScope","mergeTemplateAttributes","compileTemplateUrl","max","inheritType","dataName","property","controllerKey","$scope","$transclude","newScope","tDirectives","startAttrName","endAttrName","multiElement","srcAttr","dstAttr","$set","linkQueue","afterTemplateNodeLinkFn","afterTemplateChildLinkFn","beforeTemplateCompileNode","origAsyncDirective","derivedSyncDirective","then","content","tempTemplateAttrs","beforeTemplateLinkNode","linkRootElement","$$destroyed","oldClasses","catch","delayedNodeLinkFn","ignoreChildLinkFn","diff","what","previousDirective","wrapModuleNameIfDefined","moduleName","text","interpolateFn","textInterpolateCompileFn","templateNode","templateNodeParent","hasCompileParent","$$addBindingClass","textInterpolateLinkFn","$$addBindingInfo","expressions","interpolateFnWatchAction","wrapper","getTrustedAttrContext","attrNormalizedName","getTrustedPropContext","propNormalizedName","sanitizeSrcsetPropertyValue","propName","trustedContext","sanitizer","getTrusted","ngPropCompileFn","_","ngPropGetter","ngPropWatch","sceValueOf","ngPropPreLinkFn","applyPropValue","propValue","allOrNothing","mustHaveExpression","attrInterpolatePreLinkFn","$$observers","newValue","$$inter","$$scope","oldValue","$updateClass","elementsToRemove","newNode","firstElementToRemove","removeCount","j2","replaceChild","hasData","annotation","strictBindingsCheck","recordChanges","currentValue","previousValue","$$postDigest","changes","triggerOnChangesHook","SimpleChange","removeWatchCollection","initializeBinding","lastValue","parentGet","parentSet","compare","removeWatch","$observe","_UNINITIALIZED_VALUE","literal","assign","parentValueWatch","parentValue","$stateful","$watchCollection","isLiteral","initialValue","parentValueWatchAction","SIMPLE_ATTR_NAME","$normalize","$addClass","classVal","$removeClass","toAdd","tokenDifference","toRemove","writeAttr","booleanKey","aliasedKey","ALIASED_ATTR","observer","removeAttr","listeners","startSymbol","endSymbol","binding","isolated","noTemplate","compile.$$createComment","comment","createComment","previous","current","SPECIAL_CHARS_REGEXP","str1","str2","tokens1","tokens2","token","jqNodes","ident","CNTRL_REG","this.has","register","this.register","addIdentifier","identifier","expression","later","$controllerMinErr","controllerPrototype","$controllerInit","changeListener","hidden","doc","exception","cause","serializeValue","toISOString","ngParamSerializer","params","jQueryLikeParamSerializer","serialize","toSerialize","topLevel","defaultHttpResponseTransform","headers","tempData","JSON_PROTECTION_PREFIX","contentType","hasJsonContentType","APPLICATION_JSON","jsonStart","JSON_START","JSON_ENDS","$httpMinErr","parseHeaders","line","headerVal","headerKey","headersGetter","headersObj","transformData","status","fns","defaults","transformResponse","transformRequest","d","common","CONTENT_TYPE_APPLICATION_JSON","patch","xsrfCookieName","xsrfHeaderName","paramSerializer","jsonpCallbackParam","useApplyAsync","this.useApplyAsync","interceptorFactories","interceptors","xsrfWhitelistedOrigins","requestConfig","chainInterceptors","promise","thenFn","rejectFn","executeHeaderFns","headerContent","processedHeaders","headerFn","header","response","resp","reject","mergeHeaders","defHeaders","reqHeaders","defHeaderName","lowercaseDefHeaderName","reqHeaderName","requestInterceptors","responseInterceptors","resolve","reversedInterceptors","interceptor","request","requestError","responseError","serverRequest","reqData","withCredentials","sendReq","finally","completeOutstandingRequest","createApplyHandlers","eventHandlers","applyHandlers","callEventHandler","$applyAsync","$$phase","done","headersString","statusText","xhrStatus","resolveHttpPromise","resolvePromise","deferred","resolvePromiseWithResult","removePendingReq","pendingRequests","cachedResp","isJsonp","getTrustedResourceUrl","buildUrl","sanitizeJsonpCallbackParam","defaultCache","xsrfValue","urlIsAllowedOrigin","timeout","responseType","uploadEventHandlers","serializedParams","cbKey","interceptorFactory","urlIsAllowedOriginFactory","createShortMethods","createShortMethodsWithData","createXhr","XMLHttpRequest","createHttpBackend","$browserDefer","callbacks","rawDocument","jsonpReq","callbackPath","async","body","wasCalled","timeoutRequest","abortedByTimeout","jsonpDone","xhr","abort","completeRequest","createCallback","getResponse","removeCallback","open","setRequestHeader","onload","xhr.onload","responseText","protocol","getAllResponseHeaders","onerror","ontimeout","requestTimeout","onabort","requestAborted","upload","send","$$timeoutId","this.startSymbol","this.endSymbol","escape","ch","unescapeText","escapedStartRegexp","escapedEndRegexp","constantWatchDelegate","objectEquality","constantInterp","unwatch","constantInterpolateWatch","parseStringifyInterceptor","contextAllowsConcatenation","$interpolateMinErr","interr","unescapedText","exp","$$watchDelegate","endIndex","parseFns","textLength","expressionPositions","singleExpression","startSymbolLength","endSymbolLength","map","compute","throwNoconcat","interpolationFn","$watchGroup","interpolateFnWatcher","oldValues","currValue","$interpolate.startSymbol","$interpolate.endSymbol","intervals","clearIntervalFn","clearInterval","interval","setIntervalFn","tick","setInterval","interval.cancel","$intervalMinErr","$$intervalId","q","$$state","pur","intervalFactory","intervalFn","count","invokeApply","hasParams","iteration","skipApply","notify","parseAbsoluteUrl","absoluteUrl","locationObj","parsedUrl","$$protocol","$$host","hostname","$$port","port","DEFAULT_PORTS","parseAppUrl","html5Mode","DOUBLE_SLASH_REGEX","$locationMinErr","prefixed","segments","pathname","$$path","$$search","search","$$hash","startsWith","stripBaseUrl","base","LocationHtml5Url","appBase","appBaseNoFile","basePrefix","$$html5","$$parse","this.$$parse","pathUrl","$$compose","$$normalizeUrl","this.$$normalizeUrl","$$parseLinkUrl","this.$$parseLinkUrl","relHref","appUrl","prevAppUrl","rewrittenUrl","LocationHashbangUrl","hashPrefix","withoutBaseUrl","withoutHashUrl","windowsFilePathExp","firstPathSegmentMatch","LocationHashbangInHtml5Url","locationGetter","locationGetterSetter","preprocess","requireBase","rewriteLinks","this.hashPrefix","this.html5Mode","urlsEqual","setBrowserUrlWithFallback","oldUrl","oldState","afterLocationChange","$broadcast","absUrl","LocationMode","initialUrl","lastIndexOf","IGNORE_URI_REGEXP","ctrlKey","metaKey","shiftKey","which","button","absHref","preventDefault","initializing","newUrl","newState","$digest","$locationWatch","$$urlUpdatedByLocation","currentReplace","$$replace","urlOrStateChanged","debug","debugEnabled","this.debugEnabled","flag","formatError","formatStackTrace","sourceURL","consoleLog","logFn","log","navigator","userAgent","warn","getStringValue","ifDefined","plusFn","r","isPure","parentIsPure","AST","MemberExpression","computed","UnaryExpression","PURITY_ABSOLUTE","BinaryExpression","operator","CallExpression","PURITY_RELATIVE","findConstantAndWatchExpressions","ast","allConstants","argsToWatch","astIsPure","Program","expr","Literal","toWatch","argument","left","right","LogicalExpression","ConditionalExpression","alternate","consequent","Identifier","object","isStatelessFilter","callee","AssignmentExpression","ArrayExpression","ObjectExpression","properties","ThisExpression","LocalsExpression","getInputs","lastExpression","isAssignable","assignableAST","NGValueParameter","ASTCompiler","ASTInterpreter","Parser","lexer","astCompiler","getValueOf","objectValueOf","literals","identStart","identContinue","addLiteral","this.addLiteral","literalName","literalValue","setIdentifierFns","this.setIdentifierFns","identifierStart","identifierContinue","interceptorFn","parsedExpression","cacheKey","Lexer","$parseOptions","parser","addWatchDelegate","addInterceptor","expressionInputDirtyCheck","oldValueOfValue","compareObjectIdentity","inputsWatchDelegate","prettyPrintExpression","inputExpressions","inputs","lastResult","oldInputValueOf","expressionInputWatch","newInputValue","oldInputValueOfValues","oldInputValues","expressionInputsWatch","changed","oneTimeWatchDelegate","unwatchIfDone","isDone","oneTimeWatch","useInputs","isAllDefined","$$intercepted","$$interceptor","allDefined","constantWatch","oneTime","first","second","chainedInterceptor","$$pure","depurifier","s","noUnsafeEval","isIdentifierStart","isIdentifierContinue","$$getAst","getAst","errorOnUnhandledRejections","qFactory","this.errorOnUnhandledRejections","nextTick","exceptionHandler","Deferred","Promise","this.resolve","this.reject","rejectPromise","this.notify","progress","notifyPromise","processChecks","queueSize","checkQueue","toCheck","errorMessage","scheduleProcessQueue","pending","processScheduled","$$passToExceptionHandler","$$reject","$qMinErr","$$resolve","doResolve","doReject","doNotify","handleCallback","resolver","callbackOutput","when","errback","progressBack","$Q","resolveFn","TypeError","onFulfilled","onRejected","promises","counter","results","race","requestAnimationFrame","webkitRequestAnimationFrame","cancelAnimationFrame","webkitCancelAnimationFrame","webkitCancelRequestAnimationFrame","rafSupported","raf","timer","supported","createChildScopeClass","ChildScope","$$watchers","$$nextSibling","$$childHead","$$childTail","$$listeners","$$listenerCount","$$watchersCount","$id","$$ChildScope","$$suspended","$rootScopeMinErr","lastDirtyWatch","applyAsyncId","digestTtl","this.digestTtl","destroyChildScope","$event","currentScope","cleanUpScope","$$prevSibling","$root","Scope","beginPhase","phase","incrementWatchersCount","decrementListenerCount","initWatchVal","flushApplyAsync","applyAsyncQueue","scheduleApplyAsync","isolate","child","watchExp","watcher","last","eq","$$digestWatchIndex","deregisterWatch","watchExpressions","watchGroupAction","changeReactionScheduled","firstRun","newValues","deregisterFns","shouldCall","deregisterWatchGroup","unwatchFn","watchGroupSubAction","$watchCollectionInterceptor","_value","bothNaN","newItem","oldItem","internalArray","oldLength","changeDetected","newLength","internalObject","veryOldValue","trackVeryOldValue","changeDetector","initRun","$watchCollectionAction","watch","watchers","dirty","ttl","asyncQueue","watchLog","logIdx","asyncTask","asyncQueuePosition","msg","next","postDigestQueuePosition","postDigestQueue","$suspend","$isSuspended","$resume","eventName","this.$watchGroup","$eval","$applyAsyncExpression","namedListeners","indexOfListener","$emit","targetScope","listenerArgs","$$asyncQueue","$$postDigestQueue","$$applyAsyncQueue","sanitizeUri","uri","isMediaUrl","regex","normalizedVal","adjustMatcher","matcher","$sceMinErr","escapeForRegexp","adjustMatchers","matchers","adjustedMatchers","resourceUrlWhitelist","resourceUrlBlacklist","this.resourceUrlWhitelist","this.resourceUrlBlacklist","matchUrl","baseURI","baseUrlParsingNode","generateHolderType","Base","holderType","trustedValue","$$unwrapTrustedValue","this.$$unwrapTrustedValue","holderType.prototype.valueOf","holderType.prototype.toString","htmlSanitizer","trustedValueHolderBase","byType","JS","trustAs","Constructor","maybeTrusted","allowed","this.enabled","sce","isEnabled","sce.isEnabled","sce.getTrusted","parseAs","sce.parseAs","enumValue","lName","UNDERSCORE_LOWERCASE_REGEXP","eventSupport","hasHistoryPushState","nw","process","chrome","app","runtime","pushState","android","boxee","bodyStyle","transitions","animations","hasEvent","divElm","TaskTracker","getLastCallback","cbInfo","taskCallbacks","pop","cb","getLastCallbackForType","taskCounts","ALL_TASKS_TYPE","countForType","countForAll","getNextCallback","nextCb","httpOptions","this.httpOptions","handleRequestFn","tpl","ignoreRequestError","totalPendingRequests","transformer","handleError","$templateRequestMinErr","testability","testability.findBindings","opt_exactMatch","getElementsByClassName","matches","dataBinding","bindingName","testability.findModels","prefixes","attributeEquals","testability.getLocation","testability.setLocation","testability.whenStable","deferreds","timeout.cancel","$timeoutMinErr","urlParsingNode","ipv6InBrackets","whitelistedOriginUrls","parsedAllowedOriginUrls","originUrl","requestUrl","urlsAreSameOrigin","url1","url2","$$CookieReader","safeDecodeURIComponent","lastCookies","lastCookieString","cookieArray","cookie","currentCookieString","filters","suffix","currencyFilter","dateFilter","filterFilter","jsonFilter","limitToFilter","lowercaseFilter","numberFilter","orderByFilter","uppercaseFilter","comparator","anyPropertyKey","matchAgainstAnyProp","getTypeForFilter","expressionType","predicateFn","createPredicateFn","shouldMatchPrimitives","actual","expected","deepCompare","dontMatchWholeObject","actualType","expectedType","expectedVal","matchAnyProperty","actualVal","$locale","formats","NUMBER_FORMATS","amount","currencySymbol","fractionSize","CURRENCY_SYM","PATTERNS","maxFrac","currencySymbolRe","formatNumber","GROUP_SEP","DECIMAL_SEP","number","numStr","exponent","digits","numberOfIntegerDigits","zeros","ZERO_CHAR","MAX_DIGITS","roundNumber","parsedNumber","minFrac","fractionLen","min","roundAt","digit","k","carry","reduceRight","groupSep","decimalSep","isNaN","isInfinity","isFinite","isZero","abs","formattedText","integerLen","decimals","reduce","groups","lgSize","gSize","negPre","negSuf","posPre","posSuf","padNumber","num","negWrap","neg","dateGetter","dateStrGetter","shortForm","standAlone","getFirstThursdayOfYear","year","dayOfWeekOnFirst","getDay","weekGetter","firstThurs","getFullYear","thisThurs","getMonth","getDate","round","eraGetter","ERAS","jsonStringToDate","string","R_ISO8601_STR","tzHour","tzMin","dateSetter","setUTCFullYear","setFullYear","timeSetter","setUTCHours","setHours","m","ms","parseFloat","format","DATETIME_FORMATS","NUMBER_STRING","DATE_FORMATS_SPLIT","DATE_FORMATS","spacing","limit","begin","Infinity","sliceFn","end","processPredicates","sortPredicates","predicate","descending","defaultCompare","v1","v2","type1","type2","value1","value2","sortPredicate","reverseOrder","compareFn","predicates","compareValues","getComparisonObject","tieBreaker","predicateValues","doComparison","ngDirective","FormController","$$controls","$error","$$success","$pending","$name","$dirty","$valid","$pristine","$submitted","$invalid","$$parentForm","nullFormCtrl","$$animate","setupValidity","$$classCache","INVALID_CLASS","VALID_CLASS","addSetValidityMethod","cachedToggleClass","ctrl","switchValue","toggleValidationCss","validationErrorKey","isValid","unset","clazz","$setValidity","clazz.prototype.$setValidity","isObjectEmpty","PENDING_CLASS","combinedState","stringBasedInputType","$formatters","$isEmpty","baseInputType","composing","ev","ngTrim","$viewValue","$$hasNativeValidators","$setViewValue","deferListener","origValue","keyCode","PARTIAL_VALIDATION_TYPES","PARTIAL_VALIDATION_EVENTS","validity","origBadInput","badInput","origTypeMismatch","typeMismatch","$render","ctrl.$render","createDateParser","mapping","iso","previousDate","ISO_DATE_REGEXP","yyyy","MM","dd","HH","getHours","mm","ss","getSeconds","sss","getMilliseconds","part","createDateInputType","parseDate","dynamicDateInputType","isValidDate","parseObservedDateValue","parseDateAndConvertTimeZoneToLocal","$options","getOption","previousTimezone","parsedDate","badInputChecker","isTimeType","$parsers","$$parserName","ngModelMinErr","targetFormat","formatted","ngMin","minVal","parsedMinVal","$validators","ctrl.$validators.min","$validate","ngMax","maxVal","parsedMaxVal","ctrl.$validators.max","parserName","VALIDITY_STATE_PROPERTY","numberFormatterParser","NUMBER_REGEXP","parseNumberAttrVal","countDecimals","numString","decimalSymbolIndex","isValidForStep","viewValue","stepBase","step","isNonIntegerValue","isNonIntegerStepBase","isNonIntegerStep","valueDecimals","stepBaseDecimals","stepDecimals","decimalCount","multiplier","pow","parseConstantExpr","parseFn","classDirective","arrayDifference","toClassString","classValue","classString","indexWatchExpression","digestClassCounts","classArray","classesToUpdate","classCounts","ngClassIndexWatchAction","newModulo","oldClassString","oldModulo","moduloTwo","$index","ngClassWatchAction","newClassString","oldClassArray","newClassArray","toRemoveArray","toAddArray","toRemoveString","toAddString","forceAsync","ngEventHandler","NgModelController","$modelValue","$$rawModelValue","$asyncValidators","$viewChangeListeners","$untouched","$touched","defaultModelOptions","$$updateEvents","$$updateEventHandler","$$parsedNgModel","$$parsedNgModelAssign","$$ngModelGet","$$ngModelSet","$$pendingDebounce","$$parserValid","$$currentValidationRunId","$$rootScope","$$attr","$$timeout","$$exceptionHandler","setupModelWatcher","ngModelWatch","modelValue","$$setModelValue","ModelOptions","$$options","setOptionSelectedStatus","optionEl","parsePatternAttr","patternExp","parseLength","intVal","REGEX_STRING_REGEXP","documentMode","rules","ngCspElement","ngCspAttribute","noInlineStyle","name_","el","allowAutoBootstrap","currentScript","HTMLScriptElement","SVGScriptElement","srcs","getNamedItem","every","origin","full","major","minor","dot","codeName","expando","JQLite._data","MS_HACK_REGEXP","mouseleave","mouseenter","optgroup","tbody","tfoot","colgroup","caption","thead","th","td","Node","contains","compareDocumentPosition","ready","removeData","jqLiteHasData","jqLiteCleanData","removeAttribute","css","NODE_TYPE_ATTRIBUTE","lowercasedName","isBooleanAttr","ret","getText","$dv","multiple","selected","arg1","arg2","nodeCount","jqLiteOn","types","addHandler","noEventListener","one","onFn","replaceNode","insertBefore","children","contentDocument","prepend","wrapNode","detach","after","newElement","toggleClass","condition","classCondition","nextElementSibling","getElementsByTagName","extraParameters","dummyEvent","handlerArgs","eventFnsCopy","arg3","unbind","nanKey","_idx","_transformKey","delete","FN_ARG_SPLIT","FN_ARG","argDecl","underscore","$animateMinErr","postDigestElements","updateData","handleCSSClassChanges","existing","pin","domOperation","from","to","classesAdded","add","classesRemoved","runner","complete","classNameFilter","customFilter","$$registeredAnimations","this.customFilter","filterFn","this.classNameFilter","reservedRegex","NG_ANIMATE_CLASSNAME","domInsert","parentElement","afterElement","afterNode","ELEMENT_NODE","previousElementSibling","enter","move","leave","addclass","setClass","animate","tempClasses","waitForTick","waitQueue","passed","AnimateRunner","setHost","rafTick","_doneCallbacks","_tick","this._tick","_state","chain","AnimateRunner.chain","AnimateRunner.all","runners","onProgress","DONE_COMPLETE_STATE","getPromise","resolveHandler","rejectHandler","pause","resume","_resolve","INITIAL_STATE","DONE_PENDING_STATE","initialOptions","closed","$$prepared","cleanupStyles","start","UNINITIALIZED_VALUE","isFirstChange","SimpleChange.prototype.isFirstChange","domNode","offsetWidth","$interpolateMinErr.throwNoconcat","$interpolateMinErr.interr","callbackId","called","callbackMap","PATH_MATCH","locationPrototype","$$absUrl","hashValue","pathValue","$$url","paramValue","Location","Location.prototype.state","$parseMinErr","OPERATORS","ESCAPE","lex","tokens","readString","peek","readNumber","peekMultichar","readIdent","is","isWhitespace","ch2","ch3","op2","op3","op1","throwError","chars","codePointAt","isValidIdentifierStart","isValidIdentifierContinue","cp","charCodeAt","cp1","cp2","isExpOperator","colStr","peekCh","quote","rawString","hex","String","fromCharCode","rep","ExpressionStatement","Property","program","expressionStatement","expect","filterChain","assignment","ternary","logicalOR","consume","logicalAND","equality","relational","additive","multiplicative","unary","primary","arrayDeclaration","selfReferential","parseArguments","baseExpression","peekToken","kind","e1","e2","e3","e4","peekAhead","t","nextId","vars","own","assignable","stage","computing","recurse","return_","generateFunction","fnKey","intoId","watchId","fnString","USE","STRICT","filterPrefix","watchFns","varsPrefix","section","nameId","recursionFn","skipWatchIdCheck","if_","lazyAssign","computedMember","lazyRecurse","plus","not","getHasOwnProperty","isNull","nonComputedMember","notNull","member","filterName","defaultValue","UNSAFE_CHARACTERS","SAFE_IDENTIFIER","stringEscapeFn","stringEscapeRegex","c","skip","init","fn.assign","rhs","lhs","unary+","unary-","unary!","binary+","binary-","binary*","binary/","binary%","binary===","binary!==","binary==","binary!=","binary<","binary>","binary<=","binary>=","binary&&","binary||","ternary?:","yy","y","MMMM","MMM","M","LLLL","H","hh","EEEE","EEE","ampmGetter","AMPMS","Z","timeZoneGetter","zone","paddedZone","ww","w","G","GG","GGG","GGGG","longEraGetter","ERANAMES","xlinkHref","defaultLinkFn","normalized","ngBooleanAttrWatchAction","htmlAttr","ngAttrAliasWatchAction","$addControl","$getControls","$$renameControl","nullFormRenameControl","control","$removeControl","$setDirty","$setPristine","$setSubmitted","$$setSubmitted","$rollbackViewValue","$commitViewValue","newName","oldName","PRISTINE_CLASS","DIRTY_CLASS","SUBMITTED_CLASS","$setUntouched","rootForm","formDirectiveFactory","isNgForm","getSetter","ngFormCompile","formElement","nameAttr","ngFormPreLink","ctrls","handleFormSubmission","setter","URL_REGEXP","EMAIL_REGEXP","DATE_REGEXP","DATETIMELOCAL_REGEXP","WEEK_REGEXP","MONTH_REGEXP","TIME_REGEXP","inputType","textInputType","weekParser","isoWeek","existingDate","week","hours","seconds","milliseconds","addDays","numberInputType","ngStep","stepVal","parsedStepVal","ctrl.$validators.step","urlInputType","ctrl.$validators.url","emailInputType","email","ctrl.$validators.email","radioInputType","doTrim","checked","rangeInputType","setInitialValueAndObserver","htmlAttrName","changeFn","wrappedObserver","minChange","supportsRange","elVal","maxChange","stepChange","hasMinAttr","hasMaxAttr","hasStepAttr","originalRender","rangeUnderflow","rangeOverflow","rangeRender","noopMinValidator","minValidator","noopMaxValidator","maxValidator","nativeStepValidator","stepMismatch","stepValidator","checkboxInputType","trueValue","ngTrueValue","falseValue","ngFalseValue","ctrl.$isEmpty","valueProperty","configurable","enumerable","defineProperty","CONSTANT_VALUE_REGEXP","updateElementValue","tplAttr","ngValueConstantLink","ngValueLink","valueWatchAction","$compile","ngBindCompile","templateElement","ngBindLink","ngBindWatchAction","ngBindTemplateCompile","ngBindTemplateLink","ngBindHtmlCompile","ngBindHtmlGetter","ngBindHtmlWatch","ngBindHtmlLink","ngBindHtmlWatchAction","getTrustedHtml","forceAsyncEvents","previousElements","ngIfWatchAction","srcExp","onloadExp","autoScrollExp","autoscroll","changeCounter","previousElement","currentElement","cleanupLastIncludeContent","ngIncludeWatchAction","afterAnimation","thisChangeId","namespaceAdaptedClone","trimValues","$$initGetterSetters","invokeModelGetter","invokeModelSetter","this.$$ngModelGet","this.$$ngModelSet","$$$p","$$updateEmptyClasses","NOT_EMPTY_CLASS","EMPTY_CLASS","UNTOUCHED_CLASS","TOUCHED_CLASS","$setTouched","$$lastCommittedViewValue","prevValid","prevModelValue","allowInvalid","that","$$runValidators","allValid","$$writeModelToScope","doneCallback","processSyncValidators","syncValidatorsValid","validator","Boolean","setValidity","processAsyncValidators","validatorPromises","validationDone","localValidationRunId","processParseErrors","errorKey","$$parseAndValidate","$$debounceViewValueCommit","debounceDelay","$overrideModelOptions","createChild","$$setUpdateOnEvents","$processModelValue","$$format","formatters","ngModelCompile","ngModelPreLink","modelCtrl","formCtrl","optionsCtrl","ngModelPostLink","setTouched","DEFAULT_REGEXP","inheritAll","updateOnDefault","updateOn","debounce","getterSetter","NgModelOptionsController","$$attrs","parentOptions","parentCtrl","modelOptionsDefinition","ngOptionsMinErr","NG_OPTIONS_REGEXP","parseOptionsExpression","optionsExp","selectElement","Option","selectValue","label","group","disabled","getOptionValuesKeys","optionValues","optionValuesKeys","keyName","itemKey","valueName","selectAs","trackBy","viewValueFn","trackByFn","getTrackByValueFn","getHashOfValue","getTrackByValue","getLocals","displayFn","groupByFn","disableWhenFn","valuesFn","getWatchables","watchedArray","optionValuesLength","disableWhen","getOptions","optionItems","selectValueMap","optionItem","getOptionFromViewValue","getViewValueFromOption","optionTemplate","optGroupTemplate","ngOptionsPreLink","registerOption","ngOptionsPostLink","getAndUpdateSelectedOption","updateOptionElement","selectCtrl","ngModelCtrl","hasEmptyOption","emptyOption","providedEmptyOption","unknownOption","listFragment","generateUnknownOptionValue","selectCtrl.generateUnknownOptionValue","writeValue","selectCtrl.writeValue","selectedOptions","readValue","selectCtrl.readValue","selectedValues","selections","selectedOption","selectedIndex","removeUnknownOption","selectUnknownOrEmptyOption","unselectEmptyOption","selectCtrl.registerOption","optionScope","needsRerender","$isEmptyOptionSelected","updateOptions","groupElementMap","addOption","groupElement","optionElement","nextValue","BRACE","IS_WHEN","updateElementText","newText","numberExp","whenExp","whens","whensExpFns","braceReplacement","watchRemover","lastCount","attributeName","tmpMatch","whenKey","ngPluralizeWatchAction","countIsNaN","pluralCat","whenExpFn","ngRefMinErr","refValue","ngRefRead","ngRepeatMinErr","updateScope","valueIdentifier","keyIdentifier","arrayLength","$first","$last","$middle","$odd","$even","trackByIdArrayFn","trackByIdObjFn","ngRepeatCompile","ngRepeatEndComment","aliasAs","trackByExp","trackByIdExpFn","hashFnLocals","trackByExpGetter","ngRepeatLink","lastBlockMap","ngRepeatAction","previousNode","nextNode","nextBlockMap","collectionLength","trackById","collectionKeys","nextBlockOrder","trackByIdFn","blockKey","ngRepeatTransclude","ngShowWatchAction","NG_HIDE_CLASS","NG_HIDE_IN_PROGRESS_CLASS","ngHideWatchAction","ngStyleWatchAction","newStyles","oldStyles","NgSwitchController","cases","ngSwitchController","selectedTranscludes","selectedElements","previousLeaveAnimations","selectedScopes","spliceFactory","ngSwitchWatchAction","selectedTransclude","caseElement","selectedScope","anchor","ngSwitchWhenSeparator","whenCase","ngTranscludeMinErr","ngTranscludeCompile","fallbackLinkFn","ngTranscludePostLink","useFallbackContent","ngTranscludeSlot","ngTranscludeCloneAttachFn","noopNgModelController","SelectController","scheduleRender","renderScheduled","scheduleViewValueUpdate","renderAfter","updateScheduled","optionsMap","renderUnknownOption","self.renderUnknownOption","unknownVal","updateUnknownOption","self.updateUnknownOption","self.generateUnknownOptionValue","self.removeUnknownOption","selectEmptyOption","self.selectEmptyOption","self.unselectEmptyOption","self.readValue","realVal","hasOption","self.writeValue","currentlySelectedOption","hashedVal","self.addOption","removeOption","self.removeOption","self.hasOption","$hasEmptyOption","self.$hasEmptyOption","$isUnknownOptionSelected","self.$isUnknownOptionSelected","self.$isEmptyOptionSelected","self.selectUnknownOrEmptyOption","self.registerOption","optionAttrs","interpolateValueFn","interpolateTextFn","valueAttributeObserveAction","removal","previouslySelected","interpolateWatchAction","removeValue","selectPreLink","shouldBeSelected","lastView","lastViewRef","selectMultipleWatch","ngModelCtrl.$isEmpty","selectPostLink","ngModelCtrl.$render","selectCtrlName","ctrl.$validators.required","tElm","tAttr","attrVal","oldRegexp","ctrl.$validators.pattern","maxlengthParsed","ctrl.$validators.maxlength","minlengthParsed","ctrl.$validators.minlength","getDecimals","opt_precision","ONE","OTHER","$$csp","head"] -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/angular/bower.json b/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/angular/bower.json deleted file mode 100755 index 4c106262f..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/angular/bower.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "name": "angular", - "version": "1.7.7", - "license": "MIT", - "main": "./angular.js", - "ignore": [], - "dependencies": { - } -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/angular/index.js b/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/angular/index.js deleted file mode 100755 index 5c1aafcca..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/angular/index.js +++ /dev/null @@ -1,2 +0,0 @@ -require('./angular'); -module.exports = angular; diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/angular/package.json b/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/angular/package.json deleted file mode 100755 index 43a39b500..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/angular/package.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "_args": [ - [ - "angular@1.7.7", - "/shd/CTC/TOOLS/TDS/TDS-source/Lts/Tools/ArAssetsV2" - ] - ], - "_development": true, - "_from": "angular@1.7.7", - "_id": "angular@1.7.7", - "_inBundle": false, - "_integrity": "sha512-MH3JEGd8y/EkNCKJ8EV6Ch0j9X0rZTta/QVIDpBWaIdfh85/e5KO8+ZKgvWIb02MQuiS20pDFmMFlv4ZaLcLWg==", - "_location": "/angular", - "_phantomChildren": {}, - "_requested": { - "type": "version", - "registry": true, - "raw": "angular@1.7.7", - "name": "angular", - "escapedName": "angular", - "rawSpec": "1.7.7", - "saveSpec": null, - "fetchSpec": "1.7.7" - }, - "_requiredBy": [ - "#DEV:/" - ], - "_resolved": "https://registry.npmjs.org/angular/-/angular-1.7.7.tgz", - "_spec": "1.7.7", - "_where": "/shd/CTC/TOOLS/TDS/TDS-source/Lts/Tools/ArAssetsV2", - "author": { - "name": "Angular Core Team", - "email": "angular-core+npm@google.com" - }, - "bugs": { - "url": "https://github.com/angular/angular.js/issues" - }, - "description": "HTML enhanced for web apps", - "homepage": "http://angularjs.org", - "keywords": [ - "angular", - "framework", - "browser", - "client-side" - ], - "license": "MIT", - "main": "index.js", - "name": "angular", - "repository": { - "type": "git", - "url": "git+https://github.com/angular/angular.js.git" - }, - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "version": "1.7.7" -} diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/leaflet/CHANGELOG.md b/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/leaflet/CHANGELOG.md deleted file mode 100755 index 7509dec77..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/leaflet/CHANGELOG.md +++ /dev/null @@ -1,1756 +0,0 @@ -Leaflet Changelog -================= - -(all changes without author notice are by [@mourner](https://github.com/mourner)) - -## 1.3.4 (2018-08-21) - -### Improvements - -* Reset max-width and max-height styles for tiles in custom panes ([#6255](https://github.com/Leaflet/Leaflet/issues/6255) by [jerekshoe](https://github.com/jerekshoe)) -* Add unprefixed `cursor: grab` style ([#6281](https://github.com/Leaflet/Leaflet/issues/6281) by [Malvoz](https://github.com/Malvoz)) -* Remove legacy prefixed styles, add unprefixed styles ([#6282](https://github.com/Leaflet/Leaflet/issues/6282) by [Malvoz](https://github.com/Malvoz)) - -### Bug fixes - -* Move set/getAttribute('src') calls from `GridLayer` into `TileLayer` ([#6264](https://github.com/Leaflet/Leaflet/issues/6264) by [IvanSanchez](https://github.com/IvanSanchez)) -* Support comma- or space-separated strings in `Canvas` `dashArray` option ([#6277](https://github.com/Leaflet/Leaflet/issues/6277) by [IvanSanchez](https://github.com/IvanSanchez)) -* Remove trailing commas to avoid crashes in some IE browsers ([#6279](https://github.com/Leaflet/Leaflet/issues/6279) by [helbling](https://github.com/helbling)) -* Fixed capitalization of `webkitTransform` property, which broke transformations on certain Webkit browsers ([#6290](https://github.com/Leaflet/Leaflet/issues/6290) by [tuckergordon](https://github.com/tuckergordon)) - -### Docs & Web Site - -* Document `zoomControl` map option ([#6254](https://github.com/Leaflet/Leaflet/issues/6254) by [IvanSanchez](https://github.com/IvanSanchez)) -* Explicitly note attribution obligation ([#6261](https://github.com/Leaflet/Leaflet/issues/6261) by [pietervdvn](https://github.com/pietervdvn)) -* Minor fixes of `ImageOverlay` docs ([#6266](https://github.com/Leaflet/Leaflet/issues/6266) by [jgravois](https://github.com/jgravois)) -* Add Edge to the list of supported browsers ([#6270](https://github.com/Leaflet/Leaflet/issues/6270) by [matkoniecz](https://github.com/matkoniecz)) -* Remove references to Leaflet UserVoice page ([#6291](https://github.com/Leaflet/Leaflet/issues/6291) by [zstadler](https://github.com/zstadler)) -* Reword docstrings for draggable markers ([#6296](https://github.com/Leaflet/Leaflet/issues/6296) by [IvanSanchez](https://github.com/IvanSanchez)) - -## 1.3.3 (2018-07-18) - -### Bug fixes - -* Remove `module` field from `package.json` ([#6239](https://github.com/Leaflet/Leaflet/issues/6239)) - -## 1.3.2 (2018-07-17) - -### Improvements - -* Add `use-credentials` CORS option to `ImageOverlay` and `TileLayer` ([#6016](https://github.com/Leaflet/Leaflet/issues/6016) by [caleblogan](https://github.com/caleblogan)) + unit tests ([#6022](https://github.com/Leaflet/Leaflet/issues/6022) and [#6027](https://github.com/Leaflet/Leaflet/issues/6027) by [ghybs](https://github.com/ghybs)) -* Clean up references to global `L` in source code ([#6047](https://github.com/Leaflet/Leaflet/issues/6047) and [#6048](https://github.com/Leaflet/Leaflet/issues/6048) by [ghybs](https://github.com/ghybs)) -* Allow reset of `Canvas` `dashArray` option + support array type ([#6200](https://github.com/Leaflet/Leaflet/issues/6200) by [McBen](https://github.com/McBen)) - -### Bug fixes - -* Respect the `preferCanvas` option in all panes ([#6019](https://github.com/Leaflet/Leaflet/issues/6019) by [mjumbewu](https://github.com/mjumbewu)) -* Do not fire `tileload` event if tile has empty `src` ([#6025](https://github.com/Leaflet/Leaflet/issues/6025) by [cherniavskii](https://github.com/cherniavskii)) -* Fix race condition when removing canvas before it has rendered ([#6033](https://github.com/Leaflet/Leaflet/issues/6033) by [louMoxy](https://github.com/louMoxy)) -* Fix memory leak in canvas renderer ([#6117](https://github.com/Leaflet/Leaflet/issues/6117) by [aj8k](https://github.com/aj8k)) -* Fix dragging for CSS scaled map ([#6055](https://github.com/Leaflet/Leaflet/issues/6055) by [ghybs](https://github.com/ghybs)) -* Handle `Polygon`s with empty array of `LatLng`s ([#6119](https://github.com/Leaflet/Leaflet/issues/6119) by [BakuCity](https://github.com/BakuCity)) -* Fix view bounds calculation in geolocation event handler ([#6140](https://github.com/Leaflet/Leaflet/issues/6140) by [wladich](https://github.com/wladich)) -* Fix error removing map and resizing window at the same time ([#6160](https://github.com/Leaflet/Leaflet/issues/6160) by [danzel](https://github.com/danzel)) -* Stop pan key event when pan animation is in progress ([#6231](https://github.com/Leaflet/Leaflet/issues/6231) by [cherniavskii](https://github.com/cherniavskii)) - -### Docs & Web Site - -* Use more explicit tiles in `Map panes` example ([#6018](https://github.com/Leaflet/Leaflet/issues/6018) by [ghybs](https://github.com/ghybs)) -* Document parameter of `closestLayerPoint` method ([#6060](https://github.com/Leaflet/Leaflet/issues/6060) by [mattdsteele](https://github.com/mattdsteele)) -* Update year ranges ([#6076](https://github.com/Leaflet/Leaflet/issues/6076) by [BakuCity](https://github.com/BakuCity)) -* Use https everywhere for OSM links ([#6082](https://github.com/Leaflet/Leaflet/issues/6082) by [rzoller](https://github.com/rzoller)) -* Fix typo in `VideoOverlay.js` example docs ([#6090](https://github.com/Leaflet/Leaflet/issues/6090) by [zhuang-hao-ming](https://github.com/zhuang-hao-ming)) -* Fix typo in `LatLng` docstring ([#6138](https://github.com/Leaflet/Leaflet/issues/6138) by [jieter](https://github.com/jieter)) -* Use https everywhere and get rid of mixed content warnings ([#6151](https://github.com/Leaflet/Leaflet/issues/6151) by [theel0ja](https://github.com/theel0ja)) -* More accurate `Browser.retina` explanation ([#6203](https://github.com/Leaflet/Leaflet/issues/6203) by [JLuc](https://github.com/JLuc)) -* Use link to official RFC 7946 GeoJSON spec ([#6211](https://github.com/Leaflet/Leaflet/issues/6211) by [ghybs](https://github.com/ghybs)) - -### ES6 / Rollup - -* Add ES module build ([#6021](https://github.com/Leaflet/Leaflet/issues/6021) by [Rich-Harris](https://github.com/Rich-Harris)) - -### Development workflow - -* Move external dependencies to `node_modules` ([#6028](https://github.com/Leaflet/Leaflet/issues/6028) by [cherniavskii](https://github.com/cherniavskii)) -* Remove `jake` dependency and use NPM scripts instead ([#5828](https://github.com/Leaflet/Leaflet/issues/5828) by [cherniavskii](https://github.com/cherniavskii)) -* Update `ssri` dependency to `5.2.2` ([#6086](https://github.com/Leaflet/Leaflet/issues/6086) by [cherniavskii](https://github.com/cherniavskii)) -* Set div width for `getBoundsZoom` parameter `inside` ([#6192](https://github.com/Leaflet/Leaflet/issues/6192) by [ghybs](https://github.com/ghybs)) -* Fix unit tests for graphical browsers ([#6199](https://github.com/Leaflet/Leaflet/issues/6199) and [#6202](https://github.com/Leaflet/Leaflet/issues/6202) by [ghybs](https://github.com/ghybs)) -* Run tests in Firefox graphical browser as part of CI ([#5831](https://github.com/Leaflet/Leaflet/issues/5831) by [cherniavskii](https://github.com/cherniavskii)) - - -## 1.3.1 (2018-01-18) - -### Bug fixes - -* Fix `L.TileLayer`regression, which caused incorrect tile URLs ([#6006](https://github.com/Leaflet/Leaflet/issues/6006) by [ghybs](https://github.com/ghybs)) - - -## 1.3.0 (2018-01-15) - -### API changes - -* Add `tolerance` option to `L.Renderer` instead of hardcoded tolerance for touch devices ([#5922](https://github.com/Leaflet/Leaflet/issues/5922) by [Muscot](https://github.com/Muscot)). - -### Improvements - -* Use more stable form of Haversine formula ([#5935](https://github.com/Leaflet/Leaflet/issues/5935) by [jussimattas](https://github.com/jussimattas)) -* Add `autoPan` option to `L.Marker` ([#5651](https://github.com/Leaflet/Leaflet/issues/5651) by [alenaksu](https://github.com/alenaksu)) -* Cancel http requests for outdated tiles ([#5615](https://github.com/Leaflet/Leaflet/issues/5615) by [jbccollins](https://github.com/jbccollins)) -* Add `closeOnEscapeKey` option to `L.Popup` ([#5730](https://github.com/Leaflet/Leaflet/issues/5730) by [Mickyfen17](https://github.com/Mickyfen17)) -* Add `tileerror` tests to `L.GridLayer` spec ([#5805](https://github.com/Leaflet/Leaflet/issues/5805) by [msiadak](https://github.com/msiadak)) -* Use `eachLayer` method for iterations over layers in `L.LayerGroup` ([#5809](https://github.com/Leaflet/Leaflet/issues/5809) by [cherniavskii](https://github.com/cherniavskii)) -* Change `Util.formatNum` default to 6 decimals ([#5492](https://github.com/Leaflet/Leaflet/issues/5492) by [fminuti](https://github.com/fminuti)) -* Fire `zoomlevelschange` event when calling `setMinZoom` & `setMaxZoom` ([#5230](https://github.com/Leaflet/Leaflet/issues/5230) by [mynameisstephen](https://github.com/mynameisstephen)) -* Use zoom parameter if passed to `L.TileLayer`'s `getTileUrl` method ([#5822](https://github.com/Leaflet/Leaflet/issues/5822) by [broncha](https://github.com/broncha)) -* Round circle radius in renderer instead of layer ([#5859](https://github.com/Leaflet/Leaflet/issues/5859) by [perliedman](https://github.com/perliedman)) -* Make `L.LayerGroup` accept options ([#5792](https://github.com/Leaflet/Leaflet/issues/5792) by [iH8](https://github.com/iH8)) -* Round pan offset towards zero ([#5858](https://github.com/Leaflet/Leaflet/issues/5858) by [perliedman](https://github.com/perliedman)) -* Improve heuristic for what event targets are considered markers ([#5885](https://github.com/Leaflet/Leaflet/issues/5885) by [perliedman](https://github.com/perliedman)) -* Add `typeof` check to `checkDeprecatedMixinEvents` ([#5901](https://github.com/Leaflet/Leaflet/issues/5901) by [murb](https://github.com/murb)) -* Optimize images ([#5936](https://github.com/Leaflet/Leaflet/issues/5936) by [grischard](https://github.com/grischard)) -* Add `addTo` static function to `L.Handler` class ([#5930](https://github.com/Leaflet/Leaflet/issues/5930) by [cherniavskii](https://github.com/cherniavskii)) -* `L.ImageOverlay` accepts `ImageElement` ([#5948](https://github.com/Leaflet/Leaflet/issues/5948) by [ronikar](https://github.com/ronikar)) - -### Bug fixes - -* Fix adding CSS classes in `L.VideoOverlay`, which caused map crash in IE8 ([#5731](https://github.com/Leaflet/Leaflet/issues/5731) by [Dzwiedzminator](https://github.com/Dzwiedzminator) and [#5785](https://github.com/Leaflet/Leaflet/issues/5785) by [cherniavskii](https://github.com/cherniavskii)) -* No inertia if drag is stopped before ending the drag ([#5690](https://github.com/Leaflet/Leaflet/issues/5690) by [perliedman](https://github.com/perliedman)) -* Remove tiles from the `_tiles` cache when they're aborted ([#5634](https://github.com/Leaflet/Leaflet/issues/5634) by [oliverheilig](https://github.com/oliverheilig)) -* Use same condition for adding as well as removing double tap listener ([#5598](https://github.com/Leaflet/Leaflet/issues/5598) by [perliedman](https://github.com/perliedman)) -* Correctly wrap tile coordinate bounds ([#5715](https://github.com/Leaflet/Leaflet/issues/5715) by [perliedman](https://github.com/perliedman)) -* Fix `L.TileLayer` infinite error loop ([#5783](https://github.com/Leaflet/Leaflet/issues/5783) by [cherniavskii](https://github.com/cherniavskii)) -* Fix map not rendering when images have max-height ([#5778](https://github.com/Leaflet/Leaflet/issues/5778) by [idanen](https://github.com/idanen)) -* Add defensive check for `this._map` in `L.Marker`'s `update` method ([#5736](https://github.com/Leaflet/Leaflet/issues/5736) by [dnepromell](https://github.com/dnepromell)) -* Fix zoom when map container is scaled ([#5794](https://github.com/Leaflet/Leaflet/issues/5794) by [cherniavskii](https://github.com/cherniavskii)) -* Update DomPointer.js to revert typo ([#5817](https://github.com/Leaflet/Leaflet/issues/5817) by [daverayment](https://github.com/daverayment)) -* Fix `L.ImageOverlay` `className` option ([#5830](https://github.com/Leaflet/Leaflet/issues/5830) by [cherniavskii](https://github.com/cherniavskii)) -* Fix `L.TileLayer.WMS` when using Polar stereographic ([#5618](https://github.com/Leaflet/Leaflet/issues/5618) by [scaddenp](https://github.com/scaddenp)) -* Stop animation before removing map ([#5876](https://github.com/Leaflet/Leaflet/issues/5876) by [dnepromell](https://github.com/dnepromell) and [#5918](https://github.com/Leaflet/Leaflet/issues/5918) by [aaronplanell](https://github.com/aaronplanell)) -* Stop locate before removing map ([#5893](https://github.com/Leaflet/Leaflet/issues/5893) by [ghybs](https://github.com/ghybs)) -* Reset `GridLayer`'s `_tileZoom` to `undefined` instead of `null` ([#5888](https://github.com/Leaflet/Leaflet/issues/5888) by [iH8](https://github.com/iH8)) -* Fix `L.Map`'s `map.flyTo` method to respect `noMoveStart` option ([#5923](https://github.com/Leaflet/Leaflet/issues/5923) by [iPrytz](https://github.com/iPrytz)) -* Fix map pan when `touchZoom` is disabled ([#5952](https://github.com/Leaflet/Leaflet/issues/5952) by [cherniavskii](https://github.com/cherniavskii)) -* Fix `L.SVG` to reset size on remove from map ([#5966](https://github.com/Leaflet/Leaflet/issues/5966) by [ghybs](https://github.com/ghybs)) -* Fix `L.Marker` to set `alt` attribute for img-based Icons only ([#5979](https://github.com/Leaflet/Leaflet/issues/5979) by [msiadak](https://github.com/msiadak)) - -### Docs & Web Site - -* Add documentation for `PolyLine.closestLayerPoint` ([#5701](https://github.com/Leaflet/Leaflet/issues/5701) by [perliedman](https://github.com/perliedman)) -* Replace urls for samples in wms documentation ([#5712](https://github.com/Leaflet/Leaflet/issues/5712) by [jjimenezshaw](https://github.com/jjimenezshaw)) -* Add `DomEvent.stop` event type to docs ([#5733](https://github.com/Leaflet/Leaflet/issues/5733) by [theashyster](https://github.com/theashyster)) -* Update links to GeoJSON spec in GeoJSON examples ([#5725](https://github.com/Leaflet/Leaflet/issues/5725) by [astridx](https://github.com/astridx)) -* Improve docs for `L.LatLngBounds` `pad` method ([#5748](https://github.com/Leaflet/Leaflet/issues/5748) by [CalvinWilliams1012](https://github.com/CalvinWilliams1012)) -* Improve Zoom-levels documentation to reflect function properly ([#5769](https://github.com/Leaflet/Leaflet/issues/5769) by [CalvinWilliams1012](https://github.com/CalvinWilliams1012)) -* Fix map's height and width in examples to make attributions visible on mobile ([#5772](https://github.com/Leaflet/Leaflet/issues/5772) by [CalvinWilliams1012](https://github.com/CalvinWilliams1012) and [#5819](https://github.com/Leaflet/Leaflet/issues/5819) by [cherniavskii](https://github.com/cherniavskii)) -* Fix `L.FeatureGroup` `bringToBack` method docs ([#5788](https://github.com/Leaflet/Leaflet/issues/5788) by [fpopa](https://github.com/fpopa)) -* Fix `L.LatLng` `distanceTo` method description ([#5791](https://github.com/Leaflet/Leaflet/issues/5791) by [loisgh](https://github.com/loisgh)) -* Fix docs redirects to latest version reference ([#5824](https://github.com/Leaflet/Leaflet/issues/5824) by [cherniavskii](https://github.com/cherniavskii)) -* Add CDN alternatives ([#5837](https://github.com/Leaflet/Leaflet/issues/5837) by [ghybs](https://github.com/ghybs)) -* Update docs for `L.DomEvent.off()` ([#5855](https://github.com/Leaflet/Leaflet/issues/5855) by [77ganesh](https://github.com/77ganesh) and [#5976](https://github.com/Leaflet/Leaflet/issues/5976) by [kring](https://github.com/kring)) -* Move `L.SVG` factory docs to appropriate place ([#5864](https://github.com/Leaflet/Leaflet/issues/5864) by [cherniavskii](https://github.com/cherniavskii)) -* New Leaflet playgrounds on Plunker, Codepen and JSFiddle ([#5868](https://github.com/Leaflet/Leaflet/issues/5868) by [iH8](https://github.com/iH8)) -* Clarify that any option keys can be used ([#5877](https://github.com/Leaflet/Leaflet/issues/5877) by [perliedman](https://github.com/perliedman)) -* Add notes about some classes not inheriting Class ([#5878](https://github.com/Leaflet/Leaflet/issues/5878) by [perliedman](https://github.com/perliedman)) -* Clean up and document event propagation properties ([#5880](https://github.com/Leaflet/Leaflet/issues/5880) by [perliedman](https://github.com/perliedman)) -* Update building instructions ([#5911](https://github.com/Leaflet/Leaflet/issues/5911) by [shadeland](https://github.com/shadeland)) -* Document `mouseup` event for interactive `L.Layer` ([#5941](https://github.com/Leaflet/Leaflet/issues/5941) by [germansokolov13](https://github.com/germansokolov13)) -* Document `L.Icon`'s `tooltipAnchor` option, update `tooltipAnchor` and `popupAnchor` default values docs ([#5989](https://github.com/Leaflet/Leaflet/issues/5989) by [cherniavskii](https://github.com/cherniavskii)) - -### ES6 / Rollup - -* Tweak `legacy` option in rollup config - now Leaflet works in IE again ([#5929](https://github.com/Leaflet/Leaflet/issues/5929) by [IvanSanchez](https://github.com/IvanSanchez)) -* Remove warning alert in watch bundle ([#5714](https://github.com/Leaflet/Leaflet/issues/5714) by [perliedman](https://github.com/perliedman)) -* New rollup config signature ([#5812](https://github.com/Leaflet/Leaflet/issues/5812) by [iH8](https://github.com/iH8)) - - -## 1.2.0 (2017-08-08) - -### API Changes - -* Make `L.LineUtil._flat` public as `L.LineUtil.isFlat` ([#5667](https://github.com/Leaflet/Leaflet/issues/5667) by [yohanboniface](https://github.com/yohanboniface)) -* `L.ImageOverlay`'s `setBounds` method accepts an array of points, not only a `L.LatLngBounds` instance ([#5687](https://github.com/Leaflet/Leaflet/pull/5687) by [ronikar](https://github.com/ronikar) - -### Improvements - -* `VideoOverlay` accepts `VideoElement` ([#5661](https://github.com/Leaflet/Leaflet/issues/5661) by [eavidan-0](https://github.com/eavidan-0)) -* Documentation improvements by [ghybs](https://github.com/ghybs), [thachhoang](https://github.com/thachhoang), [colbin8r](https://github.com/colbin8r), [Timmmm](https://github.com/Timmmm), [cyrilf](https://github.com/cyrilf) and [JonDum](https://github.com/JonDum) -* Filter published files on npm ([#5626](https://github.com/Leaflet/Leaflet/issues/5626) by [TrySound](https://github.com/TrySound)), [e7o-de](https://github.com/e7o-de) -* Throw an error if trying to use `addLayer` with something that is not a `Layer` ([#5689](https://github.com/Leaflet/Leaflet/pull/5689) by [perliedman](https://github.com/perliedman)) -* Ensure copyright banner is kept in the minified `leaflet.js` ([#5682](https://github.com/Leaflet/Leaflet/pull/5682) by [jgravois](https://github.com/jgravois)) - -### Bug fixes - -* Fix non-extendable objects regression of 1.1.0 ([#5658](https://github.com/Leaflet/Leaflet/pull/5658) by [mourner](https://github.com/mourner)) -* `Control.Layers` properly handles adding the same layer multiple times, as well as cleanup ([#5672](https://github.com/Leaflet/Leaflet/issues/5672), [#5684](https://github.com/Leaflet/Leaflet/issues/5684) and [#5673](https://github.com/Leaflet/Leaflet/issues/5673) by [jjimenezshaw](https://github.com/jjimenezshaw)) -* Make `L.Draggable._dragging` public again ([#5659](https://github.com/Leaflet/Leaflet/issues/5659) by [yohanboniface](https://github.com/yohanboniface)) -* `DomEvent.off` returns `this` ([#5601](https://github.com/Leaflet/Leaflet/issues/5601) by [jelhan](https://github.com/jelhan)) -* Don't use functions from the global `L` internally ([#5596](https://github.com/Leaflet/Leaflet/issues/5596) by [atd-schubert](https://github.com/atd-schubert)) -* Return `this` instead of `addOne` in `DomEvent.disableScrollPropagation` ([#5595](https://github.com/Leaflet/Leaflet/issues/5595) by [Eschon](https://github.com/Eschon)) - - -## 1.1.0 (2017-06-27) - -### API changes - -* Add deprecation notice for `L.Mixin.Events`, fixes [#5358](https://github.com/Leaflet/Leaflet/issues/5358) ([#5365](https://github.com/Leaflet/Leaflet/issues/5365)) (by [perliedman](https://github.com/perliedman)) -* Turn `nonBubblingEvents` into a documented boolean option ([#4883](https://github.com/Leaflet/Leaflet/issues/4883) by [IvanSanchez](https://github.com/IvanSanchez)) -* Add `L.transformation` factory, allow creation from array ([#5282](https://github.com/Leaflet/Leaflet/issues/5282) by [anetz89](https://github.com/anetz89)) -* `toGeoJSON` methods now default to a precision of six decimals (as recommended in the [GeoJSON spec](https://tools.ietf.org/html/rfc7946#section-11.2)), precision is settable through a method parameter ([#5544](https://github.com/Leaflet/Leaflet/pull/5544) by [mattgrande](https://github.com/mattgrande)) - -### Docs & Web Site - -* `reference.html` now always points to latest stable docs ([#5490](https://github.com/Leaflet/Leaflet/issues/5490) by [IvanSanchez](https://github.com/IvanSanchez), [#5493](https://github.com/Leaflet/Leaflet/issues/5493) by [alyhegazy](https://github.com/alyhegazy)) -* Subresource integrity information and scripts ([#5468](https://github.com/Leaflet/Leaflet/issues/5468) by [IvanSanchez](https://github.com/IvanSanchez)) -* New tutorial on zooming (by [IvanSanchez](https://github.com/IvanSanchez), [#5007](https://github.com/Leaflet/Leaflet/issues/5007)) -* Minor documentation improvements by [perliedman](https://github.com/perliedman), [veltman](https://github.com/veltman), [FDMS](https://github.com/FDMS), [ghybs](https://github.com/ghybs), [RichardLitt](https://github.com/RichardLitt), [gatsbimantico](https://github.com/gatsbimantico), [daturkel](https://github.com/daturkel), [jgravois](https://github.com/jgravois), [geografa](https://github.com/geografa), [BjoernSchilberg](https://github.com/BjoernSchilberg), [IvanSanchez](https://github.com/IvanSanchez), [bozdoz](https://github.com/bozdoz), [zemadz](https://github.com/zemadz), [danzel](https://github.com/danzel), [jieter](https://github.com/jieter), [massic80](https://github.com/massic80), [jjimenezshaw](https://github.com/jjimenezshaw), [hnrchrdl](https://github.com/hnrchrdl) and [RayBB](https://github.com/RayBB) - -### ES6 / Rollup - -* ES6 modules & Rollup ([#4989](https://github.com/Leaflet/Leaflet/issues/4989)) (by [mourner](https://github.com/mourner) and [IvanSanchez](https://github.com/IvanSanchez)) -* Additional fixes, testing and cleanup of ES6 code by [thachhoang](https://github.com/thachhoang), [danzel](https://github.com/danzel), [jkuebart](https://github.com/jkuebart), [simon04](https://github.com/simon04), [perliedman](https://github.com/perliedman), [luiscamachopt](https://github.com/luiscamachopt) and [Trufi](https://github.com/Trufi) ([#5373](https://github.com/Leaflet/Leaflet/issues/5373), [#5417](https://github.com/Leaflet/Leaflet/issues/5417), [#5351](https://github.com/Leaflet/Leaflet/issues/5351), [#5330](https://github.com/Leaflet/Leaflet/issues/5330), [#5329](https://github.com/Leaflet/Leaflet/issues/5329), [#5489](https://github.com/Leaflet/Leaflet/issues/5489), [#5504](https://github.com/Leaflet/Leaflet/issues/5504), [#5456](https://github.com/Leaflet/Leaflet/issues/5456), [#5463](https://github.com/Leaflet/Leaflet/issues/5463)) - -### Improvements - -* Add new class `L.VideoOverlay` ([#4988](https://github.com/Leaflet/Leaflet/issues/4988) by [IvanSanchez](https://github.com/IvanSanchez)) -* Added z-index support to ImageOverlay ([#5418](https://github.com/Leaflet/Leaflet/issues/5418) by [Saulzi](https://github.com/Saulzi)) -* Added error event to `ImageOverlay` layer and added tests for the new ([#5416](https://github.com/Leaflet/Leaflet/issues/5416) by [Saulzi](https://github.com/Saulzi)) -* Add `className` option for `ImageOverlay` ([#5555](https://github.com/Leaflet/Leaflet/issues/5555) by [perliedman](https://github.com/perliedman)) - -### Bug fixes - -* Handle edge case of empty bounds on `_getBoundsCenterZoom` ([#5157](https://github.com/Leaflet/Leaflet/issues/5157) by [IvanSanchez](https://github.com/IvanSanchez)) -* Add new methods to `L.Bounds` for 2 missing corners, fixes [#5475](https://github.com/Leaflet/Leaflet/issues/5475) ([#5488](https://github.com/Leaflet/Leaflet/issues/5488) by [ghybs](https://github.com/ghybs)) -* Handle `Polyline`s with empty array of `LatLng`s, [#5497](https://github.com/Leaflet/Leaflet/issues/5497) ([#5498](https://github.com/Leaflet/Leaflet/issues/5498), by [perliedman](https://github.com/perliedman)) -* Take `devicePixelRatio` into account for scrollwheel zoom in win10+chrome ([#5480](https://github.com/Leaflet/Leaflet/issues/5480)) (by [IvanSanchez](https://github.com/IvanSanchez)) -* Add hook points to allow for a proper NoGap plugin ([#5476](https://github.com/Leaflet/Leaflet/issues/5476)) (by [IvanSanchez](https://github.com/IvanSanchez)) -* Sanity check to prevent loading tiles when bounds are `Infinity` ([#5478](https://github.com/Leaflet/Leaflet/issues/5478), [#5479](https://github.com/Leaflet/Leaflet/issues/5479) by [IvanSanchez](https://github.com/IvanSanchez)) -* Fix box zoom race condition ([#5452](https://github.com/Leaflet/Leaflet/issues/5452) by [ppaskaris](https://github.com/ppaskaris)) -* On update set current tiles active to avoid pruning ([#5381](https://github.com/Leaflet/Leaflet/issues/5381)) ([#5431](https://github.com/Leaflet/Leaflet/issues/5431) by [oliverheilig](https://github.com/oliverheilig)) -* Make `L.Mixin.Events` a simple object instead of a prototype so it doesn't have a 'constructor' property, fixes [#5451](https://github.com/Leaflet/Leaflet/issues/5451) ([#5453](https://github.com/Leaflet/Leaflet/issues/5453) by [luiscamachopt](https://github.com/luiscamachopt)) -* Canvas: call `ctx.setLineDash` in `_fillStroke` [#5182](https://github.com/Leaflet/Leaflet/issues/5182) ([#5454](https://github.com/Leaflet/Leaflet/issues/5454) by [TeXitoi](https://github.com/TeXitoi)) -* Only rearrange DOM in `toFront`/`toBack` if needed, fixes [#4050](https://github.com/Leaflet/Leaflet/issues/4050) ([#5465](https://github.com/Leaflet/Leaflet/issues/5465) by [perliedman](https://github.com/perliedman)) -* Push back keyboard navigation order of `L.Popup`'s close button ([#5461](https://github.com/Leaflet/Leaflet/issues/5461) by [Mirodil](https://github.com/Mirodil)) -* Remove spurious check in `DomUtil.preventOutline` ([#5435](https://github.com/Leaflet/Leaflet/issues/5435) by [qjas](https://github.com/qjas)) -* Error handler in `ImageOverlay` for 404 links ([#5307](https://github.com/Leaflet/Leaflet/issues/5307)) by [APwhitehat](https://github.com/APwhitehat)) -* Ensure renderer's container is initialized when a path is added to map ([#5404](https://github.com/Leaflet/Leaflet/issues/5404) by [IvanSanchez](https://github.com/IvanSanchez)) -* Layers Control only add layer events to layers when we are on the map. Fixes [#5421](https://github.com/Leaflet/Leaflet/issues/5421) ([#5422](https://github.com/Leaflet/Leaflet/issues/5422) by [danzel](https://github.com/danzel)) -* Layers Control can now become scrollable even if `collapsed: false`, fixes [#5328](https://github.com/Leaflet/Leaflet/issues/5328) ([#5348](https://github.com/Leaflet/Leaflet/issues/5348) by [ghybs](https://github.com/ghybs)) -* Stop map on drag start instead of pointer down, fixes [#5350](https://github.com/Leaflet/Leaflet/issues/5350) ([#5378](https://github.com/Leaflet/Leaflet/issues/5378) by [perliedman](https://github.com/perliedman)) -* fix invalid GeoJSON produced by nested `LayerGroups` ([#5359](https://github.com/Leaflet/Leaflet/issues/5359) by [Resonance1584](https://github.com/Resonance1584)) -* Update toolbar inner border radius ([#5361](https://github.com/Leaflet/Leaflet/issues/5361) by [newmanw](https://github.com/newmanw)) -* Export `lastId` in `Util` ([#5349](https://github.com/Leaflet/Leaflet/issues/5349) by [DenisCarriere](https://github.com/DenisCarriere)) -* Do not stop keypress on escape if no popup is open, plus unit tests ([#5331](https://github.com/Leaflet/Leaflet/issues/5331) (by [IvanSanchez](https://github.com/IvanSanchez)) -* Docs: remove `iframe` borders on examples ([#5327](https://github.com/Leaflet/Leaflet/issues/5327)) (by [tariqksoliman](https://github.com/tariqksoliman)) -* Pull `min`/`maxNativeZoom` from `TileLayer` into `GridLayer`, as per [#5316](https://github.com/Leaflet/Leaflet/issues/5316). ([#5319](https://github.com/Leaflet/Leaflet/issues/5319) by [jkuebart](https://github.com/jkuebart)) -* Disable click propagation on zoom control buttons, fixes [#5308](https://github.com/Leaflet/Leaflet/issues/5308) ([#5318](https://github.com/Leaflet/Leaflet/issues/5318) by [perliedman](https://github.com/perliedman)) -* Add CSS for `-webkit-tap-highlight-color`, fixes [#5302](https://github.com/Leaflet/Leaflet/issues/5302) ([#5303](https://github.com/Leaflet/Leaflet/issues/5303) by [IvanSanchez](https://github.com/IvanSanchez)) -* Removed type attribute in HTML5 files ([#5309](https://github.com/Leaflet/Leaflet/issues/5309) by [uzerus](https://github.com/uzerus)) -* Add margin to `LatLngBounds.equals` method ([#5071](https://github.com/Leaflet/Leaflet/issues/5071) by [miguelcobain](https://github.com/miguelcobain)) -* Add `L.Draggable` options and fix docstring ([#5301](https://github.com/Leaflet/Leaflet/issues/5301) by [IvanSanchez](https://github.com/IvanSanchez)) -* Fix max/min calculation for `getBoundsZoom`, fixes [#5136](https://github.com/Leaflet/Leaflet/issues/5136) ([#5137](https://github.com/Leaflet/Leaflet/issues/5137) by [IvanSanchez](https://github.com/IvanSanchez)) -* Scrubbing of detached DOM elements, prevents memory leaks; fixes [#5263](https://github.com/Leaflet/Leaflet/issues/5263) ([#5265](https://github.com/Leaflet/Leaflet/issues/5265) by [IvanSanchez](https://github.com/IvanSanchez)) -* Remove `marker.dragging` when not on the map, fixes [#5293](https://github.com/Leaflet/Leaflet/issues/5293) ([#5295](https://github.com/Leaflet/Leaflet/issues/5295) by [danzel](https://github.com/danzel)) -* Stop scroll propagation in `L.Layers.Control` in chrome>55 ([#5280](https://github.com/Leaflet/Leaflet/issues/5280) by [IvanSanchez](https://github.com/IvanSanchez)) -* Allow HTML inputs in layer control's labels, fixes [#5116](https://github.com/Leaflet/Leaflet/issues/5116) ([#51165544](https://github.com/Leaflet/Leaflet/issues/5544) by [iZucken](https://github.com/iZucken)) -* Fix possible null reference when auto detecting icon default path, fixes [#5534](https://github.com/Leaflet/Leaflet/issues/5534) ([#5535](https://github.com/Leaflet/Leaflet/issues/5535) by [williamscs](https://github.com/williamscs)) -* Don't turn enter keypress into map clicks, fixes [#5499](https://github.com/Leaflet/Leaflet/issues/5499) ([#5507](https://github.com/Leaflet/Leaflet/issues/5507) by [perliedman](https://github.com/perliedman)) -* Use minus character instead of hyphen in the zoom control ([#5501](https://github.com/Leaflet/Leaflet/issues/5501) by [damianmoore](https://github.com/damianmoore)) - -## 1.0.3 (2017-01-23) - -### Bug fixes - -* Avoid extra `L.Canvas` redraws on several scenarios (by [@perliedman](https://github.com/perliedman), [#5250](https://github.com/Leaflet/Leaflet/pull/5034), also thanks to [@manubb](https://github.com/manubb) for investigation and PR). -* Fix behaviour of `dblclick` events in [Chrome 55 due to `PointerEvent`s](https://developers.google.com/web/updates/2016/11/nic55#pointer-events) (by [@IvanSanchez](https://github.com/IvanSanchez), [#5185](https://github.com/Leaflet/Leaflet/pull/5185), [#5248](https://github.com/Leaflet/Leaflet/pull/5248), [#5268](https://github.com/Leaflet/Leaflet/pull/5268)). -* Fix a dangling comma making IE8 fail to parse the code (by [@batje](https://github.com/batje), [#5270](https://github.com/Leaflet/Leaflet/pull/5270)). -* Backport event handling fixes from [#5054](https://github.com/Leaflet/Leaflet/pull/5054) into `L.SVG.VML` for IE8 (by [@IvanSanchez](https://github.com/IvanSanchez), [#5215](https://github.com/Leaflet/Leaflet/pull/5215)). -* Fix a race condition when closing popups during their `popupopen` event (by [@hagai26](https://github.com/hagai26), [#5202](https://github.com/Leaflet/Leaflet/pull/5202)). -* Fix `getBoundsZoom` return value on CRSs with a flipped axis (by [@computerlove](https://github.com/computerlove), [#5204](https://github.com/Leaflet/Leaflet/pull/5204)). -* Avoid infinite loops when the `errorTileUrl` of a `L.TileLayer` returns 404 (by [@IvanSanchez](https://github.com/IvanSanchez), [#5177](https://github.com/Leaflet/Leaflet/pull/5177)). -* Remove erroneous initialization of unused event listeners (by [@Brikky](https://github.com/Brikky), [#5160](https://github.com/Leaflet/Leaflet/pull/5160)). -* Fix rounding of `L.Canvas` redraw areas to avoid artifacts during partial updates (by [@Ernie23](https://github.com/Ernie23), [#5148](https://github.com/Leaflet/Leaflet/pull/5148)). -* Fix `isPopupOpen()` behaviour of `L.Layer` when no popup is bound to a layer (by [@gvangool](https://github.com/gvangool), [#5106](https://github.com/Leaflet/Leaflet/pull/5106)). -* Add a sanity check in `LatLngBounds.contains()` to allow for non-instantiated `LatLng` objects (by [@IvanSanchez](https://github.com/IvanSanchez), [#5135](https://github.com/Leaflet/Leaflet/pull/5135)). -* Fix collapsing of `L.Control.Layers` when the `collapse` option is `false` (by [@perliedman](https://github.com/perliedman), [#5131](https://github.com/Leaflet/Leaflet/pull/5131)). - -### API changes - -* Added a new `WrapLatLngBounds` method to `L.CRS`, to fix an issue with `maxBounds` of `GridLayer`s (by [@IvanSanchez](https://github.com/IvanSanchez), [#5185](https://github.com/Leaflet/Leaflet/pull/5185), also thanks to [@DiogoMCampos](https://github.com/DiogoMCampos) for investigation). -* `L.Map.getSize()` will now return `0` instead of `NaN` in non-graphical environments (by [@ughitsaaron](https://github.com/ughitsaaron), [#5209](https://github.com/Leaflet/Leaflet/pull/5209)). - -### Improvements - -* Several minor documentation improvements by [@IvanSanchez](https://github.com/IvanSanchez), [@jieter](https://github.com/jieter), [@alonsogarciapablo](https://github.com/alonsogarciapablo), [@jasonoverland](https://github.com/jasonoverland), [@danzel](https://github.com/danzel), [@ghybs](https://github.com/ghybs), [@Ralf8686](https://github.com/Ralf8686), [@geoloep](https://github.com/geoloep) -* Add an `alt` attribute to the ``s of marker shadows (by [@topicus](https://github.com/topicus), [#5259](https://github.com/Leaflet/Leaflet/pull/5259)). - -## 1.0.2 (2016-11-21) - -### Bug fixes - -* Fix CSS for marker shadows when `max-width` is already set (by [@brunob](https://github.com/brunob), [#5046](https://github.com/Leaflet/Leaflet/pull/5046)). -* Fix canvas redraw when style updates fill and/or weight (by [@perliedman](https://github.com/perliedman), [#5034](https://github.com/Leaflet/Leaflet/pull/5034)). -* Prevent canvas from firing multiple `mouseover` events for same layer (by [@perliedman](https://github.com/perliedman), [#5033](https://github.com/Leaflet/Leaflet/pull/5033)). -* Fixed a race condition when removing and adding `L.Canvas` vectors during a zoom animation (by [@ghybs](https://github.com/ghybs)) [#5011](https://github.com/Leaflet/Leaflet/pull/5011). -* Fix zoom animation of ImageOverlay when CRS's Y axis is flipped (by [@perliedman](https://github.com/perliedman)), [#4993](https://github.com/Leaflet/Leaflet/pull/4993). -* Fix encoding/decoding of GeoJSON `FeatureCollection`s (by [@IvanSanchez](https://github.com/IvanSanchez)), [#5045](https://github.com/Leaflet/Leaflet/issues/5045). -* Fix `minZoom`/`maxZoom` late inizialization (by [@IvanSanchez](https://github.com/IvanSanchez)), [#4916](https://github.com/Leaflet/Leaflet/pull/4916). -* Fix styling of custom SVG markers by making stricter CSS selectors (by [@jwoyame](https://github.com/jwoyame)) [#4597](https://github.com/Leaflet/Leaflet/pull/4597). -* Fix order of `mouseover`/`mouseout` events on overlapping `L.Canvas` layers (by [@perliedman](https://github.com/perliedman)), [#5090](https://github.com/Leaflet/Leaflet/pull/5090). -* Fix drag behaviour when a draggable marker is removed in mid-drag (by [@IvanSanchez](https://github.com/IvanSanchez), [#5063](https://github.com/Leaflet/Leaflet/pull/5063). -* Fix `L.Control.Layers.collapse()` on initially uncollapsed layer controls (by [@perliedman](https://github.com/perliedman)), [#5131](https://github.com/Leaflet/Leaflet/pull/5131). -* Fix blurriness of `L.Tooltip` by rounding up pixel coordinates (by [@ashmigelski](https://github.com/ashmigelski)), [#5089](https://github.com/Leaflet/Leaflet/pull/5089). -* Fix click events on overlapping geometries when using `L.Canvas` (by [@perliedman](https://github.com/perliedman)), [#5100](https://github.com/Leaflet/Leaflet/pull/5100). - -### API changes - -* Add a `sortLayers` option to `L.Control.Layers` (by [@IvanSanchez](https://github.com/IvanSanchez), [#4711](https://github.com/Leaflet/Leaflet/pull/4711). -* Implement `bringToFront` and `bringToBack` when using `L.Canvas`, plus preventing other canvas glitches (by [@perliedman](https://github.com/perliedman)), [#5115](https://github.com/Leaflet/Leaflet/pull/5115). -* Add `minNativeZoom` option to `L.TileLayer`s. (by [@bb-juliogarcia](https://github.com/bb-juliogarcia)), [#5088](https://github.com/Leaflet/Leaflet/pull/5088). - -### Improvements - -* Improve performance when adding lots of `L.Path`s by refactoring away event logic (by [@IvanSanchez](https://github.com/IvanSanchez)) [#5054](https://github.com/Leaflet/Leaflet/pull/5054))]. -* Several minor documentation improvements by [@Jmuccigr](https://github.com/Jmuccigr), [@serdarkacka](https://github.com/serdarkacka), [@erickzhao](https://github.com/erickzhao), [@IvanSanchez](https://github.com/IvanSanchez), [@perliedman](https://github.com/perliedman), [@joukewitteveen](https://github.com/joukewitteveen). -* Code reorganization: Extensions for `L.Marker` and `L.Map` no longer have a separate file (by [@mourner](https://github.com/mourner)). -* Removed a duplicated unit test ([@yohanboniface](https://github.com/yohanboniface)). -* Accesibility improvements (ARIA/screenreader related) on map tiles (by [@patrickarlt](https://github.com/patrickarlt)) [#5092](https://github.com/Leaflet/Leaflet/pull/5092). - -## 1.0.1 (2016-09-30) - -### Bug fixes - -* Fixed vector rendering regression in IE8 (by [@perliedman](https://github.com/perliedman)) [#4656](https://github.com/Leaflet/Leaflet/pull/4956). -* Fixed Webpack error when bundling Leaflet's CSS (by [@jefbarn](https://github.com/jefbarn)) [#4679](https://github.com/Leaflet/Leaflet/pull/4979). - -## 1.0.0 (2016-09-26) - -### API changes - -* Remove deprecated `zoomanimated` option for `L.Popup`s (by [@fnicollet](https://github.com/fnicollet)) [#4699](https://github.com/Leaflet/Leaflet/pull/4699) - -### Improvements - -* Several minor fixes to the documentation (by [@IvanSanchez](https://github.com/IvanSanchez), [@alejo90](https://github.com/alejo90), [@ghybs](https://github.com/ghybs), [@JonasDralle](https://github.com/JonasDralle)) -* Add license to `bower.json` (by [@anotherredward](https://github.com/anotherredward)) [#4865](https://github.com/Leaflet/Leaflet/pull/4865) -* Allow creating tooltips without a source layer (by [@yohanboniface](https://github.com/yohanboniface)) [#4836](https://github.com/Leaflet/Leaflet/pull/4836) -* Detect `L.Icon` default path using CSS (by [@IvanSanchez](https://github.com/IvanSanchez)) [#4605](https://github.com/Leaflet/Leaflet/pull/4605) - -### Bug fixes - -* Fix handling of `getScaleZoom` in some custom CRSs (by [@theashyster](https://github.com/theashyster)) [#4919](https://github.com/Leaflet/Leaflet/pull/4919) -* Guard `L.Path` event handlers against race conditions (by [@perliedman](https://github.com/perliedman) and [@IvanSanchez](https://github.com/IvanSanchez)) [#4855](https://github.com/Leaflet/Leaflet/pull/4855) [#4929](https://github.com/Leaflet/Leaflet/pull/4929) [#4838](https://github.com/Leaflet/Leaflet/pull/4838) -* In `L.GridLayer`s, wrap `tileBounds` when `noWrap` is false (by [@fyeah](https://github.com/fyeah)) [#4908](https://github.com/Leaflet/Leaflet/pull/4908) -* Fix `L.Path`'s `bringToFront()` behaviour in the Edge browser (by [@nikolai-b](https://github.com/nikolai-b)) [#4848](https://github.com/Leaflet/Leaflet/pull/4848) -* Remove spurious counting of event handlers (by [@perliedman](https://github.com/perliedman)) [#4842](https://github.com/Leaflet/Leaflet/pull/4842) -* Throw error on `getCenter()` when a `L.Polygon` has no map and thus no CRS (by [@snkashis](https://github.com/snkashis)) [#4820](https://github.com/Leaflet/Leaflet/pull/4820) -* Add a `_leaflet_id` to map containers to prevent error when removing a map twice (by [@IvanSanchez](https://github.com/IvanSanchez)) [#4810](https://github.com/Leaflet/Leaflet/pull/4810) -* Do not fail when closing a tooltip which is not in a map (by [@yohanboniface](https://github.com/yohanboniface)) [#4937](https://github.com/Leaflet/Leaflet/pull/4937) - - -## 1.0-rc3 (2016-08-05) - -### API changes -- `L.Tooltip` `offset` option now defaults to `[0, 0]` (by [@yohanboniface](https://github.com/yohanboniface)) [#4773](https://github.com/Leaflet/Leaflet/pull/4773) -- Event listeners are now always called in the order they have been registered, while until rc2 listeners with a context were all called before listeners without context (even if registered later), and the listeners with context were called in an unpredictable order (by [@yohanboniface](https://github.com/yohanboniface)) [#4769](https://github.com/Leaflet/Leaflet/pull/4769) - -### Improvements -- Added `oldLatLng` in `L.Marker` `drag` event (by [@snkashis](https://github.com/snkashis)) [#4752](https://github.com/Leaflet/Leaflet/pull/4752) - -### Bug fixes -- Fixed regression where event listeners where not always fired in the order of registration (by [@yohanboniface](https://github.com/yohanboniface)) [#4769](https://github.com/Leaflet/Leaflet/pull/4769) -- Fixed `L.Tooltip` zoom animation (by [@yohanboniface](https://github.com/yohanboniface)) [#4744](https://github.com/Leaflet/Leaflet/pull/4744) -- Fixed `layer.bindTooltip` crashing when called before adding the layer to the map (by [@yohanboniface](https://github.com/yohanboniface)) [#4779](https://github.com/Leaflet/Leaflet/pull/4779) -- Fixed regression in `L.Popup` autopaning (by [@yohanboniface](https://github.com/yohanboniface)) [#4768](https://github.com/Leaflet/Leaflet/pull/4768) -- Fixed non permanent `L.Tooltip` not being closed on touch when touching the map (by [@yohanboniface](https://github.com/yohanboniface)) [#4767](https://github.com/Leaflet/Leaflet/pull/4767) -- Fixed `popupopen` and `popupclose` not being fired when clicking on path with an open popup (by [@yohanboniface](https://github.com/yohanboniface)) [#4788](https://github.com/Leaflet/Leaflet/pull/4788) - - -## 1.0-rc2 (2016-07-18) - -### API changes -* Make `L.Handler.enable`/`disable` return `this` (by [@yohanboniface](https://github.com/yohanboniface)) [#4708](https://github.com/Leaflet/Leaflet/pull/4708) -* Icon `size` option can now be initialised with a number (by [@rheh](https://github.com/rheh)) [#4608](https://github.com/Leaflet/Leaflet/pull/4608) -* Add `classname` option to `L.GridLayer` (by [@jayvarner](https://github.com/jayvarner)) [#4553](https://github.com/Leaflet/Leaflet/pull/4553) -* Consistent returns for `Map.addLayer` (by [@nathancahill](https://github.com/nathancahill)) [#4504](https://github.com/Leaflet/Leaflet/pull/4504) -* Create points from objects with `x` and `y` properties (by [@nathancahill](https://github.com/nathancahill)) [#4465](https://github.com/Leaflet/Leaflet/pull/4465) -* Add `updateWhenZooming` option to `L.GridLayer` (by [@IvanSanchez](https://github.com/IvanSanchez)) [#4462](https://github.com/Leaflet/Leaflet/pull/4462) - -### Improvements -* Refactoring of events (by [@fab1an](https://github.com/fab1an) and [@perliedman](https://github.com/perliedman)) [#4697](https://github.com/Leaflet/Leaflet/pull/4697) -* Do not alter `popup.options.offset` when computing popup offset (fix #4645) (by [@yohanboniface](https://github.com/yohanboniface)) [#4662](https://github.com/Leaflet/Leaflet/pull/4662) -* Use different `L.Bounds` for "marking as prunable" and loading tiles (by [@IvanSanchez](https://github.com/IvanSanchez)) [#4650](https://github.com/Leaflet/Leaflet/pull/4650) -* Added `L.Tooltip` class to display small tooltips on the map (by [@yohanboniface](https://github.com/yohanboniface)) [#3952](https://github.com/Leaflet/Leaflet/pull/3952) - -### Bug fixes -* Fixed `GridLayer`'s outer edge snapping to vertical center of map (fix #4702) (by [@yohanboniface](https://github.com/yohanboniface)) [#4704](https://github.com/Leaflet/Leaflet/pull/4704) -* Fixed scrollwheel zoom too fast in MS Edge (by [@IvanSanchez](https://github.com/IvanSanchez)) [#4694](https://github.com/Leaflet/Leaflet/pull/4694) -* Use `pointer-events: visiblePainted` as fallback for IE <11 (by [@perliedman](https://github.com/perliedman)) [#4690](https://github.com/Leaflet/Leaflet/pull/4690) -* Avoid double borders on `abbr` in website (by [@brunob](https://github.com/brunob)) [#4663](https://github.com/Leaflet/Leaflet/pull/4663) -* Prevent firing map click when layer has popup (by [@jwoyame](https://github.com/jwoyame)) [#4603](https://github.com/Leaflet/Leaflet/pull/4603) -* Disable pointer events on popup tip (by [@jwoyame](https://github.com/jwoyame)) [#4599](https://github.com/Leaflet/Leaflet/pull/4599) -* Prevent `L.DomUtil.create()` from automatically setting a CSS class name (by [@MuellerMatthew](https://github.com/MuellerMatthew)) [#4563](https://github.com/Leaflet/Leaflet/pull/4563) -* Fix off-by-one bug in `Control.Layers._getLayer` (by [@ValentinH](https://github.com/ValentinH)) [#4561](https://github.com/Leaflet/Leaflet/pull/4561) -* Fix scrollwheel events zomming two levelz in Chrome by scaling down `getWheelDelta()` (by [@IvanSanchez](https://github.com/IvanSanchez)) [#4538](https://github.com/Leaflet/Leaflet/pull/4538) -* Prevent event listeners from being called when all listeners are removed (by [@perliedman](https://github.com/perliedman)) [#4555](https://github.com/Leaflet/Leaflet/pull/4555) -* Don't prevent browser's touch scroll and/or zoom unless handlers are enabled (by [@perliedman](https://github.com/perliedman)) [#4552](https://github.com/Leaflet/Leaflet/pull/4552) -* Fixed `getBoundsZoom` with small size and padding (by [@dianjin](https://github.com/dianjin)) [#4532](https://github.com/Leaflet/Leaflet/pull/4532) -* Fixed `L.Control.Layers` in IE8 (by [@jieter](https://github.com/jieter)) [#4509](https://github.com/Leaflet/Leaflet/pull/4509) -* Fixed `TileLayer`'s retina logic when `zoomReverse` is enabled. (by [@perliedman](https://github.com/perliedman)) [#4503](https://github.com/Leaflet/Leaflet/pull/4503) -* Fixed `setMaxBounds` not resetting `maxBounds` when passing `null` argument (by [@yohanboniface](https://github.com/yohanboniface)) [#4494](https://github.com/Leaflet/Leaflet/pull/4494) -* Fixed canvas not filtering click event after drag (by [@yohanboniface](https://github.com/yohanboniface)) [#4493](https://github.com/Leaflet/Leaflet/pull/4493) -* Fixed `L.Control.removeLayer()` raising an error when trying to remove a layer not yet added (by [@jieter](https://github.com/jieter)) [#4487](https://github.com/Leaflet/Leaflet/pull/4487) -* Fixed disabling drag on click in IE11 (by [@perliedman](https://github.com/perliedman)) [#4479](https://github.com/Leaflet/Leaflet/pull/4479) -* Fixed `L.Evented.listens()` on removed event handlers, #4474 (by [@IvanSanchez](https://github.com/IvanSanchez)) [#4476](https://github.com/Leaflet/Leaflet/pull/4476) -* Better handling of `markerZoomAnimation` event hooks (by [@IvanSanchez](https://github.com/IvanSanchez)) [#4460](https://github.com/Leaflet/Leaflet/pull/4460) - - -## 1.0-rc1 (2016-04-18) - -### API changes -* Make `L.Control.Layers.collapse`/`expand` public methods (by [@yohanboniface](https://github.com/yohanboniface)) [#4370](https://github.com/Leaflet/Leaflet/pull/4370) -* Make `L.latLngBounds` factory return an empty bounds with no argument (by [@yohanboniface](https://github.com/yohanboniface)) [#4368](https://github.com/Leaflet/Leaflet/pull/4368) -* `Map.fitBounds` now raises an error if bounds are not valid (by [@theotow](https://github.com/theotow)) [#4353](https://github.com/Leaflet/Leaflet/pull/4353) -* Temporarily support legacy options on `L.Circle` (by [@JrFolk](https://github.com/JrFolk)) [#4290](https://github.com/Leaflet/Leaflet/pull/4290) -* Throw error on `NaN` circle radius (by [@IvanSanchez](https://github.com/IvanSanchez)) [#4237](https://github.com/Leaflet/Leaflet/pull/4237) -* `L.Class.include()` & `mergeOptions()` now return `this` (by [@IvanSanchez](https://github.com/IvanSanchez)) [#4246](https://github.com/Leaflet/Leaflet/pull/4246) -* Consistent GeoJSON casing (by [@yohanboniface](https://github.com/yohanboniface)) [#4108](https://github.com/Leaflet/Leaflet/pull/4108) -* Move `L.LatLng.equals` to `L.CRS.equals`. (by [@perliedman](https://github.com/perliedman)) [#4074](https://github.com/Leaflet/Leaflet/pull/4074) -* Make non-interactive markers not firing pointer events (by [@IvanSanchez](https://github.com/IvanSanchez)) [#3937](https://github.com/Leaflet/Leaflet/pull/3937) - - -### Improvements -* Give popups an id (by [@tylercubell](https://github.com/tylercubell)) [#4355](https://github.com/Leaflet/Leaflet/pull/4355) -* Support `{-y}` in tile layer urls (by [@jieter](https://github.com/jieter)) [#4337](https://github.com/Leaflet/Leaflet/pull/4337) -* Support `dashArray` path option in canvas (by [@gommo](https://github.com/gommo)) [#4173](https://github.com/Leaflet/Leaflet/pull/4173) -* Clean up `navigator.pointerEnabled` (by [@IvanSanchez](https://github.com/IvanSanchez)) [#4287](https://github.com/Leaflet/Leaflet/pull/4287) -* Use array in `L.Control.Layers` internally (by [@jieter](https://github.com/jieter)) [#4227](https://github.com/Leaflet/Leaflet/pull/4227) -* Implement `L.Browser.edge` (by [@IvanSanchez](https://github.com/IvanSanchez)) [#4143](https://github.com/Leaflet/Leaflet/pull/4143) -* Optimized icons (by [@vtduncan](https://github.com/vtduncan)) [#4124](https://github.com/Leaflet/Leaflet/pull/4124) -* Cast `L.DivIcon.bgPos` option to `L.Point` (by [@perliedman](https://github.com/perliedman)) [#4090](https://github.com/Leaflet/Leaflet/pull/4090) -* Switch to wheel event where available (by [@mourner](https://github.com/mourner)) [#3653](https://github.com/Leaflet/Leaflet/pull/3653) -* Fractional zoom controls (by [@IvanSanchez](https://github.com/IvanSanchez) and [@hyperknot](https://github.com/hyperknot)) [#3523](https://github.com/Leaflet/Leaflet/pull/3523) -* Added click tolerance also for non-touch devices (by [DavidUv](https://github.com/DavidUv)) [#4396](https://github.com/Leaflet/Leaflet/pull/4396) - -### Bug fixes -* Fixed an edge case on `Map.fitBounds` (by [@perliedman](https://github.com/perliedman)) [#4377](https://github.com/Leaflet/Leaflet/pull/4377) -* Fixed an edge case bug in `flyTo` (by [@hyperknot](https://github.com/hyperknot)) [#4376](https://github.com/Leaflet/Leaflet/pull/4376) -* Use mean earth radius for distance calculation in `L.CRS.Earth`. (by [@perliedman](https://github.com/perliedman)) [#4369](https://github.com/Leaflet/Leaflet/pull/4369) -* Fixed zoom event fired twice (by [@perliedman](https://github.com/perliedman)) [#4367](https://github.com/Leaflet/Leaflet/pull/4367) -* Initialize canvas dash on init. Check that canvas supports `setLineDash`. (by [@perliedman](https://github.com/perliedman)) [#4364](https://github.com/Leaflet/Leaflet/pull/4364) -* Do not calculate inverted y coords for CRSes with infinite: true (by [@jieter](https://github.com/jieter)) [#4344](https://github.com/Leaflet/Leaflet/pull/4344) -* Fixed zoom handling on `Map.TouchZoom` (by [@IvanSanchez](https://github.com/IvanSanchez)) [#4340](https://github.com/Leaflet/Leaflet/pull/4340) -* Fixed `this._times.length` undefined in `Map.Drag.js` (by [@LucasMouraDeOliveira](https://github.com/LucasMouraDeOliveira)) [#4324](https://github.com/Leaflet/Leaflet/pull/4324) -* Fixed simulated click handling in `L.Path` (by [@elkami12](https://github.com/elkami12)) [#4314](https://github.com/Leaflet/Leaflet/pull/4314) -* Fixed attribution text not removed when Layer is removed from map (by [@dr-itz](https://github.com/dr-itz)) [#4293](https://github.com/Leaflet/Leaflet/pull/4293) -* Fixed bug when adding/removing a layer from `L.Control.Layer` that is not on the map (by [@errebenito](https://github.com/errebenito)) [#4280](https://github.com/Leaflet/Leaflet/pull/4280) -* Fixed `Map.attributionControl` only set on `addInitHook` (by [@snkashis](https://github.com/snkashis)) [#4263](https://github.com/Leaflet/Leaflet/pull/4263) -* Check for `e.originalEvent` in `DomUtil._filterclick` (by [@IvanSanchez](https://github.com/IvanSanchez)) [#4256](https://github.com/Leaflet/Leaflet/pull/4256) -* Stop drag propagation on `L.Draggable` (by [@turban](https://github.com/turban)) [#4250](https://github.com/Leaflet/Leaflet/pull/4250) -* Fixed error when quickly removing a layer just added (by [@hyperknot](https://github.com/hyperknot)) [#4244](https://github.com/Leaflet/Leaflet/pull/4244) -* Fixed not resetting properly on `Map.stop` (by [@IvanSanchez](https://github.com/IvanSanchez)) [#4229](https://github.com/Leaflet/Leaflet/pull/4229) -* Fixed conflict between `Map.fadeAnimation` and `GridLayer.opacity` (by [@IvanSanchez](https://github.com/IvanSanchez)) [#4228](https://github.com/Leaflet/Leaflet/pull/4228) -* Fix fractional zoom calculation (by [@hyperknot](https://github.com/hyperknot)) [#4224](https://github.com/Leaflet/Leaflet/pull/4224) -* Better cleanup of L.Control.Layers, fixes [#4213](https://github.com/Leaflet/Leaflet/pull/4213) (plus unit tests) (by [@IvanSanchez](https://github.com/IvanSanchez)) [#4214](https://github.com/Leaflet/Leaflet/pull/4214) -* Fixed transform issue when not `L.Browser.any3d` (by [@IvanSanchez](https://github.com/IvanSanchez)) [#4212](https://github.com/Leaflet/Leaflet/pull/4212) -* Fixed fractional zoom controls broken when initial zoom isn't specified (by [@IvanSanchez](https://github.com/IvanSanchez)) [#4209](https://github.com/Leaflet/Leaflet/pull/4209) -* Fix extra tiles usage (by [@IvanSanchez](https://github.com/IvanSanchez)) [#4193](https://github.com/Leaflet/Leaflet/pull/4193) -* Sanity check: test `pxBounds` validity before using it (by [@yohanboniface](https://github.com/yohanboniface)) [#4191](https://github.com/Leaflet/Leaflet/pull/4191) -* Disable event defaults when disabling scroll propagation (by [@IvanSanchez](https://github.com/IvanSanchez)) [#4160](https://github.com/Leaflet/Leaflet/pull/4160) -* Fixed precision issues in `L.Circle` radius (by [@IvanSanchez](https://github.com/IvanSanchez)) [#4133](https://github.com/Leaflet/Leaflet/pull/4133) -* Workarounded some touch-capable browsers firing `dblclick` instead of touch events (by [@IvanSanchez](https://github.com/IvanSanchez)) [#4131](https://github.com/Leaflet/Leaflet/pull/4131) -* Use all projected coords when calculating `L.Polyline`'s pixel bounds. (by [@perliedman](https://github.com/perliedman)) [#4114](https://github.com/Leaflet/Leaflet/pull/4114) -* Fixed removing all events when passing an `undefined` property (by [@robertleeplummerjr](https://github.com/robertleeplummerjr)) [#4113](https://github.com/Leaflet/Leaflet/pull/4113) -* Fixed retina URL computation (by [@hyperknot](https://github.com/hyperknot)) [#4110](https://github.com/Leaflet/Leaflet/pull/4110) -* Fire `tileunload` for all unloading of tiles (by [@tcoats](https://github.com/tcoats)) [#4099](https://github.com/Leaflet/Leaflet/pull/4099) -* Fixed duplicated code in `L.GridLayer.retainParent()` (by [@jblarsen](https://github.com/jblarsen)) [#4094](https://github.com/Leaflet/Leaflet/pull/4094) -* Make sure to always reset `_enforcingBounds`. (by [@perliedman](https://github.com/perliedman)) [#4089](https://github.com/Leaflet/Leaflet/pull/4089) -* Fix bug with max bounds and custom projections (by [@OleLaursen](https://github.com/OleLaursen)) [#4078](https://github.com/Leaflet/Leaflet/pull/4078) -* When limiting center to bounds, ignore offsets less than a pixel. (by [@perliedman](https://github.com/perliedman)) [#4077](https://github.com/Leaflet/Leaflet/pull/4077) -* Fixed bug for hover event between circle overlapping polygon on canvas (by [@fimietta](https://github.com/fimietta)) [#4072](https://github.com/Leaflet/Leaflet/pull/4072) -* Fixed but where `L.Control.Layers` where calling `map._size` instead of `getSize()` (by [@Brobin](https://github.com/Brobin)) [#4063](https://github.com/Leaflet/Leaflet/pull/4063) -* Round new map position before animating pan (by [@RLRR](https://github.com/RLRR)) [#4046](https://github.com/Leaflet/Leaflet/pull/4046) -* Fixed overlayed circles not responding to mouse events in canvas (by [@Deftwun](https://github.com/Deftwun)) [#4033](https://github.com/Leaflet/Leaflet/pull/4033) -* Fixed GeoJSON `resetStyle` (by [@yohanboniface](https://github.com/yohanboniface)) [#4028](https://github.com/Leaflet/Leaflet/pull/4028) -* Fixed popup toggle on marker click (by [@yohanboniface](https://github.com/yohanboniface)) [#4016](https://github.com/Leaflet/Leaflet/pull/4016) -* Fixed event target fallbacking to map after marker drag (fix [#3971](https://github.com/Leaflet/Leaflet/pull/3971)) (by [@yohanboniface](https://github.com/yohanboniface)) [#4010](https://github.com/Leaflet/Leaflet/pull/4010) -* Fixed `maxZoom` not honoring 0 (by [@simsibimsiwimsi](https://github.com/simsibimsiwimsi)) [#4000](https://github.com/Leaflet/Leaflet/pull/4000) -* Skip `L.GridLayer._updateLevels()` when out of min/max zoom (prevents IE8 exceptions) (by [@IvanSanchez](https://github.com/IvanSanchez)) [#3999](https://github.com/Leaflet/Leaflet/pull/3999) -* `L.DomUtil.getPosition()` should return a fallback value (for VML in IE8) (by [@IvanSanchez](https://github.com/IvanSanchez)) [#3998](https://github.com/Leaflet/Leaflet/pull/3998) -* `L.Marker`: init interaction regardless of new icon or not (by [@celadevra](https://github.com/celadevra)) [#3978](https://github.com/Leaflet/Leaflet/pull/3978) -* Fix `interactive=false` not taken into account for canvas (by [@yohanboniface](https://github.com/yohanboniface)) [#3956](https://github.com/Leaflet/Leaflet/pull/3956) -* Fix canvas path disappearing on animation (by [@klaftertief](https://github.com/klaftertief)) [#3950](https://github.com/Leaflet/Leaflet/pull/3950) -* Only check for moving draggable in canvas renderer when map is draggable (by [@klaftertief](https://github.com/klaftertief)) [#3942](https://github.com/Leaflet/Leaflet/pull/3942) -* Fix SVG Dragging issues in IE and Edge (by [@perliedman](https://github.com/perliedman)) [#4382](https://github.com/Leaflet/Leaflet/pull/4382) -* Fix click not working on inputs in controls in IE 11 (by [@perliedman](https://github.com/perliedman)) [#4371](https://github.com/Leaflet/Leaflet/pull/4371) -* Make drag and touch zoom handlers insensitive to order of event handlers (by [@perliedman](https://github.com/perliedman)) [#4387](https://github.com/Leaflet/Leaflet/pull/4387) - -### Other -* Added a Code of Conduct (by [@mourner](https://github.com/mourner)) [#4142](https://github.com/Leaflet/Leaflet/pull/4142) -* Dual 1.0 & 0.7 docs to gh-pages (by [@IvanSanchez](https://github.com/IvanSanchez)) [#4085](https://github.com/Leaflet/Leaflet/pull/4085) -* 🍂doc (by [@IvanSanchez](https://github.com/IvanSanchez)) [#3916](https://github.com/Leaflet/Leaflet/pull/3916) -* A lot of documentation improvements (by [@nathancahill](https://github.com/nathancahill)) [#4418](https://github.com/Leaflet/Leaflet/pull/4418), [#4419](https://github.com/Leaflet/Leaflet/pull/4419), [#4423](https://github.com/Leaflet/Leaflet/pull/4423), [#4425](https://github.com/Leaflet/Leaflet/pull/4425) and [a lot more](https://github.com/Leaflet/Leaflet/pulls?q=is%3Apr+author%3Anathancahill+is%3Aclosed) -* Replace links to google groups with ones to GIS StackExchange (by [@IvanSanchez](https://github.com/IvanSanchez)) [#3886](https://github.com/Leaflet/Leaflet/pull/3886) - - -## 1.0-beta2 (2015-10-14) - -Beta 2 fixes over 50 bugs that were reported by users trying out beta 1. The vast majority of changes are small fixes to problems that are triggered in very specific situations or conditions, a few API consolidation changes, and a few browser workarounds. - -### API changes - -* `L.circle` now accepts `radius` as an option (like `L.circleMarker`) rather than a second argument (by [@IvanSanchez](https://github.com/IvanSanchez)) - -### Improvements - -* Implemented canvas optimizations on mousehover interactions (by [@philippelatulippe](https://github.com/philippelatulippe)) [#3076](https://github.com/Leaflet/Leaflet/issues/3076) -* Improved drag behaviour by preventing a `preclick` event during drag (by [@yohanboniface](https://github.com/yohanboniface)) [#3632](https://github.com/Leaflet/Leaflet/issues/3632) -* Implemented `L.ImageOverlay.setBounds()` and fixed image overlay initialization (by [@fminuti](https://github.com/fminuti)) [#3680](https://github.com/Leaflet/Leaflet/pull/3680) -* Implemented draggable items to fire `mousedown` events (by [@yohanboniface](https://github.com/yohanboniface)) [#3682](https://github.com/Leaflet/Leaflet/pull/3682) -* Changed detection of browsers capable of `msPointer` events (by [@IvanSanchez](https://github.com/IvanSanchez)) [#3684](https://github.com/Leaflet/Leaflet/pull/3684) -* Implemented latitude truncation for spherical mercator projection (by [@perliedman](https://github.com/perliedman)) [#3700](https://github.com/Leaflet/Leaflet/issues/3700) -* Armored against browsers not implementing `Geolocation.clearWatch()` [#3707](https://github.com/Leaflet/Leaflet/issues/3707) -* Implemented generation of sourcemaps when building and minifying source files (by [@IvanSanchez](https://github.com/IvanSanchez)) [#3723](https://github.com/Leaflet/Leaflet/pull/3723) -* Added `bringToFront` and `bringToBack` to popups (by [@danzel](https://github.com/danzel)). [#3908](https://github.com/Leaflet/Leaflet/pull/3908) [#3307](https://github.com/Leaflet/Leaflet/issues/3813) -* Multiply offset by 3 on keyboard pan when shift key is pressed (by [@yohanboniface](https://github.com/yohanboniface)) [#3921](https://github.com/Leaflet/Leaflet/pull/3921) - -### Bug fixes - -* Fixed event propagation on double finger tap (by [@IvanSanchez](https://github.com/IvanSanchez)) [#3532](https://github.com/Leaflet/Leaflet/issues/3532) -* Fixed style changes on re-added layers (by [@wpf500](https://github.com/wpf500)) [#3547](https://github.com/Leaflet/Leaflet/pull/3547) -* Fixed `preventOutline` exceptions [#3625](https://github.com/Leaflet/Leaflet/issues/3625) -* Fixed a box zoom regression bug [#3633](https://github.com/Leaflet/Leaflet/issues/3633) -* Fixed `contextmenu` behaviour when there are no event listeners (by [@yohanboniface](https://github.com/yohanboniface)) [#3638](https://github.com/Leaflet/Leaflet/issues/3638) -* Fixed map controls not showing on top of map layers (by [@patrickarlt](https://github.com/patrickarlt)) [#3644](https://github.com/Leaflet/Leaflet/pull/3644) -* Fixed display of marker images with `max-width` (by [@davidjb](https://github.com/davidjb)) [#3647](https://github.com/Leaflet/Leaflet/pull/3647) -* Fixed `mouseout` and `mouseover` event bubbling (by [@yohanboniface](https://github.com/yohanboniface)) [#3648](https://github.com/Leaflet/Leaflet/issues/3648) [#3797](https://github.com/Leaflet/Leaflet/issues/3797) [#3708](https://github.com/Leaflet/Leaflet/issues/3708) -* Fixed a layer control bug when removing layers (by [@davidlukerice](https://github.com/davidlukerice)) [#3651](https://github.com/Leaflet/Leaflet/pull/3651) -* Fixed pan and zoom animations interacting with each other [#3355](https://github.com/Leaflet/Leaflet/issues/3355) [#3655](https://github.com/Leaflet/Leaflet/issues/3655) -* Fixed a regression bug in canvas renderer when removing layers [#3661](https://github.com/Leaflet/Leaflet/issues/3661) -* Remove a workaround for legacy Android 2 browsers [#2282](https://github.com/Leaflet/Leaflet/issues/2282) -* Fixed VML vector rendering in IE8 when removing and re-adding layers (by [@fminuti](https://github.com/fminuti)) [#2809](https://github.com/Leaflet/Leaflet/issues/2809) -* Fixed `flyTo` animations when the map center doesn't change (by [@fminuti](https://github.com/fminuti)) [#3663](https://github.com/Leaflet/Leaflet/pull/3663) -* Fixed fade animations for semitransparent tile layers (by [@w8r](https://github.com/w8r)) [#3671](https://github.com/Leaflet/Leaflet/pull/3671) -* Fixed behaviour of the `baselayerchange` event (by [@yohanboniface](https://github.com/yohanboniface)) [#3677](https://github.com/Leaflet/Leaflet/issues/3677) -* Fixed marker icon handling during a marker drag (by [@IvanSanchez](https://github.com/IvanSanchez)) [#3687](https://github.com/Leaflet/Leaflet/issues/3687) -* Fixed a IE 11 map container visibility bug (by [@fminuti](https://github.com/fminuti)) [#2788](https://github.com/Leaflet/Leaflet/issues/2788) -* Prevented dragging interactions while a map zoom animation is running (by [@IvanSanchez](https://github.com/IvanSanchez)) [#3692](https://github.com/Leaflet/Leaflet/issues/3692) -* Implement disabling layers in the layer control when they are unavailable at the current zoom level (by [@IvanSanchez](https://github.com/IvanSanchez)) [#252](https://github.com/Leaflet/Leaflet/issues/252) -* Refactored `L.Util.requestAnimFrame` definition (by [@fminuti](https://github.com/fminuti)) [#3703](https://github.com/Leaflet/Leaflet/issues/3703) -* Fixed an edge case of `L.Circle.getBounds()` (by [@knabar](https://github.com/knabar)) [#3776](https://github.com/Leaflet/Leaflet/pull/3776) -* Fixed `Rectangle.setBounds()` return value (by [@IvanSanchez](https://github.com/IvanSanchez)) https://github.com/Leaflet/Leaflet/commit/e698f641afadd4a0b412a6c9e065a6dbfbe16f44 -* Fixed event firing order when opening a popup (by [@yohanboniface](https://github.com/yohanboniface)) [#3745](https://github.com/Leaflet/Leaflet/issues/3745) -* Fixed tile layer loading when dragging then immediately pinch-zooming the map (by [@IvanSanchez](https://github.com/IvanSanchez)) [#3814](https://github.com/Leaflet/Leaflet/issues/3814) -* Work around browser limitations when panning the map too far away (by [@yohanboniface](https://github.com/yohanboniface) and [@IvanSanchez](https://github.com/IvanSanchez)) [#3608](https://github.com/Leaflet/Leaflet/issues/3608) -* Fixed popup text selection and touch events for IE 10 (by [@danzel](https://github.com/danzel)) [#3804](https://github.com/Leaflet/Leaflet/issues/3804) -* Fixed tile layer ordering when `maxZoom` is set (by [@patrickarlt](https://github.com/patrickarlt)) [#3721](https://github.com/Leaflet/Leaflet/issues/3721) -* Fixed scale behaviour on non-standard CRSs (by [@javimolla](https://github.com/patrickarlt), special thanks to [Your First PR](https://yourfirstpr.github.io/)) [#2990](https://github.com/Leaflet/Leaflet/issues/2990) -* Fixed rendering of off-screen vector layers (by [@yohanboniface](https://github.com/yohanboniface)) [#3836](https://github.com/Leaflet/Leaflet/issues/3836) -* Fixed rendering of intersecting vector layers (by [@yohanboniface](https://github.com/yohanboniface)) [#3583](https://github.com/Leaflet/Leaflet/issues/3583) -* Enforced stricter code linting -* Fixed disabled drag handlers not being able to be re-enabled (by [@yohanboniface](https://github.com/yohanboniface)) [#3825](https://github.com/Leaflet/Leaflet/issues/3825) -* Fixed panning outside the map bounds (by [@yohanboniface](https://github.com/yohanboniface)) [#3878](https://github.com/Leaflet/Leaflet/issues/3878) -* Worked around IE 11 not focusing the map using keyboard (by [@IvanSanchez](https://github.com/IvanSanchez)) [#3772](https://github.com/Leaflet/Leaflet/issues/3772) -* Fixed vector layer positioning during a zoom animation in low zoom (by [@IvanSanchez](https://github.com/IvanSanchez)) [#3769](https://github.com/Leaflet/Leaflet/issues/3769) -* Implemented `noWrap` option in `L.GridLayer` (by [@IvanSanchez](https://github.com/IvanSanchez)) [#3691](https://github.com/Leaflet/Leaflet/issues/3691) -* Fixed popups panning the map while running another pan animation (by [@yohanboniface](https://github.com/yohanboniface)) [#3744](https://github.com/Leaflet/Leaflet/issues/3744) -* Fixed uncorrect length of scale control due to CSS styles (by [@yohanboniface](https://github.com/yohanboniface)) [#3668](https://github.com/Leaflet/Leaflet/issues/3668) -* Fixed detection of default image path for icons (by [@ilfa](https://github.com/ilfa)) [#3770](https://github.com/Leaflet/Leaflet/pull/3770) -* Various Canvas events fixes (by [@yohanboniface](https://github.com/yohanboniface)) [#3917](https://github.com/Leaflet/Leaflet/pull/3917) -* Fix touch scroll in layers control (by [@yohanboniface](https://github.com/yohanboniface)) [#2882](https://github.com/Leaflet/Leaflet/issues/2882) -* Fix duration not passed through from setView to panBy (by [@yohanboniface](https://github.com/yohanboniface)) [#3300](https://github.com/Leaflet/Leaflet/issues/3300) - - -## 1.0-beta1 (2015-07-14) - -The first beta of the huge, long-awaited Leaflet 1.0 release. - -This version contains a lot of beneficial but potentially breaking changes (especially if you're a plugin author), so please read through the changes carefully if your code breaks after upgrading. - -### Vectors API improvements - -Leaflet vector layers rendering got a major rewrite, making it possible to switch between rendering backends (Canvas, SVG) dynamically (and even use both for different layers at the same time), have more than one physical pane for vector layers, significantly improving performance, adding Canvas retina support, getting rid of ugly hacks and generally making the code much cleaner. Main PR [#2290](https://github.com/Leaflet/Leaflet/pull/2290). - -* Added `Renderer` layer (inherited by SVG/Canvas implementations) that handles renderer bounds and zoom animation. -* Added `SVG` & `Canvas` classes that now contain all renderer-specific code for vector layers and can be added as layers to the map. -* All vector layer classes (`Path`, `Polyline`, etc.) now don't contain any renderer-specific code and instead can be passed a renderer layer to use as `renderer` in options; -* Removed `MultiPolyline` and `MultiPolygon` classes since multiple rings are now handled by `Polyline` and `Polygon` classes respectively. Layers with multiple rings now perform much better (since each is now physically a single path object instead of being a `FeatureGroup` of layers). -* **Dramatically improved performance of interactive Canvas layers**. Mouse events work much faster (due to improved hit detection algorithms), and layers get updated many times faster (with partial redraws instead of redrawing the whole Canvas). -* **Dramatically improved performance of interactive SVG layers** (e.g. creating a big GeoJSON layer and adding to a map got 3x faster while taking 2.5x less memory). [#2240](https://github.com/Leaflet/Leaflet/issues/2240) [#2315](https://github.com/Leaflet/Leaflet/issues/2315) -* Added retina support for Canvas layers. -* Improved default vector layer styles. -* Added `Polyline` and `Polygon` `getCenter` for getting centroids. -* Respectively, improved `Polyline` and `Polygon` popup positioning when calling `openPopup`. -* Improved `Polyline`/`Polygon` `getBounds` to be cached (so it works much faster). -* Changed `Circle` to inherit from `CircleMarker` and not the other way. -* Fixed `GeoJSON` `resetStyle` to work properly in case `style` option wasn't set. -* Fixed a bug where map fired `moveend` when updating Canvas layers. -* Removed `Polyline` and `Polygon` `spliceLatLngs` method (just use `setLatLngs` instead). -* Changed `Polygon` `getLatLngs` to always return an array of rings (nested array) (by [@yohanboniface](https://github.com/yohanboniface)). [#2618](https://github.com/Leaflet/Leaflet/issues/2618) [#3386](https://github.com/Leaflet/Leaflet/pull/3386) [Leaflet/Leaflet#3279](https://github.com/Leaflet/Leaflet/pull/3279) [#2648](https://github.com/Leaflet/Leaflet/issues/2648) -* Added the ability to specify a custom pane for vector layers (making it possible to easily do stacks like vectors-tiles-vectors with proper z-index order) (by [@Jakobud](https://github.com/Jakobud)). [#3266](https://github.com/Leaflet/Leaflet/pull/3266) [#2786](https://github.com/Leaflet/Leaflet/pull/2786) -* Added vector layers `fillRule` option (by [@bullgare](https://github.com/bullgare)). [#2834](https://github.com/Leaflet/Leaflet/pull/2834) -* Removed `L_PREFER_CANVAS` global switch and added `Map` `preferCanvas` option instead (by [@yohanboniface](https://github.com/yohanboniface)). [#3623](https://github.com/Leaflet/Leaflet/pull/3623) - -### Layers API improvements - -All Leaflet layers (including markers, popups, tile and vector layers) have been refactored to have a common parent, `Layer` class, that shares the basic logic of adding and removing. The leads to the following changes (main PR [#2266](https://github.com/Leaflet/Leaflet/pull/2266)): - -* Added `Layer` class which all layers added to a map should inherit from. -* Added `add` and `remove` events to all layers. -* Added `remove` method to layers and controls (`marker.remove()` is now equivalent to `map.removeLayer(marker)`). -* Improved performance of adding and removing layers. -* Added `pane` option to all layers that can be changed (e.g. you can set `pane: 'overlayPane'` to a tile layer). -* Added `map` `createPane` method for custom panes. [#1742](https://github.com/Leaflet/Leaflet/issues/1742) -* Simplified map panes — removed `objectsPane`, all panes are on the same level now. -* Added `shadowPane` option to markers as well. -* Added `getEvents` method to all layers that returns an `{event: listener, ...}` hash; layers now manage its listeners automatically without having to do this in `onAdd`/`onRemove`. -* Added `togglePopup`, `setPopupContent`, `getPopup`, `isPopupOpen` methods to all layers. [#2279](https://github.com/Leaflet/Leaflet/issues/2279) [#2292](https://github.com/Leaflet/Leaflet/issues/2292) -* Improved performance of adding/removing layers with layers control present (instead of listening to any layer add/remove, the control only listens to layers added in configuration). -* Fixed `FeatureGroup` `getBounds` to work correctly when containing circle markers. -* Removed `Map` `tilelayersload` event. -* Removed `Popup` `open` and `close` events in favor of `add` and `remove` for consistency. -* Moved all layer-related logic in `Map.js` to `Layer.js`. -* Improved `FeatureGroup` `bindPopup` to accept a function for generating popup content, significantly improving memory footprint when adding popups to a huge number of layers (by [@patrickarlt](https://github.com/patrickarlt)). [#3109](https://github.com/Leaflet/Leaflet/pull/3109) [#3059](https://github.com/Leaflet/Leaflet/pull/3059) -* Added `ImageOverlay` interactivity (mouse events, etc.) (by [@snkashis](https://github.com/snkashis)). [#3009](https://github.com/Leaflet/Leaflet/pull/3009) [#1727](https://github.com/Leaflet/Leaflet/issues/1727) -* Added `ImageOverlay` `getBounds` (by [@brunob](https://github.com/brunob)). [#2848](https://github.com/Leaflet/Leaflet/pull/2848) -* Renamed `clickable` option to `interactive` (by [@AndriiHeonia](https://github.com/AndriiHeonia)). [#2838](https://github.com/Leaflet/Leaflet/pull/2838) [#2499](https://github.com/Leaflet/Leaflet/issues/2499) -* Changed the default z-index of panes to be bigger, leaving more room for customization (by [@patrickarlt](https://github.com/patrickarlt)). [#3591](https://github.com/Leaflet/Leaflet/pull/3591) -* Improved DOM event bubbling mechanism for layers (by [@yohanboniface](https://github.com/yohanboniface)). [Leaflet/Leaflet#3307](https://github.com/Leaflet/Leaflet/pull/3307) [#3450](https://github.com/Leaflet/Leaflet/pull/3450) [#3307](https://github.com/Leaflet/Leaflet/pull/3307) -* Added `nonBubblingEvents` option to layers (by [@yohanboniface](https://github.com/yohanboniface)). [#3605](https://github.com/Leaflet/Leaflet/pull/3605) [#3307](https://github.com/Leaflet/Leaflet/pull/3307) [#3604](https://github.com/Leaflet/Leaflet/issues/3604) - -In addition, layer events implementation was rewritten to use **event delegation**, significantly improving add/remove performance and memory footprint. [#3032](https://github.com/Leaflet/Leaflet/pull/3032) [#46](https://github.com/Leaflet/Leaflet/issues/46) - -### TileLayer & Projections API improvements - -TileLayer code and everything projections-related has undergone a major refactoring, documented in PR [#2247](https://github.com/Leaflet/Leaflet/pull/2247). It includes the following changes (in addition to much cleaner and simpler code): - -#### TileLayer API improvements - -These changes make implementing custom grid-like layers for Leaflet much easier. - -* Moved most of the `TileLayer` logic into the new `GridLayer` class (which `TileLayer` now inherits, extending it with logic specific to tile servers). -* Removed `TileLayer.Canvas` in favor of the much more flexible and powerful `GridLayer`. -* Improved tile wrapping and bounding logic in `TileLayer` to work transparently and completely depent on the CRS used; removed the need for `TileLayer` hacks when using custom projections. -* Added non-square tiles support (by [@IvanSanchez](https://github.com/IvanSanchez)). [#3573](https://github.com/Leaflet/Leaflet/pull/3573) [#3570](https://github.com/Leaflet/Leaflet/issues/3570) -* Removed `url` property in `tileload` and `tileloadstart` events (get it through `tile.src`). - -#### Projections API improvements - -These changes were targeted at removing any hardcoded projection-specific logic accross Leaflet classes, making it transparent and driven by the chosen CRS. They make using Leaflet with custom projections (including flat maps) much easier, and remove the need for ugly hacks in the [Proj4Leaflet](https://github.com/kartena/Proj4Leaflet) plugin. - -* Added `CRS.Earth` which serves as a base for all Earth-based CRS (`EPSG3857` etc.). [#2345](https://github.com/Leaflet/Leaflet/pull/2345) -* Added `Projection` `bounds` property that defines bounds for different projections (`Mercator`, etc.) in projected coordinates (by [@perliedman](https://github.com/perliedman)). -* Added `CRS` `wrapLat` and `wrapLng` properties which define whether the world wraps on a given axis and in what range. Set as `[-180, 180]` for `EPSG:3857`, `EPSG:4326`, `EPSG:3395` by default. -* Added `CRS` and `Map` `wrapLatLng` (the latter depends on the chosen CRS). -* Added `CRS` `infinite` property that disables boundaries (the world can go on infinitely in any direction), default for `CRS.Simple`. -* Added `CRS` `getProjectedBounds` and `Map` `getPixelWorldBounds` methods that returns world bounds in projected coordinates depending on zoom (derived from `Projection` `bounds`) (by [@perliedman](https://github.com/perliedman)). -* Added `CRS` `unproject` method that converts coordinates in CRS-dependent units into `LatLng` coordinates (by [@sowelie](https://github.com/sowelie)). -* Added `Map` `distance(latlng1, latlng2)` method that takes CRS into account and works with flat projections. [#2345](https://github.com/Leaflet/Leaflet/pull/2345) [#1442](https://github.com/Leaflet/Leaflet/issues/1442) -* Improved `Circle` to be approximated with an ellipse in Earth-based projections. [#2345](https://github.com/Leaflet/Leaflet/pull/2345) -* Fixed `EPSG:4326` to have correct tile pyramid (2x1 tiles at root). -* Fixed `Projection.SphericalMercator` to project to meter units (by [@calvinmetcalf](https://github.com/calvinmetcalf)). -* Fixed `Map` `worldCopyJump` option to work for other projections. -* Fixed `Circle` to work with flat projections. [#2345](https://github.com/Leaflet/Leaflet/pull/2345) [#1465](https://github.com/Leaflet/Leaflet/issues/1465) -* Fixed scale control precision in non-EPSG:3857 projections. [#2345](https://github.com/Leaflet/Leaflet/pull/2345) -* Fixed `ImageOverlay` not working properly in some non-standard projections. [#3011](https://github.com/Leaflet/Leaflet/issues/3011) - - -### Animations improvements and fractional zoom - -Animation code in Leaflet had undergone a major rewrite (main PR: [#2382](https://github.com/Leaflet/Leaflet/pull/2382)), bringing improvements such as: - -- Multi-level tile buffering for more seamless zooming experience with less flickering -- Optimal path animation (`map.flyTo`) for zooming to a particular place in a curve (simultaneously zooming and panning) -- Fractional zoom support — now you can do things like `map.setZoom(12.45)` and it just works. -- Layers now rely on `zoom` event in addition to `viewreset` for frame-by-frame zoom animations. [#3278](https://github.com/Leaflet/Leaflet/pull/3278) - -### UX improvements - -* Improved panning inertia behavior so that there are no tearing during animation when panning around quickly. [#2360](https://github.com/Leaflet/Leaflet/issues/2360) -* Improved inertial scrolling to have a nicer, more natural feel (by [@RickMohr](https://github.com/RickMohr)). [Leaflet/Leaflet#3063](https://github.com/Leaflet/Leaflet/pull/3063) [#3063](https://github.com/Leaflet/Leaflet/pull/3063) [#3062](https://github.com/Leaflet/Leaflet/issues/3062) [#2987](https://github.com/Leaflet/Leaflet/issues/2987) -* Added popup fade out animation. -* Improved keyboard support to ignore keystrokes with modifier keys (Ctrl, Alt, Meta) to not interfere with OS shortcuts. -* Made popup to close when pressing Escape (by [@snkashis](https://github.com/snkashis)). [#951](https://github.com/Leaflet/Leaflet/issues/951) [#3000](https://github.com/Leaflet/Leaflet/pull/3000) -* Improved keyboard zoom to zoom by 3 levels if shift key is pressed (by [@yohanboniface](https://github.com/yohanboniface)). [#3024](https://github.com/Leaflet/Leaflet/pull/3024) -* Improved layers control to become scrollable when there are too many layers (by [@rowanwins](https://github.com/rowanwins)). [#3571](https://github.com/Leaflet/Leaflet/pull/3571) [#3167](https://github.com/Leaflet/Leaflet/issues/3167) - -### Misc. performance improvements - -* Significantly [improved](http://jsperf.com/leaflet-parsefloat-in-latlng/2) `LatLng` creation performance (8x). -* Improved performance of layer objects construction. -* Significantly improved `FeatureGroup` (and correspondingly `GeoJSON`) layer adding and events performance (about 10x) by implementing a much better event propagation mechanism. [#2311](https://github.com/Leaflet/Leaflet/pull/2311) -* Improved Leaflet events and DOM events memory footprint. -* Improved `Evented` `off` performance by about 2 times. - -### Other breaking API changes - -* Changed `DomUtil` `off` to require `context` attribute if you remove a listener that was previously added with a particular context. -* Removed `DomUtil.getViewportOffset` method as it is no longer necessary. -* Removed `DomUtil` `getTranslateString` and `getScaleString` methods. -* Removed `DomUtil` `documentIsLtr` method. -* Removed `LatLng` `RAD_TO_DEG`, `DEG_TO_RAD` and `MAX_MARGIN` constants. -* Renamed `Util.limitExecByInterval` to `Util.throttle`. - -### Other API improvements - -* Added `Evented` class that now many Leaflet classes inherit from (instead of mixing in events methods in each class), while keeping the old `includes: L.Mixin.Events` syntax available. [#2310](https://github.com/Leaflet/Leaflet/pull/2310) -* Improved `Class` `options` to be prototypically inherited instead of copied over in children classes, which leads to more efficient memory use, faster object construction times and ability to change parent options that get propagated to all children automatically (by [@jfirebaugh](https://github.com/jfirebaugh)). [#2300](https://github.com/Leaflet/Leaflet/pull/2300) [#2294](https://github.com/Leaflet/Leaflet/issues/2294) -* Added `{r}` variable to `TileLayer` `url` for adding `"@2x"` prefix on Retina-enabled devices (by [@urbaniak](https://github.com/urbaniak)). [#2296](https://github.com/Leaflet/Leaflet/pull/2296) -* Added `Point` `ceil` method (by [@perliedman](https://github.com/perliedman)). -* Added `Util.wrapNum` method for wrapping a number to lie in a certain range. -* Improved `L.bind` to use native `Function` `bind` on modern browsers and prepend real arguments to bound ones. -* Added `LatLng` `equals` second argument `maxMargin`. -* Added `DomUtil` `setClass` and `getClass` methods. -* Improved `Marker` `move` event to include `oldLatlng` (by [@danzel](https://github.com/danzel)). [#2412](https://github.com/Leaflet/Leaflet/pull/2412) -* Added `Marker` `mousemove` event (by [@bullgare](https://github.com/bullgare)). [#2798](https://github.com/Leaflet/Leaflet/pull/2798) -* Improved `DomEvent` `on`/`off` to accept space-separated events and object literals (`{type: fn}`). -* Added `DomUtil` `toFront` and `toBack` methods. -* Added `Evented` `listens` as a shortcut to `hasEventListeners`. -* Added optional support for center-oriented scroll for `L.map` option `touchZoom` (by [@mtmail](https://github.com/mtmail)). [#2527](https://github.com/Leaflet/Leaflet/pull/2527) -* Added `getElement` method to all layers that returns an associated DOM element. -* Added `LatLng` `clone` method (by [@yohanboniface](https://github.com/yohanboniface)). [#3390](https://github.com/Leaflet/Leaflet/pull/3390) -* Added `Map` `setMinZoom` and `setMaxZoom` methods (by [@nathancahill](https://github.com/nathancahill)). [#3383](https://github.com/Leaflet/Leaflet/pull/3383) [#3380](https://github.com/Leaflet/Leaflet/issues/3380) -* Added `originalEvent` to `Map` and `Marker` `drag` and `move` event data (by [@yohanboniface](https://github.com/yohanboniface)). [#3264](https://github.com/Leaflet/Leaflet/pull/3264) -* Added `Popup` `autoClose` option (by [@jfirebaugh](https://github.com/jfirebaugh)). [#3018](https://github.com/Leaflet/Leaflet/pull/3018) [#2716](https://github.com/Leaflet/Leaflet/issues/2716) [#1853](https://github.com/Leaflet/Leaflet/issues/1853) -* Added `Control.Zoom` `enable` and `disable` methods. [#3172](https://github.com/Leaflet/Leaflet/issues/3172) -* Added an argument to `L.PolyUtil.clipPolygon` that controls rounding (by [@aparshin](https://github.com/aparshin)). [#2926](https://github.com/Leaflet/Leaflet/pull/2926) [#2917](https://github.com/Leaflet/Leaflet/issues/2917) -* Added `Map` `wheelDebounceTime` option (by [@AndriiHeonia](https://github.com/AndriiHeonia)). [#2836](https://github.com/Leaflet/Leaflet/pull/2836) [#2501](https://github.com/Leaflet/Leaflet/issues/2501) -* Added `TileLayer.WMS` `uppercase` option (now `false` by default) (by [@kdeloach](https://github.com/kdeloach)). [#2831](https://github.com/Leaflet/Leaflet/pull/2831) [#1751](https://github.com/Leaflet/Leaflet/issues/1751) -* Added `ImageOverlay` `alt` option (by [@francis-liberty](https://github.com/francis-liberty)). [#2767](https://github.com/Leaflet/Leaflet/pull/2767) [#2564](https://github.com/Leaflet/Leaflet/issues/2564) -* Improved `L.Util.extend` performance (by [@fab1an](https://github.com/fab1an)). [#2746](https://github.com/Leaflet/Leaflet/pull/2746) -* Added `Map` `stop` method for stopping panning or `flyTo` animation. -* Added `Map` `maxBoundsViscosity` option that controls how much the map resits dragging out of max bounds (set to `1` for a hard limit) (by [@IvanSanchez](https://github.com/IvanSanchez)). [#2224](https://github.com/Leaflet/Leaflet/pull/2224) [#3510](https://github.com/Leaflet/Leaflet/pull/3510) [#1673](https://github.com/Leaflet/Leaflet/issues/1673) -* Added `Bounds` and `LatLngBounds` `overlaps` method (by [@IvanSanchez](https://github.com/IvanSanchez)). [#2981](https://github.com/Leaflet/Leaflet/issues/2981) [#3508](https://github.com/Leaflet/Leaflet/pull/3508) -* Added `ImageOverlay` `crossOrigin` option (by [@patrickarlt](https://github.com/patrickarlt)). [#3594](https://github.com/Leaflet/Leaflet/pull/3594) [#2621](https://github.com/Leaflet/Leaflet/pull/2621) - -### Bugfixes - -* Fixed `DomUtil` `on` to make it possible to add the same listener to the same element for multiple contexts. -* Fixed a bug that thowed an error when attempting to reinitialize the map on unload (by [@gamb](https://github.com/gamb)). [#2410](https://github.com/Leaflet/Leaflet/pull/2410) -* Fixed excessively blurry non-retina tiles on retina iOS devices. -* Fixed a bug with popup close button in IE7/8. [#2351](https://github.com/Leaflet/Leaflet/issues/2351) -* Fixed `ImageOverlay` mercator distortion on lower zoom levels. -* Fixed a bug where layers didn't fire `popupopen` and `popupclose` events when manually creating a popup object and passing it to `bindPopup`. [#2354](https://github.com/Leaflet/Leaflet/issues/2354) -* Fixed box-zoom overlay appearing under markers. [#1813](https://github.com/Leaflet/Leaflet/issues/1813) -* Fixed `Map` `panInsideBounds` to accept array-form bounds (by [@RLRR](https://github.com/RLRR)). [#3489](https://github.com/Leaflet/Leaflet/pull/3489) -* Fixed marker draggable state to persist when removing and adding back to the map (by [@IvanSanchez](https://github.com/IvanSanchez)). [#3488](https://github.com/Leaflet/Leaflet/pull/3488) -* Fixed inertia not working when parallel to axis (by [@rikvanmechelen](https://github.com/rikvanmechelen)). [#3432](https://github.com/Leaflet/Leaflet/issues/3432) -* Fixed images and SVG inside popups having max-width property overriden (by [@yohanboniface](https://github.com/yohanboniface)). [#3452](https://github.com/Leaflet/Leaflet/pull/3452) -* Fixed cursors when dragging is disabled (by [@juliensoret](https://github.com/juliensoret)). [#3219](https://github.com/Leaflet/Leaflet/issues/3219) [#3233](https://github.com/Leaflet/Leaflet/pull/3233) -* Fixed `LatLng` `wrap` to not drop altitude (by [@IvanSanchez](https://github.com/IvanSanchez)). [#3420](https://github.com/Leaflet/Leaflet/issues/3420) -* Fixed Firefox for Android not being detected as mobile (by [@IvanSanchez](https://github.com/IvanSanchez)). [#3419](https://github.com/Leaflet/Leaflet/pull/3419) -* Fixed an infinite loop when calling `setMaxBounds` several times in a row (by [@IvanSanchez](https://github.com/IvanSanchez)). [#3410](https://github.com/Leaflet/Leaflet/pull/3410) [#3320](https://github.com/Leaflet/Leaflet/issues/3320) -* Fixed a WTF `Map` `locate` bug that could cause some unexpected effects (by [@sindre](https://github.com/sindre)). [Leaflet/Leaflet#3404](https://github.com/Leaflet/Leaflet/issues/3404) -* Fixed broken zoom in Project Spartan browsers (by [@mitchless](https://github.com/mitchless)). [#3379](https://github.com/Leaflet/Leaflet/pull/3379) -* Fixed broken `Polygon` `getCenter` when all points in the same pixel (by [@yohanboniface](https://github.com/yohanboniface)). [#3372](https://github.com/Leaflet/Leaflet/pull/3372) -* Fixed broken `Polyline` `getCenter` when the line is very small (by [@yohanboniface](https://github.com/yohanboniface)). [#3371](https://github.com/Leaflet/Leaflet/pull/3371) -* Fixed keyboard zoom out not working on `azerty` keyboards. [#3362](https://github.com/Leaflet/Leaflet/issues/3362) -* Fixed a bug where tabbing to an offscreen marker broke control positioning (by [@IvanSanchez](https://github.com/IvanSanchez)). [#3340](https://github.com/Leaflet/Leaflet/pull/3340) [#3333](https://github.com/Leaflet/Leaflet/issues/3333) -* Fixed `Map` `panBy` not always returning `this` (by [@Trufi](https://github.com/Trufi)). [#3303](https://github.com/Leaflet/Leaflet/pull/3303) -* Fixed a bug where pushing a zoom control with a keyboard would switch focus to the map (by [@Jakobud](https://github.com/Jakobud)). [#3275](https://github.com/Leaflet/Leaflet/pull/3275) [#3159](https://github.com/Leaflet/Leaflet/issues/3159) -* Fixed more race conditions leading to map freeze. [#3270](https://github.com/Leaflet/Leaflet/pull/3270) [#3268](https://github.com/Leaflet/Leaflet/issues/3268) [#2693](https://github.com/Leaflet/Leaflet/issues/2693) [#2478](https://github.com/Leaflet/Leaflet/issues/2478) -* Fixed iOS race condition when doing a very small pan. [#2519](https://github.com/Leaflet/Leaflet/issues/2519) -* Fixed `Polygon` `toGeoJSON` exporting a `MultiPolygon` in some cases (by [@yohanboniface](https://github.com/yohanboniface)). [#2977](https://github.com/Leaflet/Leaflet/pull/2977) -* Fixed `TileLayer.WMS` passing all options as WMS params. [#2972](https://github.com/Leaflet/Leaflet/issues/2972) -* Fixed a race condition that made `map.fitBounds(map.getBounds())` zoom out sometimes. [#2957](https://github.com/Leaflet/Leaflet/issues/2957) -* Fixed a bug where a draggable marker stopped being draggable after `setIcon` (by [@jeffsmale90](https://github.com/jeffsmale90)). [#2578](https://github.com/Leaflet/Leaflet/issues/2578) -* Fixed some IE11 touch performance and stability issues (by [@danzel](https://github.com/danzel)). [#3007](https://github.com/Leaflet/Leaflet/pull/3007) [#2820](https://github.com/Leaflet/Leaflet/issues/2820) -* Fixed a race condition with `TileLayer` when `maxNativeZoom = 0`. [#3004](https://github.com/Leaflet/Leaflet/issues/3004) -* Fixed `FeatureGroup` `setStyle` not affecting `ImageOverlay` `opacity` (by [@opie](https://github.com/opie)). [#3008](https://github.com/Leaflet/Leaflet/pull/3008) [#2246](https://github.com/Leaflet/Leaflet/issues/2246) -* Fixed class init hooks not being called for parent classes (by [@jfirebaugh](https://github.com/jfirebaugh)). [#2545](https://github.com/Leaflet/Leaflet/issues/2545) -* Fixed a bug when adding a control that's already added or removing a control that's not present (by [@jfirebaugh](https://github.com/jfirebaugh)). [#3020](https://github.com/Leaflet/Leaflet/issues/3020) [#2877](https://github.com/Leaflet/Leaflet/issues/2877) -* Fixed buggy inertia on low zoom levels when `Map` `worldCopyJump` option is enabled (by [@flemenach](https://github.com/flemenach)). [#3038](https://github.com/Leaflet/Leaflet/pull/3038) [#2624](https://github.com/Leaflet/Leaflet/issues/2624) -* Fixed a bug where `getMaxZoom` sometimes returned wrong result inside a `Control.Layers` `baselayerchange` event (by [@CloudNiner](https://github.com/CloudNiner)). [#3048](https://github.com/Leaflet/Leaflet/pull/3048) [#2318](https://github.com/Leaflet/Leaflet/issues/2318) -* Fixed a bug where during zooming one map, dragging was disabled on all other maps on the page (by [@kdeloach](https://github.com/kdeloach)). [#3050](https://github.com/Leaflet/Leaflet/pull/3050) [#2539](https://github.com/Leaflet/Leaflet/issues/2539) -* Fixed a `Map` `getSize` race condition where it could return a wrong result (by [@kshepard](https://github.com/kshepard)). [#3052](https://github.com/Leaflet/Leaflet/pull/3052) [#3031](https://github.com/Leaflet/Leaflet/issues/3031) -* Fixed `L.latLng` factory to accept `altitude` as a third argument too (by [@lonelyelk](https://github.com/lonelyelk)). [#3070](https://github.com/Leaflet/Leaflet/pull/3070). -* Fixed `L.latLng` factory to not throw error on empty array input (by [@lonelyelk](https://github.com/lonelyelk)). [#3080](https://github.com/Leaflet/Leaflet/pull/3080) [#3079](https://github.com/Leaflet/Leaflet/issues/3079) -* Fixed popups to have a default color (by [@snkashis](https://github.com/snkashis)). [#3115](https://github.com/Leaflet/Leaflet/pull/3115) [#3112](https://github.com/Leaflet/Leaflet/issues/3112) [#333](https://github.com/Leaflet/Leaflet/issues/333) -* Fixed `Map` `locate` not to mutate the given options object (by [@tmcw](https://github.com/tmcw)). [#3173](https://github.com/Leaflet/Leaflet/pull/3173) -* Fixed Canvas polylines not to render if stroke is set to 0 (by [@optical](https://github.com/optical)). [#3203](https://github.com/Leaflet/Leaflet/pull/3203) -* Prevented a Joomla bug that could lead to vector layers disappearing (by [@SniperSister](https://github.com/SniperSister)). [#2886](https://github.com/Leaflet/Leaflet/pull/2886) [#2881](https://github.com/Leaflet/Leaflet/issues/2881) [Leaflet/Leaflet#2881](https://github.com/Leaflet/Leaflet/issues/2881) -* Fixed IE Metro touch events passing through objects on top of a Leaflet map (by [@nikgavalas](https://github.com/nikgavalas)). [#2954](https://github.com/Leaflet/Leaflet/pull/2954) -* Fixed a bug where vector layers wouldn't display on websites with SVG max-width set to 100% (by [@SniperSister](https://github.com/SniperSister)). [#2886](https://github.com/Leaflet/Leaflet/pull/2886) [#2881](https://github.com/Leaflet/Leaflet/issues/2881) -* Fixed `Marker` `setIcon` to not reset popup anchor offset (by [@bullgare](https://github.com/bullgare)). [#2872](https://github.com/Leaflet/Leaflet/pull/2872) -* Fixed a case where you provide `zoom` in `Map` options and then set center (by [@AndriiHeonia](https://github.com/AndriiHeonia)). [#2849](https://github.com/Leaflet/Leaflet/pull/2849) [#1871](https://github.com/Leaflet/Leaflet/issues/1871) -* Fixed a race condition with `TileLayer` `setUrl` where `loading` event didn't fire properly (by [@bennlich](https://github.com/bennlich)). [#2802](https://github.com/Leaflet/Leaflet/pull/2802) [#2675](https://github.com/Leaflet/Leaflet/issues/2675) [#2827](https://github.com/Leaflet/Leaflet/pull/2827) -* Fixed a bug where a tile layer was not cleaned up properly after zooming past its max zoom (by [@francis-liberty](https://github.com/francis-liberty)). [#2764](https://github.com/Leaflet/Leaflet/pull/2764) [#1905](https://github.com/Leaflet/Leaflet/issues/1905) -* Fixed a memory leak with `Marker` `setIcon` (by [@jfgodoy](https://github.com/jfgodoy)). [#2811](https://github.com/Leaflet/Leaflet/pull/2811) -* Fixed `LatLng` `distanceTo` to not return `NaN` on equal locations. [#2705](https://github.com/Leaflet/Leaflet/issues/2705) -* Fixed a bug where `TileLayer` `maxNativeZoom` didn't work properly with `bounds` option set (by [@mlegenhausen](https://github.com/mlegenhausen)). [#2725](https://github.com/Leaflet/Leaflet/pull/2725) [#2704](https://github.com/Leaflet/Leaflet/issues/2704) -* Fixed a bug where tiles touching the edge of the bounds from outside where loaded (by [@IvanSanchez](https://github.com/IvanSanchez)). [#2981](https://github.com/Leaflet/Leaflet/issues/2981) [#3508](https://github.com/Leaflet/Leaflet/pull/3508) -* Fixed a memory leak in `map.remove()` (by [@IvanSanchez](https://github.com/IvanSanchez)). [#3514](https://github.com/Leaflet/Leaflet/pull/3514) [#2718](https://github.com/Leaflet/Leaflet/issues/2718) -* Fixed a bug where layers control collapsed when hovering over a disabled radio button (by [@rowanwins](https://github.com/rowanwins)). [#3564](https://github.com/Leaflet/Leaflet/pull/3564) [#2771](https://github.com/Leaflet/Leaflet/issues/2771) [Leaflet#2771](https://github.com/Leaflet/Leaflet/issues/2771) -* Fixed GeoJSON not accepting null geometry (by [@pglotov](https://github.com/pglotov)). [#3585](https://github.com/Leaflet/Leaflet/pull/3585) -* Fixed occasional popup 1px horizontal offset (by [@patrickarlt](https://github.com/patrickarlt)). [#3587](https://github.com/Leaflet/Leaflet/pull/3587) [#3526](https://github.com/Leaflet/Leaflet/pull/3526) [#3586](https://github.com/Leaflet/Leaflet/issues/3586) [#3525](https://github.com/Leaflet/Leaflet/issues/3525) -* Fixed some inconsistencies in mouse events for Canvas vector layers (by [@wpf500](https://github.com/wpf500)). [#3590](https://github.com/Leaflet/Leaflet/pull/3590) [#3568](https://github.com/Leaflet/Leaflet/issues/3568) [#3618](https://github.com/Leaflet/Leaflet/pull/3618) -* Fixed scale control for non-earth CRS (by [@cmulders](https://github.com/cmulders)). [#3614](https://github.com/Leaflet/Leaflet/pull/3614) - -### Misc improvements - -* Improved the build system (`jake build`) to report gzipped library size. -* Added version name and commit number to Leaflet builds. [#2276](https://github.com/Leaflet/Leaflet/issues/2276) -* Added Leaflet logo in vector format as `src/images/logo.svg`. -* Added reference to Leaflet CSS in `package.json` (by [@bclinkinbeard](https://github.com/bclinkinbeard)). [#2432](https://github.com/Leaflet/Leaflet/pull/2432) -* Switched from JSHint to ESLint for checking code style and made the checks more strict. [#3176](https://github.com/Leaflet/Leaflet/pull/3176) -* Added a plugin guide section on module loaders and publishing plugins (by [@patrickarlt](https://github.com/patrickarlt)). [#2955](https://github.com/Leaflet/Leaflet/pull/2955) [Leaflet/Leaflet#2955](https://github.com/Leaflet/Leaflet/pull/2955) -* Fixed the build system to work in non-git Leaflet folder (by [@cschwarz](https://github.com/cschwarz)). [#2758](https://github.com/Leaflet/Leaflet/pull/2758) - - -## 0.7.7 (2015-10-26) - -* Fixed a regression that could sometimes cause tiles to disappear when pinch-zooming on iOS devices. -* Fixed a regression related to msPointer detection in IE10 (affecting Leaflet.draw and some other plugins) (by @danzel) #3842 #3839 #3804 -* Fixed a bug where a mouseout could fire after a vector element was removed (by @sambernet). #3849 #3829 -* Fixed touch interactions in Edge browser (by @mitchless & @Neorth). #3853 #3379 -* Fixed a bug where removing a layer group from a feature group would throw an error (by @Lambdac0re). #3869 - -Note tha we skipped 0.7.6 version for which we accidentally published a broken build to NPM. - - -## 0.7.5 (2015-09-02) - -* Fixed a regression that broke animation in Leaflet.markercluster. [#3796](https://github.com/Leaflet/Leaflet/issues/3796) - - -## 0.7.4 (2015-09-01) - -* Fixed a bug introduced by a recent Chrome update that caused the map not to react to interactions until all tiles are loaded. [#3689](https://github.com/Leaflet/Leaflet/issues/3689) -* Fixed a bug where tile layers were not respecting their `minZoom` or `maxZoom` options (by [@ivansanchez](https://github.com/ivansanchez)) [#3778](https://github.com/Leaflet/Leaflet/pull/3778) -* Improved detection of touch-capable web browsers, in particular fixing touch interactions in device emulation mode in Chrome and Firefox (by [@ivansanchez](https://github.com/ivansanchez)) [#3520](https://github.com/Leaflet/Leaflet/pull/3520) [#3710](https://github.com/Leaflet/Leaflet/pull/3710) -* Fixed a bug where tile layers with `maxNativeZoom` were not checking bounds properly (by [@jlaxon](https://github.com/jlaxon)) [#3415](https://github.com/Leaflet/Leaflet/pull/3152) -* Fixed a bug where popups were not remembering which layer originated them after calling `bindPopup(popup)` (by [@Eschon](https://github.com/Eschon)) [#3675](https://github.com/Leaflet/Leaflet/pull/3675) -* Fixed a race condition between markers and zoom animation (by [@perliedman](https://github.com/perliedman)) [#3152](https://github.com/Leaflet/Leaflet/pull/3152) -* Fixed a bug with `Map.fitBounds` padding (by [@bsstoner](https://github.com/bsstoner)). [#2489](https://github.com/Leaflet/Leaflet/issues/2489) -* Allow canvas paths to fire `dblclick` and `contextmenu` events (by [@ivansanchez](https://github.com/ivansanchez)) [#3482](https://github.com/Leaflet/Leaflet/pull/3482) -* Allow canvas filled polygons to use the `fillRule` option (by [@w8r](https://github.com/w8r)) [#3477](https://github.com/Leaflet/Leaflet/pull/3477) -* Allow canvas lines to use `lineCap` and `lineJoin` options (by [@northerneyes](https://github.com/northerneyes)) [#3156](https://github.com/Leaflet/Leaflet/pull/3156) -* Updated bower definitions to comply with best practices (by [@guptaso2](https://github.com/guptaso2)) [#2726](https://github.com/Leaflet/Leaflet/pull/2726) [#3448](https://github.com/Leaflet/Leaflet/pull/3448) - - -## 0.7.3 (2014-05-23) - -* Added proper **bower** and **component** support (by [@calvinmetcalf](https://github.com/calvinmetcalf)). [#2561](https://github.com/Leaflet/Leaflet/pull/2561) [#1903](https://github.com/Leaflet/Leaflet/issues/1903) -* Fixed a bug where dragging the map outside the window caused an error on FF. [#2610](https://github.com/Leaflet/Leaflet/issues/2610) -* Fixed a bug where some taps on Android where not working, often falsely perceived as drags (by [@axefrog](https://github.com/axefrog)). [#2503](https://github.com/Leaflet/Leaflet/pull/2503) -* Fixed a bug where clicks on Android were skipped when happened too fast. [#2303](https://github.com/Leaflet/Leaflet/issues/2303) -* Fixed a bug where calling `setView` (or similar methods) several times in succession could freeze the map. [#2521](https://github.com/Leaflet/Leaflet/issues/2521) [#2236](https://github.com/Leaflet/Leaflet/issues/2236) [#2485](https://github.com/Leaflet/Leaflet/issues/2485) -* Fixed a bug where `Control.Layers` wasn't properly removed (by [@jack-kerouac](https://github.com/jack-kerouac)). [#2569](https://github.com/Leaflet/Leaflet/pull/2569) -* Fixed a bug that caused `TileLayer` `load` event not to fire properly. [#2510](https://github.com/Leaflet/Leaflet/issues/2510) -* Fixed Canvas-based paths not triggering `remove` event when removed (by @adimitrov). [#2486](https://github.com/Leaflet/Leaflet/pull/2486) -* Fixed a bug where you could end up with fractional zoom after pinch-zooming in some cases (by [@danzel](https://github.com/danzel). [#2400](https://github.com/Leaflet/Leaflet/pull/2400) [#1943](https://github.com/Leaflet/Leaflet/issues/1934) - - -## 0.7.2 (2014-01-17) - -* Fixed a bug that appeared with **Chrome 32 update** that made all **mouse events shifted on scrolled pages**. [#2352](https://github.com/Leaflet/Leaflet/issues/2352) -* Fixed a bug that could break tile loading when using non-standard tile sizes. [#2288](https://github.com/Leaflet/Leaflet/issues/2288) -* Fixed a bug where `maxNativeZoom` option didn't work with TMS tile layers (by [@perliedman](https://github.com/perliedman)). [#2321](https://github.com/Leaflet/Leaflet/issues/2321) [#2314](https://github.com/Leaflet/Leaflet/issues/2314) - - -## 0.7.1 (2013-12-06) - -* Fixed a bug where pinch-zooming quickly could occasionally leave the map at a fractional zoom thus breaking tile loading (by [@danzel](https://github.com/danzel)). [#2269](https://github.com/Leaflet/Leaflet/pull/2269) [#2255](https://github.com/Leaflet/Leaflet/issues/2255) [#1934](https://github.com/Leaflet/Leaflet/issues/1934) -* Fixed tile flickering issues on some old Android 2/3 devices by disabling buggy hardware accelerated CSS there (by [@danzel](https://github.com/danzel)). [#2216](https://github.com/Leaflet/Leaflet/pull/2216) [#2198](https://github.com/Leaflet/Leaflet/issues/2198) -* Fixed a regression that sometimes led to an error when you started pinch-zoom as the first action on the map (by [@danzel](https://github.com/danzel)). [#2259](https://github.com/Leaflet/Leaflet/pull/2259) [#2256](https://github.com/Leaflet/Leaflet/issues/2256) -* Reverted `L.Util.template` optimizations to allow Leaflet to be used in eval-banning environments like browser extensions (performance gain was insignificant anyway) (by [@calvinmetcalf](https://github.com/calvinmetcalf)). [#2217](https://github.com/Leaflet/Leaflet/issues/2217) [#2209](https://github.com/Leaflet/Leaflet/issues/2209) [#1968](https://github.com/Leaflet/Leaflet/issues/1968) -* Fixed a regression where `Map` `invalidateSize` could lead to unexpected results when called before map initialization (by [@Zverik](https://github.com/Zverik)). [#2250](https://github.com/Leaflet/Leaflet/issues/2250) [#2249](https://github.com/Leaflet/Leaflet/issues/2249) -* Fixed a regression where `FeatureGroup` containing other group overwrote original `e.layer` value in mouse events (by [@gumballhead](https://github.com/gumballhead)). [#2253](https://github.com/Leaflet/Leaflet/pull/2253) [#2252](https://github.com/Leaflet/Leaflet/issues/2252) -* Fixed a regression where `CircleMarker` `setLatLngs` didn't return `this` (by [@radicalbiscuit](https://github.com/radicalbiscuit)). [#2206](https://github.com/Leaflet/Leaflet/pull/2206) - -## 0.7 (2013-11-18) - -### Improvements - -#### Usability improvements - -* Added **support for IE11 touch devices** (by [@danzel](https://github.com/danzel), [@DanielX2](https://github.com/DanielX2) and [@fnicollet](https://github.com/fnicollet)). [#2039](https://github.com/Leaflet/Leaflet/pull/2039) [#2066](https://github.com/Leaflet/Leaflet/pull/2066) [#2037](https://github.com/Leaflet/Leaflet/issues/2037) [#2102](https://github.com/Leaflet/Leaflet/issues/2102) -* Added shift-double-click to zoom out shortcut. [#2185](https://github.com/Leaflet/Leaflet/issues/2185) -* Significantly improved **controls design on mobile** devices. [#1868](https://github.com/Leaflet/Leaflet/issues/1868) [#2012](https://github.com/Leaflet/Leaflet/issues/2012) -* Fixed and improved IE7-8 control and popup styles. -* Made subtle improvements to control styles on desktop browsers. -* Improved keyboard nav support so that map doesn't loose focus when you click on a control (by [@jacobtoye](https://github.com/jacobtoye)). [#2150](https://github.com/Leaflet/Leaflet/issues/2150) [#2148](https://github.com/Leaflet/Leaflet/issues/2148) -* Improved `maxBounds` behavior: now it doesn't force higher minimal zoom, and anchors to max bounds edges properly when zooming (by [@kapouer](https://github.com/kapouer) and [@mourner](https://github.com/mourner)). [#2187](https://github.com/Leaflet/Leaflet/pull/2187) [#1946](https://github.com/Leaflet/Leaflet/pull/1946) [#2081](https://github.com/Leaflet/Leaflet/issues/2081) [#2168](https://github.com/Leaflet/Leaflet/issues/2168) [#1908](https://github.com/Leaflet/Leaflet/issues/1908) - -#### Map API improvements - -* Made `Map` `setView` `zoom` argument optional. [#2056](https://github.com/Leaflet/Leaflet/issues/2056) -* Added `maxZoom` option to `Map` `fitBounds`. [#2101](https://github.com/Leaflet/Leaflet/issues/2101) -* Added `Map` `bounceAtZoomLimits` option that makes the map bounce when you pinch-zoom past limits (it worked like this before, but now you can disable this) (by [@trevorpowell](https://github.com/trevorpowell)). [#1864](https://github.com/Leaflet/Leaflet/issues/1864) [#2072](https://github.com/Leaflet/Leaflet/pull/2072) -* Added `distance` property to `Map` and `Marker` `dragend` events. [#2158](https://github.com/Leaflet/Leaflet/issues/2158) [#872](https://github.com/Leaflet/Leaflet/issues/872) -* Added optional support for center-oriented scroll and double-click zoom (by [@jfirebaugh](https://github.com/jfirebaugh)). [#1939](https://github.com/Leaflet/Leaflet/issues/1939) -* Added `timestamp` to `Map` `locationfound` event. [#584](https://github.com/Leaflet/Leaflet/pull/584) -* Improved `Map` `invalidateSize` to call `moveend` immediately unless given `debounceMoveend: true` option (by [@jfirebaugh](https://github.com/jfirebaugh)). [#2181](https://github.com/Leaflet/Leaflet/issues/2181) - -#### TileLayer API improvements - -* Added `TileLayer` `maxNativeZoom` option that allows displaying tile layers on zoom levels above their maximum by **upscaling tiles**. [#1802](https://github.com/Leaflet/Leaflet/issues/1802) [#1798](https://github.com/Leaflet/Leaflet/issues/1798) -* Added `TileLayer` `tileloadstart` event (by [@tmcw](https://github.com/tmcw)). [#2142](https://github.com/Leaflet/Leaflet/pull/2142) [#2140](https://github.com/Leaflet/Leaflet/issues/2140) -* Improved `TileLayer` world size (used for wrapping and limiting tiles) to be derived from CRS instead of hardcoded, making it easier to use with custom projections (by [@perliedman](https://github.com/perliedman)). [#2160](https://github.com/Leaflet/Leaflet/pull/2160) - -#### Marker API improvements - -* Added CSS classes to draggable markers for easier customization (by [@snkashis](https://github.com/snkashis)). [#1902](https://github.com/Leaflet/Leaflet/issues/1902) [#1916](https://github.com/Leaflet/Leaflet/issues/1916) -* Added `Marker` `add` event (by [@tohaocean](https://github.com/tohaocean)). [#1942](https://github.com/Leaflet/Leaflet/issues/1942) -* Added `Marker` `getPopup` method (by [@scottharvey](https://github.com/scottharvey)). [#618](https://github.com/Leaflet/Leaflet/issues/618) [#1197](https://github.com/Leaflet/Leaflet/pull/1197) -* Added `Marker` `alt` option for adding `alt` text to markers (by [@jimmytidey](https://github.com/jimmytidey)). [#2112](https://github.com/Leaflet/Leaflet/pull/2112) - -#### Vector layers API improvements - -* Added `Path` `className` option for adding custom class names to vector layers. -* Added `Path` `lineCap` and `lineJoin` options (by [@palewire](https://github.com/palewire)). [#1843](https://github.com/Leaflet/Leaflet/issues/1843) [#1863](https://github.com/Leaflet/Leaflet/issues/1863) [#1881](https://github.com/Leaflet/Leaflet/issues/1881) -* Added ability to pass vector options to `GeoJSON` (by [@kapouer](https://github.com/kapouer)). [#2075](https://github.com/Leaflet/Leaflet/pull/2075) -* Improved `Polygon` `setLatLngs` to also accept holes (by [@aparshin](https://github.com/aparshin)). [#2095](https://github.com/Leaflet/Leaflet/pull/2095) [#1518](https://github.com/Leaflet/Leaflet/issues/1518) -* Added `GeoJSON` 3D format support and optional `altitude` argument to `LatLng` constructor (by [@Starefossen](https://github.com/Starefossen)). [#1822](https://github.com/Leaflet/Leaflet/pull/1822) -* Added `MultiPolygon` and `MultiPolyline` `openPopup` method. [#2046](https://github.com/Leaflet/Leaflet/issues/2046) - -#### Popup API improvements - -* Added `Popup` `update` method. [#1959](https://github.com/Leaflet/Leaflet/issues/1959) -* Added `Popup` `autoPanPaddingTopLeft` and `autoPanPaddingBottomRight` options (by [@albburtsev](https://github.com/albburtsev)). [#1972](https://github.com/Leaflet/Leaflet/issues/1972) [#1588](https://github.com/Leaflet/Leaflet/issues/1588) -* Added `Popup` `getContent` method. [#2100](https://github.com/Leaflet/Leaflet/issues/2100) -* Added `Popup` `getLatLng` method (by [@AndreyGeonya](https://github.com/AndreyGeonya)). [#2097](https://github.com/Leaflet/Leaflet/pull/2097) - -#### Misc API improvements - -* Added `ImageOverlay` `setUrl` and `getAttribution` methods and `attribution` option (by [@stsydow](https://github.com/stsydow)). [#1957](https://github.com/Leaflet/Leaflet/issues/1957) [#1958](https://github.com/Leaflet/Leaflet/issues/1958) -* Added localization support for the zoom control (by [@Danielku15](https://github.com/Danielku15)). [#1953](https://github.com/Leaflet/Leaflet/issues/1953) [#1643](https://github.com/Leaflet/Leaflet/issues/1643) [#1953](https://github.com/Leaflet/Leaflet/pull/1953) -* Significantly improved `L.Util.template` performance (affects `L.TileLayer`) by introducing cached template compilation (by [@calvinmetcalf](https://github.com/calvinmetcalf)). [#1969](https://github.com/Leaflet/Leaflet/issues/1969) [#1968](https://github.com/Leaflet/Leaflet/issues/1968) [#1554](https://github.com/Leaflet/Leaflet/issues/1554) -* Added `CRS` `getSize` for getting the world size in pixels (by [@perliedman](https://github.com/perliedman)). [#2160](https://github.com/Leaflet/Leaflet/pull/2160) -* Added `leaflet-drag-target` CSS class to an element under cursor when dragging for more flexible customization. [#2164](https://github.com/Leaflet/Leaflet/issues/2164) [#1902](https://github.com/Leaflet/Leaflet/issues/1902) -* Improved `L.DomUtil` `addClass`, `removeClass`, `hasClass` methods performance and fixed it to work with SVG elements. [#2164](https://github.com/Leaflet/Leaflet/issues/2164) - -#### Dev workflow improvements - -* Added an [official FAQ](https://github.com/Leaflet/Leaflet/blob/master/FAQ.md). -* Cleaned up and moved old IE styles to `leaflet.css` and removed `leaflet.ie.css`, so **no need for IE conditional comment** when including Leaflet now. [#2159](https://github.com/Leaflet/Leaflet/issues/2159) -* Added `leaflet-oldie` CSS class to map container in IE7-8 for easier styling. [#2159](https://github.com/Leaflet/Leaflet/issues/2159) -* Officially **dropped support for IE6**. Nobody cares anyway, and Leaflet should still be accessible on it. [#2159](https://github.com/Leaflet/Leaflet/issues/2159) -* Improved the build system to check JS errors in spec files. [#2151](https://github.com/Leaflet/Leaflet/issues/2151) -* Fixed `jake` command to run tests before building the source. [#2151](https://github.com/Leaflet/Leaflet/issues/2151) -* Switched the main file in `package.json` to unminified version for NPM/Browserify (by [@icetan](https://github.com/icetan)). [#2109](https://github.com/Leaflet/Leaflet/pull/2109) - -### Bugfixes - -#### 0.6 regression fixes - -* Fixed a **memory leak in iOS7** that could crash Safari when handling lots of objects (e.g. 1000 markers) (by [@danzel](https://github.com/danzel)). [#2149](https://github.com/Leaflet/Leaflet/pull/2149) [#2122](https://github.com/Leaflet/Leaflet/issues/2122) -* Fixed a bug that caused lag at the beginning of panning in Chrome (by [@jfirebaugh](https://github.com/jfirebaugh)). [#2163](https://github.com/Leaflet/Leaflet/issues/2163) -* Fixed a regression that made the layers control unscrollable in Firefox. [#2029](https://github.com/Leaflet/Leaflet/issues/2029) -* Fixed a regression that broke `worldCopyJump: true` option (by [@fastrde](https://github.com/fastrde)). [#1904](https://github.com/Leaflet/Leaflet/issues/1904) [#1831](https://github.com/Leaflet/Leaflet/issues/1831) [#1982](https://github.com/Leaflet/Leaflet/issues/1982) -* Fixed a regression where a first map click after popup close button click was ignored (by [@fastrde](https://github.com/fastrde)). [#1537](https://github.com/Leaflet/Leaflet/issues/1537) [#1963](https://github.com/Leaflet/Leaflet/issues/1963) [#1925](https://github.com/Leaflet/Leaflet/issues/1925) -* Fixed a regression where `L.DomUtil.getMousePosition` would throw an error if container argument not provided (by [@scooterw](https://github.com/scooterw)). [#1826](https://github.com/Leaflet/Leaflet/issues/1826) [#1928](https://github.com/Leaflet/Leaflet/issues/1928) [#1926](https://github.com/Leaflet/Leaflet/issues/1926) -* Fixed a regression with vector layers positioning when zooming on IE10+ touch devices (by [@danzel](https://github.com/danzel)). [#2002](https://github.com/Leaflet/Leaflet/issues/2002) [#2000](https://github.com/Leaflet/Leaflet/issues/2000) -* Fixed a regression with `maxBounds` behaving weirdly on panning inertia out of bounds. [#2168](https://github.com/Leaflet/Leaflet/issues/2168) - -#### General bugfixes - -* Fixed a bug where the map could freeze if centered and immediately recentered on initialization. [#2071](https://github.com/Leaflet/Leaflet/issues/2071) -* Fixed a bug where all maps except the first one on a page didn't track window resize. [#1980](https://github.com/Leaflet/Leaflet/issues/1980) -* Fixed a bug where tiles in `EPSG:3395` projection were shifted (by [@aparshin](https://github.com/aparshin)). [#2020](https://github.com/Leaflet/Leaflet/issues/2020) -* Fixed a bug where scale control displayed wrong scale when on pages with `box-sizing: border-box`. -* Fixed a bug where zoom control button didn't appear as disabled if map was initialized at the zoom limit. [#2083](https://github.com/Leaflet/Leaflet/issues/2083) -* Fixed a bug where box zoom also triggered a map click event (by [@fastrde](https://github.com/fastrde)). [#1951](https://github.com/Leaflet/Leaflet/issues/1951) [#1884](https://github.com/Leaflet/Leaflet/issues/1884) -* Fixed a bug where shift-clicking on a map immediately after a drag didn't trigger a click event (by [@fastrde](https://github.com/fastrde)). [#1952](https://github.com/Leaflet/Leaflet/issues/1952) [#1950](https://github.com/Leaflet/Leaflet/issues/1950) -* Fixed a bug where content was updated twice when opening a popup. [#2137](https://github.com/Leaflet/Leaflet/issues/2137) -* Fixed a bug that could sometimes cause infinite panning loop when using `maxBounds` (by [@kapouer](https://github.com/kapouer) and [@mourner](https://github.com/mourner)). [#2187](https://github.com/Leaflet/Leaflet/pull/2187) [#1946](https://github.com/Leaflet/Leaflet/pull/1946) [#2081](https://github.com/Leaflet/Leaflet/issues/2081) [#2168](https://github.com/Leaflet/Leaflet/issues/2168) [#1908](https://github.com/Leaflet/Leaflet/issues/1908) - -#### Browser bugfixes - -* Fixed a bug where keyboard `+` no longer zoomed the map on FF 22+ (by [@fastrde](https://github.com/fastrde)). [#1943](https://github.com/Leaflet/Leaflet/issues/1943) [#1981](https://github.com/Leaflet/Leaflet/issues/1981) -* Fixed a bug where calling `Map` `remove` throwed an error in IE6-8. [#2015](https://github.com/Leaflet/Leaflet/issues/2015) -* Fixed a bug where `isArray` didn't work in rare cases in IE9. [#2077](https://github.com/Leaflet/Leaflet/issues/2077) -* Fixed a bug where FF sometimes produced console warnings when animating markers. [#2090](https://github.com/Leaflet/Leaflet/issues/2090) -* Fixed a bug where mouse wasn't handled correctly on RTL pages in some cases (by [@danzel](https://github.com/danzel)). [#1986](https://github.com/Leaflet/Leaflet/issues/1986) [#2136](https://github.com/Leaflet/Leaflet/pull/2136) - -#### Mobile bugfixes - -* Fixed a bug where tiles could **disappear after zooming on Chrome 30+ for Android** (by [@danzel](https://github.com/danzel)). [#2152](https://github.com/Leaflet/Leaflet/pull/2152) [#2078](https://github.com/Leaflet/Leaflet/issues/2078) -* Fixed a bug on IE10+ touch where pinch-zoom also caused click (by [@danzel](https://github.com/danzel)). [#2117](https://github.com/Leaflet/Leaflet/pull/2117) [#2094](https://github.com/Leaflet/Leaflet/issues/2094) -* Fixed a bug on IE10+ touch where controls didn't loose the pressed state after tapping (by [@danzel](https://github.com/danzel)). [#2111](https://github.com/Leaflet/Leaflet/pull/2111) [#2103](https://github.com/Leaflet/Leaflet/issues/2103) -* Fixed a bug where clicking on layers control labels on iOS throwed an error (by [@olemarkus](https://github.com/olemarkus) and [@dagjomar](https://github.com/dagjomar)). [#1984](https://github.com/Leaflet/Leaflet/issues/1984) [#1989](https://github.com/Leaflet/Leaflet/issues/1989) - -#### Map API bugfixes - -* Fixed a bug where `Map` `getCenter` returned old result after map container size changed (by [@jfirebaugh](https://github.com/jfirebaugh)). [#1940](https://github.com/Leaflet/Leaflet/issues/1940) [#1919](https://github.com/Leaflet/Leaflet/issues/1919) -* Fixed `Map` `invalidateSize` rounding issues when changing map size by an odd pixel amount (by [@russelldavis](https://github.com/russelldavis)). [#1931](https://github.com/Leaflet/Leaflet/issues/1931) -* Fixed a bug where `Map` `removeLayer` didn't return `this` in a corner case (by [@jfirebaugh](https://github.com/jfirebaugh)). -* Fixed a bug where calling `Map` `setZoom` before `setView` would throw an error. [#1449](https://github.com/Leaflet/Leaflet/issues/1449) - -#### Layers API bugfixes - -* Fixed a bug where `Popup` `setLatLng` unnecessarily reset content and updated layout; works much faster now. [#2167](https://github.com/Leaflet/Leaflet/issues/2167) -* Fixed a bug where `toGeoJSON` of layers originated from GeoJSON GeometryCollection and MultiPoint didn't work properly (wasn't round-tripped). [#1956](https://github.com/Leaflet/Leaflet/issues/1956) -* Fixed `GeoJSON` dependencies in build configuration that could lead to a broken custom build in some situations (by [@alubchuk](https://github.com/alubchuk)). [#1909](https://github.com/Leaflet/Leaflet/issues/1909) -* Fixed a bug where `CircleMarker` popup placement wasn't updated after calling `setLatLng` (by [@snkashis](https://github.com/snkashis)). [#1921](https://github.com/Leaflet/Leaflet/issues/1921) [#1927](https://github.com/Leaflet/Leaflet/issues/1927) -* Fixed a bug where popup anchor wasn't updated on `Marker` `setIcon` (by [@snkashis](https://github.com/snkashis)). [#1874](https://github.com/Leaflet/Leaflet/issues/1874) [#1891](https://github.com/Leaflet/Leaflet/issues/1891) -* Fixed a bug with GeoJSON not throwing a descriptive error if a polygon has zero length inner ring (by [@snkashis](https://github.com/snkashis)). [#1917](https://github.com/Leaflet/Leaflet/issues/1917) [#1918](https://github.com/Leaflet/Leaflet/issues/1918) -* Fixed a bug where `FeatureGroup` would break when using non-evented children layers (by [@tmcw](https://github.com/tmcw)). [#2032](https://github.com/Leaflet/Leaflet/pull/2032) [#1962](https://github.com/Leaflet/Leaflet/issues/1962) -* Fixed a bug where `CircleMarker` `getRadius` would always return `null`. [#2016](https://github.com/Leaflet/Leaflet/issues/2016) [#2017](https://github.com/Leaflet/Leaflet/pull/2017) -* Fixed a bug where `TileLayer.WMS` didn't work with WMS 1.3 & EPSG4326 projection (by [@Bobboya](https://github.com/Bobboya)). [#1897](https://github.com/Leaflet/Leaflet/pull/1897) -* Fixed a bug where `FeatureGroup` events `e.layer` was sometimes empty in old IE. [#1938](https://github.com/Leaflet/Leaflet/issues/1938) - -#### Misc API bugfixes - -* Fixed a bug where `L.latLngBounds` didn't accept simple object `LatLng` form (by [@Gnurfos](https://github.com/Gnurfos)). [#2025](https://github.com/Leaflet/Leaflet/issues/2025) [#1915](https://github.com/Leaflet/Leaflet/issues/1915) -* Fixed a bug where `L.Util.tempalate` wouldn't work with double quotes in the string (by [@jieter](https://github.com/jieter)). [#1968](https://github.com/Leaflet/Leaflet/issues/1968) [#2121](https://github.com/Leaflet/Leaflet/pull/2121) [#2120](https://github.com/Leaflet/Leaflet/issues/2120) -* Fixed a bug where attribution control that was added to a map after attributed layers didn't have the corresponding attributions (by [@snkashis](https://github.com/snkashis)). [#2177](https://github.com/Leaflet/Leaflet/issues/2177) [#2178](https://github.com/Leaflet/Leaflet/pull/2178) - - -## 0.6.4 (2013-07-25) - -* Fixed a regression where `fitBounds` and `setMaxBounds` could freeze the browser in some situations. [#1895](https://github.com/Leaflet/Leaflet/issues/1895) [1866](https://github.com/Leaflet/Leaflet/issues/1866) -* Fixed a bug where click on a map on a page with horizontal scroll caused the page to scroll right (by [@mstrelan](https://github.com/mstrelan)). [#1901](https://github.com/Leaflet/Leaflet/issues/1901) - -## 0.6.3 (2013-07-17) - -### Regression fixes - -* Fixed a regression where mouse interaction had incorrect coordinates in some map positioning cases (by [@scooterw](https://github.com/scooterw)). [#1826](https://github.com/Leaflet/Leaflet/issues/1826) [#1684](https://github.com/Leaflet/Leaflet/issues/1684) [#1745](https://github.com/Leaflet/Leaflet/issues/1745) [#1](https://github.com/Leaflet/Leaflet/issues/1) -* Fixed a regression that prevented the map from responding to drag on areas covered with `ImageOverlay` (by [@jfirebaugh](https://github.com/jfirebaugh)). [#1821](https://github.com/Leaflet/Leaflet/issues/1821) -* Fixed a regression where `layerremove` and `layeradd` were fired before the corresponding action finishes (by [@jfirebaugh](https://github.com/jfirebaugh)). [#1846](https://github.com/Leaflet/Leaflet/issues/1846) -* Fixed a regression with `worldCopyJump: true` breaking the map on small zoom levels (by [@danzel](https://github.com/danzel)). [#1831](https://github.com/Leaflet/Leaflet/issues/1831) -* Fixed a regression where `Marker` shadow didn't animate on zoom after using `setIcon`. [#1768](https://github.com/Leaflet/Leaflet/issues/1768) -* Fixed a regression where the map would stuck when trying to animate zoom before any tile layers are added to the map. [#1484](https://github.com/Leaflet/Leaflet/issues/1484) [#1845](https://github.com/Leaflet/Leaflet/issues/1845) -* Fixed a regression with the layers control and popups closing on inside click in IE < 9. [#1850](https://github.com/Leaflet/Leaflet/issues/1850) -* Fixed a regression where scrolled popup content woudln't scroll in FF (by [@jfirebaugh](https://github.com/jfirebaugh)). - -### Bug fixes - -* Fixed vector feature flickering on Safari Mac for screen < 2000px. [#902](https://github.com/Leaflet/Leaflet/issues/902) -* Fixed a bug where `GeoJSON` ignored non-feature geometries passed in an array. [#1840](https://github.com/Leaflet/Leaflet/issues/1840) -* Fixed a bug where `Map` `minZoom` and `maxZoom` didn't always override values derived from the added tile layers. [1848](https://github.com/Leaflet/Leaflet/issues/1848) -* Fixed a bug where `TileLayer.Canvas` wasn't immediately redrawn when `redraw` is called (by [@tofferrosen](https://github.com/tofferrosen)). [#1797](https://github.com/Leaflet/Leaflet/issues/1797) [#1817](https://github.com/Leaflet/Leaflet/issues/1817) -* Fixed a bug where `FeatureGroup` still fired `layerremove` event on `removeLayer` even if the given layer wan't present in the group (by (by [@danzel](https://github.com/danzel))). [#1847](https://github.com/Leaflet/Leaflet/issues/1847) [#1858](https://github.com/Leaflet/Leaflet/issues/1858) -* Fixed a bug where `Marker` `setOpacity` wasn't returning the marker (by [@freepius44](https://github.com/freepius44)). [#1851](https://github.com/Leaflet/Leaflet/issues/1851) -* Fixed a bug where removing the map element from the DOM before panning transition has finished could keep a setInterval loop running forever (by [@rutkovsky](https://github.com/rutkovsky)). [#1825](https://github.com/Leaflet/Leaflet/issues/1825) [#1856](https://github.com/Leaflet/Leaflet/issues/1856) -* Fixed mobile styles to apply to `leaflet-bar` elements. - -### Improvements - -* Added ability to pass zoom/pan animation options to `setMaxBounds` (by [@davidjb](http://git.io/djb)). [#1834](https://github.com/Leaflet/Leaflet/pull/1834) -* Added `MultiPolyline` and `MultiPolygon` `getLatLngs` method. [#1839](https://github.com/Leaflet/Leaflet/issues/1839) - -### Dev Workflow improvements - -* Leaflet builds (*.js files in the `dist` folder) were removed from the repo and are now done automatically on each commit for `master` and `stable` branches by [Travis CI](travis-ci.org/Leaflet/Leaflet). The download links are on the [Leafet download page](http://leafletjs.com/download.html). - -## 0.6.2 (2013-06-28) - - * Fixed a bug that caused wrong tile layers stacking order when using opacity < 1 (by [@jfirebaugh](https://github.com/jfirebaugh)). [#1804](https://github.com/Leaflet/Leaflet/issues/1804) [#1790](https://github.com/Leaflet/Leaflet/issues/1790) [#1667](https://github.com/Leaflet/Leaflet/issues/1667) - * Fixed a regression that caused tiles selection when double-clicking absolutely positioned maps with vector layers in it in Firefox (WTF!) (by [@jfirebaugh](https://github.com/jfirebaugh)). [#1807](https://github.com/Leaflet/Leaflet/issues/1807) - * Fixed a regression with a wrong cursor when dragging a map with vector layers, and tiles becoming selected on double click (by [@jfirebaugh](https://github.com/jfirebaugh)). [#1800](https://github.com/Leaflet/Leaflet/issues/1800) - * Fixed a regression that caused flickering of tiles near map border on zoom animation in Chrome. - -## 0.6.1 (2013-06-27) - - * Fixed a regression with mouse wheel zooming too fast on Firefox (by [@jfirebaugh](https://github.com/jfirebaugh)). [#1788](https://github.com/Leaflet/Leaflet/issues/1788) - * Fixed a regression with broken zooming on maps with EPSG3395 projection. [#1796](https://github.com/Leaflet/Leaflet/issues/1796) - * Fixed a bug where zoom buttons inherited Bootstrap link hover styles. [#1791](https://github.com/Leaflet/Leaflet/issues/1791) - -## 0.6 (2013-06-26) - -### Breaking changes - - * Moved polyline editing code into [Leaflet.draw](https://github.com/Leaflet/Leaflet.draw) plugin (where it fits much better along with all other editing and drawing handlers). The API remains the same. - * Dropped support for environments that augment `Object.prototype` (luckily it's a thing of the past nowadays). - * `Map` `invalidateSize` no longer fires `move` and `moveend` events if the map size didn't change. [#1819](https://github.com/Leaflet/Leaflet/issues/1819) - -### Improvements - -#### Usability and performance improvements - - * **Improved zoom control design** - cleaner, simpler, more accessible (mostly by [@jacobtoye](https://github.com/jacobtoye)). [#1313](https://github.com/Leaflet/Leaflet/issues/1313) - * Updated `Control.Layers` icon (designed by Volker Kinkelin), added retina version and SVG source. [#1739](https://github.com/Leaflet/Leaflet/issues/1739) - * Added keyboard accessibility to markers (you can now tab to them and press enter for click behavior). [#1355](https://github.com/Leaflet/Leaflet/issues/1355) - * Improved `TileLayer` zoom animation to eliminate flickering in case one tile layer on top of another or when zooming several times quickly (by [@mourner](https://github.com/mourner) with lots of fixes from [@danzel](https://github.com/danzel)). [#1140](https://github.com/Leaflet/Leaflet/issues/1140) [#1437](https://github.com/Leaflet/Leaflet/issues/1437) [#52](https://github.com/Leaflet/Leaflet/issues/52) - * Subtly improved default popup styles - * Improved attribution control to be much less obtrusive (no "powered by", just a Leaflet link). You can still remove the prefix with `map.attributionControl.setPrefix('')` if you need. - * Improved zoom behavior so that there's no drift of coordinates when you change zoom back and forth without panning. [#426](https://github.com/Leaflet/Leaflet/issues/426) - * Improved double click behavior to zoom while keeping the clicked point fixed (by [@ansis](https://github.com/ansis)). [#1582](https://github.com/Leaflet/Leaflet/issues/1582) - * Improved dragging behavior to not get stuck if mouse moved outside of an iframe containing the map (by [@jfirebaugh](https://github.com/jfirebaugh)). [#1277](https://github.com/Leaflet/Leaflet/issues/1277) [#1782](https://github.com/Leaflet/Leaflet/issues/1782) [#1786](https://github.com/Leaflet/Leaflet/issues/1786) - * Improved box zoom to be cancelable by pressing Escape (by [@yohanboniface](https://github.com/yohanboniface)). [#1438](https://github.com/Leaflet/Leaflet/issues/1438) - * Improved `Marker` popups to close on marker click if opened (by [@popox](https://github.com/popox)). [#1761](https://github.com/Leaflet/Leaflet/issues/1761) - * Significantly improved mass layer removal performance (by [@jfgirard](https://github.com/jfgirard) with fixes from [@danzel](https://github.com/danzel)). [#1141](https://github.com/Leaflet/Leaflet/pull/1141) [#1514](https://github.com/Leaflet/Leaflet/pull/1514) - -#### API improvements - -##### Layers API improvements - - * Added `toGeoJSON` method to various layer types, allowing you to **save your Leaflet layers as GeoJSON**. (by [@jfirebaugh](https://github.com/jfirebaugh)). [#1462](https://github.com/Leaflet/Leaflet/issues/1462) [#712](https://github.com/Leaflet/Leaflet/issues/712) [#1779](https://github.com/Leaflet/Leaflet/issues/1779) - * Added `GeoJSON` `coordsToLatLng` option for dealing with GeoJSON that has non-WGS84 coords (thanks to [@moonlite](https://github.com/moonlite)). [#888](https://github.com/Leaflet/Leaflet/issues/888) [#886](https://github.com/Leaflet/Leaflet/issues/886) - * Improved `Marker` to reuse icon DOM elements when changing icons on the fly (e.g. fixes problems when changing icon on mouse hover) (by [@robpvn](https://github.com/robpvn) & [@danzel](https://github.com/danzel)). [#1726](https://github.com/Leaflet/Leaflet/issues/1726) [#561](https://github.com/Leaflet/Leaflet/issues/561) [#1753](https://github.com/Leaflet/Leaflet/issues/1753) [#1754](https://github.com/Leaflet/Leaflet/pull/1754) - * Added `latlng` property to `Marker` mouse event data. [#1613](https://github.com/Leaflet/Leaflet/issues/1613) - * Added `LayerGroup` `hasLayer` method (by [@rvlasveld](https://github.com/rvlasveld)). [#1282](https://github.com/Leaflet/Leaflet/issues/1282) [#1300](https://github.com/Leaflet/Leaflet/pull/1300) - * Added `LayerGroup` `getLayers` method (by [@tmcw](https://github.com/tmcw)). [#1469](https://github.com/Leaflet/Leaflet/pull/1469) - * Added `LayerGroup` `getLayer` method (by [@gumballhead](https://github.com/gumballhead)). [#1650](https://github.com/Leaflet/Leaflet/pull/1650) - * Improved `LayerGroup` `removeLayer` method to also accept layer `id` (by [@gumballhead](https://github.com/gumballhead)). [#1642](https://github.com/Leaflet/Leaflet/pull/1642) - * Added `Path` `pointerEvents` option for setting pointer-events on SVG-powered vector layers (by [@inpursuit](https://github.com/inpursuit)). [#1053](https://github.com/Leaflet/Leaflet/pull/1053) - * Improved `Polygon` to filter out last point if it's equal to the first one (to fix GeoJSON polygon issues) (by [@snkashis](https://github.com/snkashis)). [#1153](https://github.com/Leaflet/Leaflet/pull/1153) [#1135](https://github.com/Leaflet/Leaflet/issues/1135) - * Improved paths with `clickable: false` to allow mouse events to pass through to objects underneath (by [@snkashis](https://github.com/snkashis)). [#1384](https://github.com/Leaflet/Leaflet/pull/1384) [#1281](https://github.com/Leaflet/Leaflet/issues/1281) - * Improved `L.Util.template` (and correspondingly url-related `TileLayer` options) to support functions for data values (by [@olegsmith](https://github.com/olegsmith)). [#1554](https://github.com/Leaflet/Leaflet/pull/1554) - * Added `TileLayer` `getContainer` method (by [@tmcw](https://github.com/tmcw)). [#1433](https://github.com/Leaflet/Leaflet/pull/1433) - * Fixed `TileLayer.Canvas` `redraw` method chaining (by [@jieter](https://github.com/jieter)). [#1287](https://github.com/Leaflet/Leaflet/pull/1287) - * Added `TileLayer.WMS` `crs` option to be able to use WMS of CRS other than the map CRS (by [@kengu](https://github.com/kengu)). [#942](https://github.com/Leaflet/Leaflet/issues/942) [#945](https://github.com/Leaflet/Leaflet/issues/945) - * Added `popupopen` and `popupclose` events to various layers (by [@Koc](https://github.com/Koc)). [#738](https://github.com/Leaflet/Leaflet/pull/738) - * Added `Popup` `keepInView` option (thanks to [@lapo-luchini](https://github.com/lapo-luchini)) that prevents the popup from going off-screen while it's opened. [#1308](https://github.com/Leaflet/Leaflet/pull/1308) [#1052](https://github.com/Leaflet/Leaflet/issues/1052) - * Added `Marker` `togglePopup` method (by [@popox](https://github.com/popox)). [#1761](https://github.com/Leaflet/Leaflet/issues/1761) - * Added `Popup` `closeOnClick` option that overrides the same `Map` option for specific popups (by [@jfirebaugh](https://github.com/jfirebaugh)). [#1669](https://github.com/Leaflet/Leaflet/issues/1669) - * Improved `Marker` and `Path` `bindPopup` method to also accept `Popup` objects (by [@snkashis](https://github.com/snkashis)). [#1385](https://github.com/Leaflet/Leaflet/pull/1385) [#1208](https://github.com/Leaflet/Leaflet/issues/1208) [#1402](https://github.com/Leaflet/Leaflet/pull/1402) - * Added `Marker` `setPopupContent` method (by [@snkashis](https://github.com/snkashis)). [#1373](https://github.com/Leaflet/Leaflet/pull/1373) - -##### Map API improvements - - * Improved all view changing methods of `Map` (`setView`, `panTo`, `setZoom`, `fitBounds`, etc.) to accept an options object, including the ability to precisely control zoom/pan animations they cause (force disable/enable, etc.). [#1617](https://github.com/Leaflet/Leaflet/pull/1617) [#1616](https://github.com/Leaflet/Leaflet/issues/1616) [#340](https://github.com/Leaflet/Leaflet/issues/340) [#483](https://github.com/Leaflet/Leaflet/issues/483) [#1164](https://github.com/Leaflet/Leaflet/issues/1164) [#1420](https://github.com/Leaflet/Leaflet/issues/1420) - * Improved `Map` `fitBounds` method to accept `padding` (or `paddingTopLeft` and `paddingBottomRight`) options, allowing you to zoom to an area with a certain padding in pixels (usually left for controls). [#859](https://github.com/Leaflet/Leaflet/issues/859) - * Improved `Map` `invalidateSize` to accept options object (`animate` and `pan`, the latter controls if it pans the map on size change). (by [@jacobtoye](https://github.com/jacobtoye) and [@mourner](https://github.com/mourner)). [#1766](https://github.com/Leaflet/Leaflet/issues/1766) [#1767](https://github.com/Leaflet/Leaflet/issues/1767) - * Added `Map` `setZoomAround` method for zooming while keeping a certain point fixed (used by scroll and double-click zooming). [#1157](https://github.com/Leaflet/Leaflet/issues/1157) - * Added `Map` `remove` method to properly destroy the map and clean up all events, and added corresponding `unload` event (by [@jfirebaugh](https://github.com/jfirebaugh) and [@mourner](https://github.com/mourner)). [#1434](https://github.com/Leaflet/Leaflet/issues/1434) [#1101](https://github.com/Leaflet/Leaflet/issues/1101) [#1621](https://github.com/Leaflet/Leaflet/issues/1621) - * Added `Map` `tap` handler that now contains all mobile hacks for enabling quick taps and long holds and `tapTolerance` option specifying the number of pixels you can shift your finger for click to still fire. - * Added `Map` `zoomAnimationThreshold` for setting the max zoom difference with which zoom animation can occur. [#1377](https://github.com/Leaflet/Leaflet/issues/1377) - * Improved `Map` `openPopup` method to also accept `(content, latlng)` signature as a shortcut. - * Improved `Map` `closePopup` method to optionally accept a popup object to close. [#1641](https://github.com/Leaflet/Leaflet/issues/1641) - * Improved `Map` `stopLocate` method to abort resetting map view if calling `locate` with `setView` option. [#747](https://github.com/Leaflet/Leaflet/issues/747) - * Improved `Map` to throw exception if the specified container id is not found (by [@tmcw](htts://github.com/tmcw)). [#1574](https://github.com/Leaflet/Leaflet/pull/1574) - * Improved `Map` `locationfound` event to pass all location data (heading, speed, etc.). [#984](https://github.com/Leaflet/Leaflet/issues/984) [#584](https://github.com/Leaflet/Leaflet/issues/584) [#987](https://github.com/Leaflet/Leaflet/issues/987) [#1028](https://github.com/Leaflet/Leaflet/issues/1028) - * Added `Map` `resize` event. [#1564](https://github.com/Leaflet/Leaflet/issues/1564) - * Added `Map` `zoomlevelschange` event that triggers when the current zoom range (min/max) changes (by [@moonlite](https://github.com/moonlite)). [#1376](https://github.com/Leaflet/Leaflet/pull/1376) - -##### Controls API improvements - - * Added **generic toolbar classes** for reuse by plugin developers (used by zoom control). - * Added `Map` `baselayerchange`, `overlayadd` and `overlayremove` events fired by `Control.Layers` (by [@calvinmetcalf](https://github.com/calvinmetcalf) and [@Xelio](https://github.com/Xelio)). [#1286](https://github.com/Leaflet/Leaflet/issues/1286) [#1634](https://github.com/Leaflet/Leaflet/issues/1634) - * Added `Control` `getContainer` method. [#1409](https://github.com/Leaflet/Leaflet/issues/1409) - -##### Misc API improvements - - * Made Leaflet classes compatible with **CoffeeScript class inheritance** syntax (by [@calvinmetcalf](https://github.com/calvinmetcalf)). [#1345](https://github.com/Leaflet/Leaflet/pull/1345) [#1314](https://github.com/Leaflet/Leaflet/issues/1314) - * Added `cleanAllEventListeners` method (aliased to `off` without arguments) to all events-enabled objects (by [@iirvine](https://github.com/iirvine)). [#1599](https://github.com/Leaflet/Leaflet/issues/1599) - * Added `addOneTimeEventListener` method (aliased to `once`) to all events-enabled objects (by [@iirvine](https://github.com/iirvine)). [#473](https://github.com/Leaflet/Leaflet/issues/473) [#1596](https://github.com/Leaflet/Leaflet/issues/1596) - * Added ability to pass coordinates as simple objects (`{lat: 50, lon: 30}` or `{lat: 50, lng: 30}`). [#1412](https://github.com/Leaflet/Leaflet/issues/1412) - * Added `LatLngBounds` `getNorth`, `getEast`, `getSouth`, `getWest` methods (by [@yohanboniface](https://github.com/yohanboniface)). [#1318](https://github.com/Leaflet/Leaflet/issues/1318) - * Added `AMD` support (Leaflet now registers itself as a `leaflet` AMD module) (with fixes from [@sheppard](https://github.com/sheppard)). [#1364](https://github.com/Leaflet/Leaflet/issues/1364) [#1778](https://github.com/Leaflet/Leaflet/issues/1778) - * Added `L.Util.trim` function (by [@kristerkari](https://github.com/kristerkari)). [#1607](https://github.com/Leaflet/Leaflet/pull/1607) - -#### Development workflow improvements - - * Switched from Jasmine to [Mocha](http://visionmedia.github.io/mocha/) with Expect.js (matchers) and Sinon (spies) for tests (by [@tmcw](https://github.com/tmcw) & [@jfirebaugh](https://github.com/jfirebaugh)). [#1479](https://github.com/Leaflet/Leaflet/issues/1479) - * Added [Karma](http://karma-runner.github.io) integration for running tests in a headless PhantomJS instance and code coverage reporting (by [@edjafarov](https://github.com/edjafarov)). [#1326](https://github.com/Leaflet/Leaflet/issues/1326) [#1340](https://github.com/Leaflet/Leaflet/pull/1340) - * Added [Travis CI integration](https://travis-ci.org/Leaflet/Leaflet) for linting and running tests for each commit and pull request automatically (by [@edjafarov](https://github.com/edjafarov)). [#1336](https://github.com/Leaflet/Leaflet/issues/1336) - * Significantly improved test coverage - * Added compatibility with lazy evaluation scripts (by [@kristerkari](https://github.com/kristerkari)). [#1288](https://github.com/Leaflet/Leaflet/issues/1288) [#1607](https://github.com/Leaflet/Leaflet/issues/1607) [#1288](https://github.com/Leaflet/Leaflet/issues/1288) - -### Bugfixes - -#### General bugfixes - - * Fixed lots of issues with extent restriction by `Map` `maxBounds`. [#1491](https://github.com/Leaflet/Leaflet/issues/1491) [#1475](https://github.com/Leaflet/Leaflet/issues/1475) [#1194](https://github.com/Leaflet/Leaflet/issues/1194) [#900](https://github.com/Leaflet/Leaflet/issues/900) [#1333](https://github.com/Leaflet/Leaflet/issues/1333) - * Fixed occasional crashes by disabling zoom animation if changing zoom level by more than 4 levels. [#1377](https://github.com/Leaflet/Leaflet/issues/1377) - * Fixed a bug with that caused stuttery keyboard panning in some cases (by [@tmcw](https://github.com/tmcw)). [#1710](https://github.com/Leaflet/Leaflet/issues/1710) - * Fixed a bug that caused unwanted scrolling of the page to the top of the map on focus. [#1228](https://github.com/Leaflet/Leaflet/issues/1228) [#1540](https://github.com/Leaflet/Leaflet/issues/1540) - * Fixed a bug where clicking on a marker with an open popup caused the popup to faded in again (by [@snkashis](https://github.com/snkashis)). [#506](https://github.com/Leaflet/Leaflet/issues/560) [#1386](https://github.com/Leaflet/Leaflet/pull/1386) - * Fixed a bug where zoom buttons disabled state didn't update on min/max zoom change (by [@snkashis](https://github.com/snkashis)). [#1372](https://github.com/Leaflet/Leaflet/pull/1372) [#1328](https://github.com/Leaflet/Leaflet/issues/1328) - * Fixed a bug where scrolling slightly wouldn't always zoom out the map (by [@cschwarz](https://github.com/cschwarz)). [#1575](https://github.com/Leaflet/Leaflet/pull/1575) - * Fixed popup close button to not leave an outline after clicking on it and reopening the popup (by [@dotCypress](https://github.com/dotCypress)). [#1537](https://github.com/Leaflet/Leaflet/pull/1537) - * Fixed a bug that prevented tiles from loading during pan animation. - * Fixed a bug with `contextmenu` events on popups falling through to map (by [@snkashis](https://github.com/snkashis)). [#1730](https://github.com/Leaflet/Leaflet/issues/1730) [#1732](https://github.com/Leaflet/Leaflet/issues/1732) - * Fixed `404` tile loading errors when browsing the map off the world bounds. - * Fixed shifted mouse events in some cases with map inside a relatively positioned parent (by [@scooterw](https://github.com/scooterw) and [@jec006](https://github.com/jec006)). [#1670](https://github.com/Leaflet/Leaflet/issues/1670) [#1684](https://github.com/Leaflet/Leaflet/issues/1684) [#1745](https://github.com/Leaflet/Leaflet/issues/1745) [#1744](https://github.com/Leaflet/Leaflet/issues/1744) - * Fixed a bug where tile layer z-index order sometimes broke after view reset. [#1422](https://github.com/Leaflet/Leaflet/issues/1422) - -#### Browser bugfixes - - * Fixed a bug with undesirable page scrolling in Firefox 17+ when you zoom the map by scrolling (by [@jfirebaugh](https://github.com/jfirebaugh)). [#1789](https://github.com/Leaflet/Leaflet/issues/1789) [#1788](https://github.com/Leaflet/Leaflet/issues/1788) - * Fixed a bug where mouse coordinates where shifted in Firefox if the map was inside a positioned block on a scrolled page (by [@joschka](https://github.com/joschka)). [#1365](https://github.com/Leaflet/Leaflet/pull/1365) [#1322](https://github.com/Leaflet/Leaflet/issues/1322) - * Fixed a bug where box zoom didn't work in some cases in Firefox 18+ (by [@fabriceds](https://github.com/fabriceds)). [#1405](https://github.com/Leaflet/Leaflet/pull/1405) - * Fixed a bug where `TileLayer` opacity didn't work in IE 7-8 (by [@javisantana](https://github.com/javisantana) & [@danzel](https://gi -.com/danzel)). [#1084](https://github.com/Leaflet/Leaflet/issues/1084) [#1396](https://github.com/Leaflet/Leaflet/pull/1396) [#1371](https://github.com/Leaflet/Leaflet/issues/1371) - * Fixed Leaflet not working correctly in PhantomJS (by [@rassie](https://github.com/rassie)). [#1501](https://github.com/Leaflet/Leaflet/pull/1501) - -#### Mobile bugfixes - - * Fixed a bug with layers control on WinPhone8/IE10 Touch (by [@danzel](https://github.com/danzel)). [#1635](https://github.com/Leaflet/Leaflet/pull/1635) [#1539](https://github.com/Leaflet/Leaflet/issues/1539) - * Fixed a bug with click sometimes firing twice on WinPhone8/IE10 Touch (by [@danzel](https://github.com/danzel)). [#1694](https://github.com/Leaflet/Leaflet/issues/1694) - * Fixed a bug in Android where click was triggered twice on one tap (by [@jerel](https://github.com/jerel) & [@mourner](https://github.com/mourner)). [#1227](https://github.com/Leaflet/Leaflet/pull/1227) [#1263](https://github.com/Leaflet/Leaflet/issues/1263) [#1785](https://github.com/Leaflet/Leaflet/issues/1785) [#1694](https://github.com/Leaflet/Leaflet/issues/1694) - * Fixed a bug in Android where click on a collapsed layers control would immediately select one of the layers (by [@danzel](https://github.com/danzel)). [#1784](https://github.com/Leaflet/Leaflet/issues/1784) [#1694](https://github.com/Leaflet/Leaflet/issues/1694) - -#### API bugfixes - -##### General API bugfixes - - * Fixed click mouse event inside popups **not propagating outside the map** (fixes issues with jQuery.live and some mobile frameworks that rely on document click listeners). [#301](https://github.com/Leaflet/Leaflet/issues/301) - * Fixed a bug where event listener still fired even if it was removed on the same event in other listener (by [@spamdaemon](https://github.com/spamdaemon)). [#1661](https://github.com/Leaflet/Leaflet/issues/1661) [#1654](https://github.com/Leaflet/Leaflet/issues/1654) - * Fixed a bug where `L.point` and `L.latLng` factories weren't passing `null` and `undefined` values through. - * Fixed `DomEvent` `removeListener` function chaining (by [@pagameba](https://github.com/pagameba)). - * Fixed a bug where `removeEventListener` would throw an error if no events are registered on the object (by [@tjoekbezoer](https://github.com/tjoekbezoer)). [#1632](https://github.com/Leaflet/Leaflet/pull/1632) [#1631](https://github.com/Leaflet/Leaflet/issues/1631) - * Fixed a bug where `Point` `equals` and `contains` methods didn't accept points in array form. - * Fixed a bug where `LatLngBounds` `extend` of an undefined object would cause an error (by [@korzhyk](https://github.com/korzhyk)). [#1688](https://github.com/Leaflet/Leaflet/issues/1688) - * Fixed a bug where `Control.Attribution` `removeAttribution` of inexistant attribution corrupted the attribution text. [#1410](https://github.com/Leaflet/Leaflet/issues/1410) - * Fixed a bug where `setView` on an invisible map caused an error (by [@jfire](https://github.com/jfire)). [#1707](https://github.com/Leaflet/Leaflet/issues/1707) - * Fixed compatibility with Browserify (by [@jfirebaugh](https://github.com/jfirebaugh)). [#1572](https://github.com/Leaflet/Leaflet/pull/1572) - -##### Layers API bugfixes - - * Fixed a bug where default marker icon path wasn't properly detected in some cases in IE6-7 (by [@calvinmetcalf](https://github.com/calvinmetcalf)). [#1294](https://github.com/Leaflet/Leaflet/pull/1294) - * Fixed a bug where `TileLayer.WMS` param values weren't escaped in URLs (by [@yohanboniface](https://github.com/yohanboniface)). [#1317](https://github.com/Leaflet/Leaflet/issues/1317) - * Fixed a bug where layers that belong to multiple feature groups didn't propagate events correctly (by [@danzel](https://github.com/danzel)). [#1359](https://github.com/Leaflet/Leaflet/pull/1359) - * Fixed a bug where `TileLayer.WMS` `tileSize` option was ignored (by [@brianhatchl](https://github.com/brianhatchl)). [#1080](https://github.com/brianhatchl) - * Fixed a bug where `Polyline` constructor could overwrite the source array (by [@snkashis](https://github.com/snkashis) and [@danzel](https://github.com/danzel)). [#1439](https://github.com/Leaflet/Leaflet/pull/1439) [#1092](https://github.com/Leaflet/Leaflet/issues/1092) [#1246](https://github.com/Leaflet/Leaflet/issues/1246) [#1426](https://github.com/Leaflet/Leaflet/issues/1426) - * Fixed a bug where marker dragging disabling/enabling wouldn't always work correctly (by [@snkashis](https://github.com/snkashis) and [@escaped](https://github.com/escaped)). [#1471](https://github.com/Leaflet/Leaflet/pull/1471) [#1551](https://github.com/Leaflet/Leaflet/pull/1551) - * Fixed `TileLayer` to prevent incorrect subdomain in case of negative tile coordinates (by [@malexeev](https://github.com/malexeev)). [#1532](https://github.com/Leaflet/Leaflet/pull/1532) - * Fixed polygons to normalize holes (remove last point if it's equal to the first one) (by [@jfirebaugh](https://github.com/jfirebaugh)). [#](https://github.com/Leaflet/Leaflet/pull/1467) [#1459](https://github.com/Leaflet/Leaflet/issues/1459) - * Fixed `DivIcon` `html` option to accept `0` as a value (by [@stuporglue](https://github.com/stuporglue)). [#1633](https://github.com/Leaflet/Leaflet/pull/1633) - * Fixed a bug with Canvas-based paths throwing an error on `mousemove` in certain conditions. [#1615](https://github.com/Leaflet/Leaflet/issues/1615) - * Fixed a bug where copies of the world wouldn't load if you set `TileLayer` `bounds` (by [@ansis](https://github.com/ansis)). [#1618](https://github.com/Leaflet/Leaflet/issues/1618) - * Fixed a bug where `TileLayer` `load` event wouldn't always fire correctly. [#1565](https://github.com/Leaflet/Leaflet/issues/1565) - * Fixed `TileLayer.WMS` compatibility with some old servers that only accepted request parameters in uppercase. [#1751](https://github.com/Leaflet/Leaflet/issues/1751) - * Fixed a bug with incorrect `L.Icon.Default.imagePath` detection in some cases. [#1657](https://github.com/Leaflet/Leaflet/issues/1657) - * Fixed a bug where layer `onRemove` was still called even if it was never added (by [@jfirebaugh](https://github.com/jfirebaugh)). [#1729](https://github.com/Leaflet/Leaflet/issues/1729) - * Fixed a bug where calling `setRadius` on a Canvas-powered `CircleMarker` would cause an infinite loop (by [@snkashis](https://github.com/snkashis)). [#1712](https://github.com/Leaflet/Leaflet/issues/1712) [#1713](https://github.com/Leaflet/Leaflet/issues/1713) [#1728](https://github.com/Leaflet/Leaflet/issues/1728) - * Renamed `marker-icon@2x.png` to `marker-icon-2x.png` to fix compatibility with Google AppEngine. [#1552](https://github.com/Leaflet/Leaflet/issues/1552) [#1553](https://github.com/Leaflet/Leaflet/issues/1553) - * Fixed a bug where `popupclose` and `popupopen` events weren't fired for multipolygons and multipolylines (by [@tmcw](https://github.com/tmcw)). [#1681](https://github.com/Leaflet/Leaflet/issues/1681) - -##### Map API bugfixes - - * Fixed a bug where `Map` `fitBounds` wouldn't work correctly with large bounds (thanks to [@MaZderMind](https://github.com/MaZderMind)). [#1069](https://github.com/Leaflet/Leaflet/issues/1069) - * Fixed a bug where `Map` `hasLayer` wasn't handling `null` objects (by [@rvlasveld](https://github.com/rvlasveld)). [#1282](https://github.com/Leaflet/Leaflet/issues/1282) [#1302](https://github.com/Leaflet/Leaflet/pull/1302) - * Fixed a bug where `Map` `moveend` fired before `dragend` on drag (by [@oslek](https://github.com/oslek)). [#1374](https://github.com/Leaflet/Leaflet/pull/1374) - * Fixed a bug where panning with inertia produced an excessive `Map` `movestart` event on inertia start (by [@oslek](https://github.com/oslek)). [#1374](https://github.com/Leaflet/Leaflet/pull/1374) - * Fixed a bug where `Map` `moveend` fired repeatedly on window resize even if the actual map size didn't change (by [@oslek](https://github.com/oslek)). [#1374](https://github.com/Leaflet/Leaflet/pull/1374) - * Fixed a bug where `Map` `moveend` sometimes wasn't fired after drag (particularly often when dragging with a trackpad). - * Fixed a bug that would cause an error when trying to get the state of the map in a `Map` `load` event listener. [#962](https://github.com/Leaflet/Leaflet/issues/962) - * Added `Map` `autopanstart` event back (it was removed occasionally in previous version). [#1375](https://github.com/Leaflet/Leaflet/issues/1375) - * Fixed a bug with removing previously set `Map` `maxBounds` (by [@jec006](https://github.com/jec006)). [#1749](https://github.com/Leaflet/Leaflet/issues/1749) [#1750](https://github.com/Leaflet/Leaflet/issues/1750) - - -## 0.5.1 (2013-02-06) - - * Fixed a regression with `GeoJSON` not accepting arrays of `FeatureCollection` (by [@snkashis](https://github.com/snkashis)). [#1299](https://github.com/Leaflet/Leaflet/pull/1299) [#1298](https://github.com/Leaflet/Leaflet/issues/1298) - * Fixed a regression with `CirleMarker` `setRadius` not working if called before adding the layer to the map (by [@danzel](https://github.com/danzel)). [#1342](https://github.com/Leaflet/Leaflet/issues/1342) [#1297](https://github.com/Leaflet/Leaflet/issues/1297) - -## 0.5 (2013-01-17) - -### Breaking changes - -Be sure to read through these changes to avoid any issues when upgrading from older versions: - - * Removed default `LatLng` wrapping/clamping of coordinates (`-180, -90` to `180, 90`), wrapping moved to an explicit method (`LatLng` `wrap`). - * Disabled `Map` `worldCopyJump` option by default (jumping back to the original world copy when panning out of it). Enable it explicitly if you need it. - * Changed styles for the zoom control (you may need to update your custom styles for it). - -### Improvements - -#### Usability improvements - -##### Interaction - - * Added touch zoom, pan and double tap support for **IE10 touch devices and Metro apps** (by [@danzel](https://github.com/danzel) and [@veproza](https://github.com/veproza) with help from [@oliverheilig](https://github.com/oliverheilig)). [#1076](https://github.com/Leaflet/Leaflet/pull/1076) [#871](https://github.com/Leaflet/Leaflet/issues/871) - * **Improved panning inertia** to be much more natural and smooth. - * **Improved dragging cursors** in Chrome, Safari and Firefox (now grabbing hand cursors are used). - * Improved zoom animation curve for a better feel overall. - * Improved scroll wheel zoom to be more responsive. - * Improved panning animation performance in IE6-8. - -##### Controls - - * **Improved zoom control design** to look better, more neutral and in line with other controls, making it easier to customize and fit different website designs. Replaced +/- images with text. - * Improved zoom control to zoom by 3 levels if you hold shift while clicking on a button. - * Improved zoom control buttons to become visually disabled when min/max zoom is reached. [#917](https://github.com/Leaflet/Leaflet/issues/917) - * Improved scale control styles. - * Improved fallback control styles for IE6-8. - -##### Other - - * Added **retina support for markers** (through `Icon` `iconRetinaUrl` and `shadowRetinaUrl` options) (by [@danzel](https://github.com/danzel)). [#1048](https://github.com/Leaflet/Leaflet/issues/1048) [#1174](https://github.com/Leaflet/Leaflet/pull/1174) - * Added retina-sized default marker icon in addition to standard one (along with its SVG source and with some subtle design improvements) (by [@danzel](https://github.com/danzel)). [#1048](https://github.com/Leaflet/Leaflet/issues/1048) [#1174](https://github.com/Leaflet/Leaflet/pull/1174) - * Improved vectors updating/removing performance on Canvas backend (by [@danzel](https://github.com/danzel)). [#961](https://github.com/Leaflet/Leaflet/pull/961) - * Cut total images size from 10KB to 3.2KB with [Yahoo Smush.it](http://www.smushit.com/ysmush.it/). Thanks to Peter Rounce for suggestion. - -#### API improvements - - * Replaced `L.Transition` with a much better and simpler `L.PosAnimation`. - * Added `Class` `addInitHook` method for **adding constructor hooks to any classes** (great extension point for plugin authors). [#1123](https://github.com/Leaflet/Leaflet/issues/1123) - * Added `Map` `whenReady` method (by [@jfirebaugh](https://github.com/jfirebaugh)). [#1063](https://github.com/Leaflet/Leaflet/pull/1063) - * Added optional `delta` argument to `Map` `zoomIn` and `zoomOut` (1 by default). - * Added `isValid` method to `LatLngBounds` and `Bounds` (by [@domoritz](https://github.com/domoritz)). [#972](https://github.com/Leaflet/Leaflet/pull/972) - * Added `Point` `equals` method. - * Added `Bounds` `getSize` method. - * Improved markers and vectors click event so that it propagates to map if no one is listening to it (by [@danzel](https://github.com/danzel)). [#834](https://github.com/Leaflet/Leaflet/issues/834) [#1033](https://github.com/Leaflet/Leaflet/pull/1033) - * Added `Path` `unbindPopup` and `closePopup` methods. - * Added `Path` `add` and `remove` event. - * Added `Marker` `riseOnHover` and `riseOffset` options (for bringing markers to front on hover, disabled by default) (by [jacobtoye](https://github.com/jacobtoye)). [#914](https://github.com/Leaflet/Leaflet/pull/914) [#920](https://github.com/Leaflet/Leaflet/issues/920) - * Added `Marker` `move` and `remove` events. - * Added `Marker` `contextmenu` event. [#223](https://github.com/Leaflet/Leaflet/issues/223) - * Added `Popup` `zoomAnimation` option (useful to disable when displaying flash content inside popups [#999](https://github.com/Leaflet/Leaflet/issues/999)). - * Added `FeatureGroup` `layeradd` and `layerremove` events (by [@jacobtoye](https://github.com/jacobtoye)). [#1122](https://github.com/Leaflet/Leaflet/issues/1122) - * Added `Control.Layers` `baselayerchange` event (by [@jfirebaugh](https://github.com/jfirebaugh)). [#1064](https://github.com/Leaflet/Leaflet/pull/1064) - * Improved `Control.Layers` to support HTML in layer names (by [@aparshin](https://github.com/aparshin)). [#1055](https://github.com/Leaflet/Leaflet/pull/1055) [#1099](https://github.com/Leaflet/Leaflet/issues/1099) - * Added `CRS.Simple` to the list of built-in CRS and improved it to be more usable out of the box (it has different default scaling and transformation now), see `debug/map/simple-proj.html` for an example. - * Removed `Browser` `ua`, `gecko`, `opera` properties (no longer needed). - * Added `L.extend`, `L.bind`, `L.stamp`, `L.setOptions` shortcuts for corresponding `L.Util` methods. - * Disabled clearing of map container contents on map initialization (as a result of fixing [#278](https://github.com/Leaflet/Leaflet/issues/278)). - * Added `L.Util.isArray` function (by [@oslek](https://github.com/oslek)). [#1279](https://github.com/Leaflet/Leaflet/pull/1279) - * Added `mouseover` and `mouseout` events to canvas-based vector layers (by [@snkashis](https://github.com/snkashis)). [#1403](https://github.com/Leaflet/Leaflet/pull/1403) - * Added `Map` `eachLayer` to iterate over all layers added to the map (by [@jfirebaugh](https://github.com/jfirebaugh)). [#1457](https://github.com/Leaflet/Leaflet/pull/1457) - * Added `TileLayer` `bounds` option to limit tile loading to a specific region (by [@adimitrov](https://github.com/adimitrov)). [#991](https://github.com/Leaflet/Leaflet/pull/991) - -### Bugfixes - -#### General bugfixes - - * Fixed broken tiles and zooming in RTL layouts (by [@danzel](https://github.com/danzel)). [#1099](https://github.com/Leaflet/Leaflet/pull/1099) [#1095](https://github.com/Leaflet/Leaflet/issues/1095) - * Fixed a bug with pan animation where it jumped to its end position if you tried to drag the map. - * Fixed a bug where shift-clicking on a map would zoom it to the max zoom level. - * Fixed a glitch with zooming in while panning animation is running. - * Fixed a glitch with dragging the map while zoom animation is running. - * Fixed a bug where slight touchpad scrolling or one-wheel scrolling wouln't always perform zooming. [#1039](https://github.com/Leaflet/Leaflet/issues/1039) - * Fixed a bug where `panBy` wouldn't round the offset values (so it was possible to make the map blurry with it). [#1085](https://github.com/Leaflet/Leaflet/issues/1085) - * Fixed a bug where you couldn't scroll the layers control with a mouse wheel. - * Fixed a regression where WMS tiles wouldn't wrap on date lines. [#970](https://github.com/Leaflet/Leaflet/issues/970) - * Fixed a bug where mouse interaction was affected by map container border width (by [@mohlendo](https://github.com/mohlendo)). [#1204](https://github.com/Leaflet/Leaflet/issues/1205) [#1205](https://github.com/Leaflet/Leaflet/pull/1205) - * Fixed a bug with weird vector zoom animation when using Canvas for rendering (by [@danzel](https://github.com/danzel)). [#1187](https://github.com/Leaflet/Leaflet/issues/1187) [#1188](https://github.com/Leaflet/Leaflet/pull/1188) - * Fixed a bug where max bounds limitation didn't work when navigating the map with a keyboard (by [@snkashis](https://github.com/snkashis)). [#989](https://github.com/Leaflet/Leaflet/issues/989) [#1221](https://github.com/Leaflet/Leaflet/pull/1221) - -#### API bugfixes - - * Fixed a bug where `TileLayer` `bringToBack` didn't work properly in some cases (by [@danzel](https://github.com/danzel)). [#963](https://github.com/Leaflet/Leaflet/pull/963) [#959](https://github.com/Leaflet/Leaflet/issues/959) - * Fixed a bug where removing a tile layer while dragging would throw an error (by [@danzel](https://github.com/danzel)). [#965](https://github.com/Leaflet/Leaflet/issues/965) [#968](https://github.com/Leaflet/Leaflet/pull/968) - * Fixed a bug where middle marker wasn't removed after deleting 2 end nodes from a polyline (by [@Svad](https://github.com/Svad)). [#1022](https://github.com/Leaflet/Leaflet/issues/1022) [#1023](https://github.com/Leaflet/Leaflet/pull/1023) - * Fixed a bug where `Map` `load` event happened too late (after `moveend`, etc.) (by [@jfirebaugh](https://github.com/jfirebaugh)). [#1027](https://github.com/Leaflet/Leaflet/pull/1027) - * Fixed `Circle` `getBounds` to return correct bounds and work without adding the circle to a map. [#1068](https://github.com/Leaflet/Leaflet/issues/1068) - * Fixed a bug where removing `Popup` on `viewreset` throwed an error (by [fnicollet](https://github.com/fnicollet) and [@danzel](https://github.com/danzel)). [#1098](https://github.com/Leaflet/Leaflet/pull/1098) [#1094](https://github.com/Leaflet/Leaflet/issues/1094) - * Fixed a bug where `TileLayer.Canvas` `drawTile` didn't receive tile zoom level in arguments. - * Fixed a bug where `GeoJSON` `resetStyle` would not fully reset a layer to its default style. [#1112](https://github.com/Leaflet/Leaflet/issues/1112) - * Fixed a bug that caused infinite recursion when using `latLngBounds` factory with coordinates as string values. [#933](https://github.com/Leaflet/Leaflet/issues/933) - * Fixed chaining on `Marker` `setIcon`, `setZIndexOffset`, `update` methods. [#1176](https://github.com/Leaflet/Leaflet/issues/1176) - * Fixed a bug with mouse interaction when the map container contained children with position other than absolute. [#278](https://github.com/Leaflet/Leaflet/issues/278) - * Fixed a bug with fill/stroke opacity conflicts when using Canvas for rendering (by [@danzel](https://github.com/danzel)). [#1186](https://github.com/Leaflet/Leaflet/issues/1186) [#1889](https://github.com/Leaflet/Leaflet/pull/1189) - * Fixed a bug where `FeatureGroup` `bindPopup` didn't take options into account. - * Fixed a bug where Canvas-based vector layers didn't cleanup click event on removal properly (by [@snkashis](https://github.com/snkashis)). [#1006](https://github.com/Leaflet/Leaflet/issues/1006) [#1273](https://github.com/Leaflet/Leaflet/pull/1273) - * Fixed a bug where `CircleMarker` `setStyle` didn't take `radius` into account (by [@fdlk](https://github.com/fdlk)). [#1012](https://github.com/Leaflet/Leaflet/issues/1012) [#1013](https://github.com/Leaflet/Leaflet/pull/1013) - * Fixed a bug where null GeoJSON geometries would throw an error instead of skipping (by [@brianherbert](https://github.com/brianherbert)). [#1240](https://github.com/Leaflet/Leaflet/pull/1240) - * Fixed a bug where Canvas-based vector layers passed incorrect `layer` event property on click (by [@snkashis](https://github.com/snkashis)). [#1215](https://github.com/Leaflet/Leaflet/issues/1215) [#1243](https://github.com/Leaflet/Leaflet/pull/1243) - * Fixed a bug where `TileLayer.WMS` didn't work correctly if the base URL contained query parameters (by [@snkashis](https://github.com/snkashis)). [#973](https://github.com/Leaflet/Leaflet/issues/973) [#1231](https://github.com/Leaflet/Leaflet/pull/1231) - * Fixed a bug where removing a polyline in editing state wouldn't clean up the editing handles (by [@mehmeta](https://github.com/mehmeta)). [#1233](https://github.com/Leaflet/Leaflet/pull/1233) - * Fixed a bug where removing a vector layer with a bound popup wouldn't clean up its click event properly (by [@yohanboniface](https://github.com/yohanboniface)). [#1229](https://github.com/Leaflet/Leaflet/pull/1229) - * Fixed a bug where `GeoJSON` features with `GeometryCollection` didn't pass properties to `pointToLayer` function (by [@calvinmetcalf](https://github.com/calvinmetcalf)). [#1097](https://github.com/Leaflet/Leaflet/pull/1097) - * Fixed `FeatureGroup` `eachLayer` chaining. [#1452](https://github.com/Leaflet/Leaflet/issues/1452) - -#### Browser bugfixes - - * Fixed a bug with map **freezing after zoom on Android 4.1**. [#1182](https://github.com/Leaflet/Leaflet/issues/1182) - * Fixed a bug where "Not implemented" error sometimes appeared in IE6-8 (by [@bryguy](https://github.com/bryguy) and [@lookfirst](https://github.com/lookfirst)). [#892](https://github.com/Leaflet/Leaflet/issues/892) [#893](https://github.com/Leaflet/Leaflet/pull/893) - * Fixed compatibility with SmoothWheel extension for Firefox (by [@waldir](https://github.com/waldir)). [#1011](https://github.com/Leaflet/Leaflet/pull/1011) - * Fixed a bug with popup layout in IE6-7 (by [@danzel](https://github.com/danzel)). [#1117](https://github.com/Leaflet/Leaflet/issues/1117) - * Fixed a bug with incorrect box zoom opacity in IE6-7 (by [@jacobtoye](https://github.com/jacobtoye)). [#1072](https://githubcom/Leaflet/Leaflet/pull/1072) - * Fixed a bug with box zoom throwing a JS error in IE6-7 (by [@danzel](https://github.com/danzel)). [#1071](https://github.com/Leaflet/Leaflet/pull/1071) - * Fixed a bug where `TileLayer` `bringToFront/Back()` throwed an error in IE6-8. [#1168](https://github.com/Leaflet/Leaflet/issues/1168) - * Fixed array type checking in the code to be more consistent in a cross-frame environment (by [@oslek](https://github.com/oslek)). [#1279](https://github.com/Leaflet/Leaflet/pull/1279) - * Fixed a bug with `-` key not working in Firefox 15+ (thanks to [@mattesCZ](https://github.com/mattesCZ)). [#869](https://github.com/Leaflet/Leaflet/issues/869) - -## 0.4.5 (2012-10-25) - - * Fixed a bug with **wonky zoom animation in IE10** (by [@danzel](https://github.com/danzel)). [#1007](https://github.com/Leaflet/Leaflet/pull/1007) - * Fixed a bug with **wonky zoom animation in Chrome 23+** (by [@danzel](https://github.com/danzel)). [#1060](https://github.com/Leaflet/Leaflet/pull/1060) [#1056](https://github.com/Leaflet/Leaflet/issues/1056) - -## 0.4.4 (2012-08-07) - -### Improvements - - * Improved `GeoJSON` `setStyle` to also accept function (like the corresponding option). - * Added `GeoJSON` `resetStyle(layer)`, useful for resetting hover state. - * Added `feature` property to layers created with `GeoJSON` (containing the GeoJSON feature data). - * Added `FeatureGroup` `bringToFront` and `bringToBack` methods (so that they would work for multipolys). - * Added optional `animate` argument to `Map` `invalidateSize` (by [@ajbeaven](https://github.com/ajbeaven)). [#857](https://github.com/Leaflet/Leaflet/pull/857) - -### Bugfixes - - * Fixed a bug where tiles sometimes disappeared on initial map load on Android 2/3 (by [@danzel](https://github.com/danzel)). [#868](https://github.com/Leaflet/Leaflet/pull/868) - * Fixed a bug where map would occasionally flicker near the border on zoom or pan on Chrome. - * Fixed a bug where `Path` `bringToFront` and `bringToBack` didn't return `this`. - * Removed zoom out on Win/Meta key binding (since it interferes with global keyboard shortcuts). [#869](https://github.com/Leaflet/Leaflet/issues/869) - -## 0.4.2 (2012-08-01) - - * Fixed a bug where layers control radio buttons would not work correctly in IE7 (by [@danzel](https://github.com/danzel)). [#862](https://github.com/Leaflet/Leaflet/pull/862) - * Fixed a bug where `FeatureGroup` `removeLayer` would unbind popups of removed layers even if the popups were not put by the group (affected [Leaflet.markercluster](https://github.com/danzel/Leaflet.markercluster) plugin) (by [@danzel](https://github.com/danzel)). [#861](https://github.com/Leaflet/Leaflet/pull/861) - -## 0.4.1 (2012-07-31) - - * Fixed a bug that caused marker shadows appear as opaque black in IE6-8. [#850](https://github.com/Leaflet/Leaflet/issues/850) - * Fixed a bug with incorrect calculation of scale by the scale control. [#852](https://github.com/Leaflet/Leaflet/issues/852) - * Fixed broken L.tileLayer.wms class factory (by [@mattcurrie](https://github.com/mattcurrie)). [#856](https://github.com/Leaflet/Leaflet/issues/856) - * Improved retina detection for `TileLayer` `detectRetina` option (by [@sxua](https://github.com/sxua)). [#854](https://github.com/Leaflet/Leaflet/issues/854) - -## 0.4 (2012-07-30) - -### API simplification - -Leaflet 0.4 contains several API improvements that allow simpler, jQuery-like syntax ([example](https://gist.github.com/3038879)) while being backwards compatible with the previous approach (so you can use both styles): - - * Improved most methods and options to accept `LatLng`, `LatLngBounds`, `Point` and `Bounds` values in an array form (e.g. `map.panTo([lat, lng])` will be the same as `map.panTo(new L.LatLng(lat, lng))`) - * Added `addTo` method to all layer classes, e.g. `marker.addTo(map)` is equivalent to `map.addLayer(marker)` - * Added factory methods to most classes to be able to write code without `new` keyword, named the same as classes but starting with a lowercase letter, e.g. `L.map('map')` is the same as `new L.Map('map')` - -### Notable new features - - * Added configurable **panning inertia** - after a quick pan, the map slows down in the same direction. - * Added **keyboard navigation** for panning/zooming with keyboard arrows and +/- keys (by [@ericmmartinez](https://github.com/ericmmartinez)). [#663](https://github.com/Leaflet/Leaflet/pull/663) [#646](https://github.com/Leaflet/Leaflet/issues/646) - * Added smooth **zoom animation of markers, vector layers, image overlays and popups** (by [@danzel](https://github.com/danzel)). [#740](https://github.com/Leaflet/Leaflet/pull/740) [#758](https://github.com/Leaflet/Leaflet/issues/758) - * Added **Android 4+ pinch-zoom** support (by [@danzel](https://github.com/danzel)). [#774](https://github.com/Leaflet/Leaflet/pull/774) - * Added **polyline and polygon editing**. [#174](https://github.com/Leaflet/Leaflet/issues/174) - * Added an unobtrusive **scale control**. - * Added **DivIcon** class that easily allows you to create lightweight div-based markers. - * Added **Rectangle** vector layer (by [@JasonSanford](https://github.com/JasonSanford)). [#504](https://github.com/Leaflet/Leaflet/pull/504) - -### Improvements - -#### Usability improvements - - * Improved zooming so that you don't get a blank map when you zoom in or out twice quickly (by [@danzel](https://github.com/danzel)). [#7](https://github.com/Leaflet/Leaflet/issues/7) [#729](https://github.com/Leaflet/Leaflet/pull/729) - * Drag-panning now works even when there are markers in the starting point (helps on maps with lots of markers). [#506](https://github.com/Leaflet/Leaflet/issues/506) - * Improved panning performance even more (there are no wasted frames now). - * Improved pinch-zoom performance in mobile Chrome and Firefox. - * Improved map performance on window resize. - * Replaced box-shadow with border on controls for mobile devices to improve performance. - * Slightly improved default popup styling. - * Added `TileLayer` `detectRetina` option (`false` by default) that makes tiles show in a higher resolution on iOS retina displays (by [@Mithgol](https://github.com/Mithgol)). [#586](https://github.com/Leaflet/Leaflet/pull/586) - -#### GeoJSON API changes - -GeoJSON API was improved to be simpler and more flexible ([example](https://gist.github.com/3062900)). The changes are not backwards-compatible, so be sure to update your old code. - - * Added `style` option for styling vector layers, passed either as an object or as a function (to style vector layers according to GeoJSON properties). - * Added `filter` option to leave out features that don't correspond to a certain criteria (e.g. based on properties). - * Added `onEachFeature` option to execute certain code on each feature layer based on its properties (binding popups, etc). - * Changed `pointToLayer` function signature to provide `geojson` in addition to `latlng` when creating point features for more flexibility. - -#### Icon API changes - -Icon API was improved to be more flexible, but one of the changes is backwards-incompatible: you now need to pass different icon properties (like `iconUrl`) inside an options object ([example](https://gist.github.com/3076084)). - - * Converted `Icon` properties to options, changed constructor signature to `Icon(options)`. - * Moved default marker icon options to `L.Icon.Default` class (which extends from `L.Icon`). - * Added `Icon` `className` option to assign a custom class to an icon. - * Added `Icon` `shadowAnchor` option to set the anchor of the shadow. - * Made all `Icon` options except `iconUrl` optional (if not specified, they'll be chosen automatically or implemented using CSS). Anchor is centered by default (if size is specified), and otherwise can be set through CSS using negative margins. - -#### Control API changes - - * Added `setPosition` and `getPosition` to all controls, as well as ability to pass certain position as an option when creating a control. - * Made controls implementation easier (now more magic happens under the hood). - * Replaced ugly control position constants (e.g. `L.Control.Position.TOP_LEFT`) with light strings (`'topleft'`, `'bottomright'`, etc.) - -#### Other breaking API changes - - * Improved `TileLayer` constructor to interpolate URL template values from options (removed third `urlParams` argument). - * Changed `TileLayer` `scheme: 'tms'` option to `tms: true`. - * Removed `Map` `locateAndSetView` method (use `locate` with `setView: true` option) - * Changed popup `minWidth` and `maxWidth` options to be applied to content element, not the whole popup. - * Moved `prefix` argument to `options` in `Control.Attribution` constructor. - * Renamed `L.VERSION` to `L.version`. - -#### Other API improvements - - * Improved `on` and `off` methods to also accept `(eventHash[, context])`, as well as multiple space-separated events (by [@Guiswa](https://github.com/Guiswa)). [#770](https://github.com/Leaflet/Leaflet/pull/770) - * Improved `off` to remove all listeners of the event if no function was specified (by [@Guiswa](https://github.com/Guiswa)). [#770](https://github.com/Leaflet/Leaflet/pull/770) [#691](https://github.com/Leaflet/Leaflet/issues/691) - * Added `TileLayer` `setZIndex` method for controlling the order of tile layers (thanks to [@mattcurrie](https://github.com/mattcurrie)). [#837](https://github.com/Leaflet/Leaflet/pull/837) - * Added `Control.Layers` `autoZIndex` option (on by default) to preserve the order of tile layers when switching. - * Added `TileLayer` `redraw` method for re-requesting tiles (by [@greeninfo](https://github.com/greeninfo)). [#719](https://github.com/Leaflet/Leaflet/issues/719) - * Added `TileLayer` `setUrl` method for dynamically changing the tile URL template. - * Added `bringToFront` and `bringToBack` methods to `TileLayer`, `ImageOverlay` and vector layers. [#185](https://github.com/Leaflet/Leaflet/issues/185) [#505](https://github.com/Leaflet/Leaflet/issues/505) - * Added `TileLayer` `loading` event that fires when its tiles start to load (thanks to [@lapinos03](https://github.com/lapinos03)). [#177](https://github.com/Leaflet/Leaflet/issues/177) - * Added `TileLayer.WMS` `setParams` method for setting WMS parameters at runtime (by [@greeninfo](https://github.com/greeninfo)). [#719](https://github.com/Leaflet/Leaflet/issues/719) - * Added `TileLayer.WMS` subdomain support (`{s}` in the url) (by [@greeninfo](https://github.com/greeninfo)). [#735](https://github.com/Leaflet/Leaflet/issues/735) - * Added `originalEvent` property to `MouseEvent` (by [@k4](https://github.com/k4)). [#521](https://github.com/Leaflet/Leaflet/pull/521) - * Added `containerPoint` property to `MouseEvent`. [#413](https://github.com/Leaflet/Leaflet/issues/413) - * Added `contextmenu` event to vector layers (by [@ErrorProne](https://github.com/ErrorProne)). [#500](https://github.com/Leaflet/Leaflet/pull/500) - * Added `LayerGroup` `eachLayer` method for iterating over its members. - * Added `FeatureGroup` `mousemove` and `contextmenu` events (by [@jacobtoye](https://github.com/jacobtoye)). [#816](https://github.com/Leaflet/Leaflet/pull/816) - * Added chaining to `DomEvent` methods. - * Added `on` and `off` aliases for `DomEvent` `addListener` and `removeListener` methods. - * Added `L_NO_TOUCH` global variable switch (set it before Leaflet inclusion) which disables touch detection, helpful for desktop apps built using QT. [#572](https://github.com/Leaflet/Leaflet/issues/572) - * Added `dashArray` option to vector layers for making dashed strokes (by [jacobtoye](https://github.com/jacobtoye)). [#821](https://github.com/Leaflet/Leaflet/pull/821) [#165](https://github.com/Leaflet/Leaflet/issues/165) - * Added `Circle` `getBounds` method. [#440](https://github.com/Leaflet/Leaflet/issues/440) - * Added `Circle` `getLatLng` and `getRadius` methods (by [@Guiswa](https://github.com/Guiswa)). [#655](https://github.com/Leaflet/Leaflet/pull/655) - * Added `openPopup` method to all vector layers. [#246](https://github.com/Leaflet/Leaflet/issues/246) - * Added public `redraw` method to vector layers (useful if you manipulate their `LatLng` points directly). - * Added `Marker` `opacity` option and `setOpacity` method. - * Added `Marker` `update` method. [#392](https://github.com/Leaflet/Leaflet/issues/392) - * Improved `Marker` `openPopup` not to raise an error if it doesn't have a popup. [#507](https://github.com/Leaflet/Leaflet/issues/507) - * Added `ImageOverlay` `opacity` option and `setOpacity` method. [#438](https://github.com/Leaflet/Leaflet/issues/438) - * Added `Popup` `maxHeight` option that makes content inside the popup scrolled if it doesn't fit the specified max height. - * Added `Popup` `openOn(map)` method (similar to `Map` `openPopup`). - * Added `Map` `getContainer` method (by [@Guiswa](https://github.com/Guiswa)). [#654](https://github.com/Leaflet/Leaflet/pull/654) - * Added `Map` `containerPointToLatLng` and `latLngToContainerPoint` methods. [#474](https://github.com/Leaflet/Leaflet/issues/474) - * Added `Map` `addHandler` method. - * Added `Map` `mouseup` and `autopanstart` events. - * Added `LatLngBounds` `pad` method that returns bounds extended by a percentage (by [@jacobtoye](https://github.com/jacobtoye)). [#492](https://github.com/Leaflet/Leaflet/pull/492) - * Moved dragging cursor styles from JS code to CSS. - -### Bug fixes - -#### General bugfixes - - * Fixed a bug where the map was zooming incorrectly inside a `position: fixed` container (by [@chx007](https://github.com/chx007)). [#602](https://github.com/Leaflet/Leaflet/pull/602) - * Fixed a bug where scaled tiles weren't cleared up after zoom in some cases (by [@cfis](https://github.com/cfis)) [#683](https://github.com/Leaflet/Leaflet/pull/683) - * Fixed a bug where map wouldn't drag over a polygon with a `mousedown` listener. [#834](https://github.com/Leaflet/Leaflet/issues/834) - -#### API bugfixes - - * Fixed a regression where removeLayer would not remove corresponding attribution. [#488](https://github.com/Leaflet/Leaflet/issues/488) - * Fixed a bug where popup close button wouldn't work on manually added popups. [#423](https://github.com/Leaflet/Leaflet/issues/423) - * Fixed a bug where marker click event would stop working if you dragged it and then disabled dragging. [#434](https://github.com/Leaflet/Leaflet/issues/434) - * Fixed a bug where `TileLayer` `setOpacity` wouldn't work when setting it back to 1. - * Fixed a bug where vector layer `setStyle({stroke: false})` wouldn't remove stroke and the same for fill. [#441](https://github.com/Leaflet/Leaflet/issues/441) - * Fixed a bug where `Marker` `bindPopup` method wouldn't take `offset` option into account. - * Fixed a bug where `TileLayer` `load` event wasn't fired if some tile didn't load (by [@lapinos03](https://github.com/lapinos03) and [@cfis](https://github.com/cfis)) [#682](https://github.com/Leaflet/Leaflet/pull/682) - * Fixed error when removing `GeoJSON` layer. [#685](https://github.com/Leaflet/Leaflet/issues/685) - * Fixed error when calling `GeoJSON` `clearLayer` (by [@runderwood](https://github.com/runderwood)). [#617](https://github.com/Leaflet/Leaflet/pull/617) - * Fixed a bug where `Control` `setPosition` wasn't always working correctly (by [@ericmmartinez](https://github.com/ericmmartinez)). [#657](https://github.com/Leaflet/Leaflet/pull/657) - * Fixed a bug with `Util.bind` sometimes losing arguments (by [@johtso](https://github.com/johtso)). [#588](https://github.com/Leaflet/Leaflet/pull/588) - * Fixed a bug where `drag` event was sometimes fired after `dragend`. [#555](https://github.com/Leaflet/Leaflet/issues/555) - * Fixed a bug where `TileLayer` `load` event was firing only once (by [@lapinos03](https://github.com/lapinos03) and [shintonik](https://github.com/shintonik)). [#742](https://github.com/Leaflet/Leaflet/pull/742) [#177](https://github.com/Leaflet/Leaflet/issues/177) - * Fixed a bug where `FeatureGroup` popup events where not cleaned up after removing a layer from it (by [@danzel](https://github.com/danzel)). [#775](https://github.com/Leaflet/Leaflet/pull/775) - * Fixed a bug where `DomUtil.removeClass` didn't remove trailing spaces (by [@jieter](https://github.com/jieter)). [#784](https://github.com/Leaflet/Leaflet/pull/784) - * Fixed a bug where marker popup didn't take popup offset into account. - * Fixed a bug that led to an error when polyline was removed inside a `moveend` listener. - * Fixed a bug where `LayerGroup` `addLayer` wouldn't check if a layer has already been added (by [@danzel](https://github.com/danzel)). [798](https://github.com/Leaflet/Leaflet/pull/798) - -#### Browser bugfixes - - * Fixed broken zooming on IE10 beta (by [@danzel](https://github.com/danzel)). [#650](https://github.com/Leaflet/Leaflet/issues/650) [#751](https://github.com/Leaflet/Leaflet/pull/751) - * Fixed a bug that broke Leaflet for websites that had XHTML content-type header set (by [lars-sh](https://github.com/lars-sh)). [#801](https://github.com/Leaflet/Leaflet/pull/801) - * Fixed a bug that caused popups to be empty in IE when passing a DOM node as the content (by [@nrenner](https://github.com/nrenner)). [#472](https://github.com/Leaflet/Leaflet/pull/472) - * Fixed inability to use scrolled content inside popup due to mouse wheel propagation. - * Fixed a bug that caused jumping/stuttering of panning animation in some cases. - * Fixed a bug where popup size was calculated incorrectly in IE. - * Fixed a bug where cursor would flicker when dragging a marker. - * Fixed a bug where clickable paths on IE9 didn't have a hand cursor (by [naehrstoff](https://github.com/naehrstoff)). [#671](https://github.com/Leaflet/Leaflet/pull/671) - * Fixed a bug in IE with disappearing icons when changing opacity (by [@tagliala](https://github.com/tagliala) and [DamonOehlman](https://github.com/DamonOehlman)). [#667](https://github.com/Leaflet/Leaflet/pull/667) [#600](https://github.com/Leaflet/Leaflet/pull/600) - * Fixed a bug with setting opacity on IE10 (by [@danzel](https://github.com/danzel)). [796](https://github.com/Leaflet/Leaflet/pull/796) - * Fixed a bug where `Control.Layers` didn't work on IE7. [#652](https://github.com/Leaflet/Leaflet/issues/652) - * Fixed a bug that could cause false `mousemove` events on click in Chrome (by [@stsydow](https://github.com/stsydow)). [#757](https://github.com/Leaflet/Leaflet/pull/757) - * Fixed a bug in IE6-8 where adding fill or stroke on vector layers after initialization with `setStyle` would break the map. [#641](https://github.com/Leaflet/Leaflet/issues/641) - * Fixed a bug with setOpacity in IE where it would not work correctly if used more than once on the same element (by [@ajbeaven](https://github.com/ajbeaven)). [#827](https://github.com/Leaflet/Leaflet/pull/827) - * Fixed a bug in Chrome where transparent control corners sometimes couldn't be clicked through (by [@danzel](https://github.com/danzel)). [#836](https://github.com/Leaflet/Leaflet/pull/836) [#575](https://github.com/Leaflet/Leaflet/issues/575) - -#### Mobile browser bugfixes - - * Fixed a bug that sometimes caused map to disappear completely after zoom on iOS (by [@fr1n63](https://github.com/fr1n63)). [#580](https://github.com/Leaflet/Leaflet/issues/580) [#777](https://github.com/Leaflet/Leaflet/pull/777) - * Fixed a bug that often caused vector layers to flicker on drag end on iOS (by [@krawaller](https://github.com/krawaller)). [#18](https://github.com/Leaflet/Leaflet/issues/18) - * Fixed a bug with false map click events on pinch-zoom and zoom/layers controls click. [#485](https://github.com/Leaflet/Leaflet/issues/485) - * Fixed a bug where touching the map with two or more fingers simultaneously would raise an error. - * Fixed a bug where zoom control wasn't always visible on Android 3. [#335](https://github.com/Leaflet/Leaflet/issues/335) - * Fixed a bug where opening the layers control would propagate a click to the map (by [@jacobtoye](https://github.com/jacobtoye)). [#638](https://github.com/Leaflet/Leaflet/pull/638) - * Fixed a bug where `ImageOverlay` wouldn't stretch properly on zoom on Android 2. [#651](https://github.com/Leaflet/Leaflet/issues/651) - * Fixed a bug where `clearLayers` for vector layers on a Canvas backend (e.g. on Android 2) would take unreasonable amount of time. [#785](https://github.com/Leaflet/Leaflet/issues/785) - * Fixed a bug where `setLatLngs` and similar methods on vector layers on a Canvas backend would not update the layers immediately. [#732](https://github.com/Leaflet/Leaflet/issues/732) - -## 0.3.1 (2012-02-14) - - * Fixed a regression where default marker icons wouldn't work if Leaflet include url contained a query string. - * Fixed a regression where tiles sometimes flickered with black on panning in iOS. - -## 0.3 (2012-02-13) - -### Major features - - * Added **Canvas backend** for vector layers (polylines, polygons, circles). This enables vector support on Android < 3, and it can also be optionally preferred over SVG for a performance gain in some cases. Thanks to [@florianf](https://github.com/florianf) for a big part of this work. - * Added **layers control** (`Control.Layers`) for convenient layer switching. - * Added ability to set **max bounds** within which users can pan/zoom. [#93](https://github.com/Leaflet/Leaflet/issues/93) - -### Improvements - -#### Usability improvements - - * Map now preserves its center after resize. - * When panning to another copy of the world (that's infinite horizontally), map overlays now jump to corresponding positions. [#273](https://github.com/Leaflet/Leaflet/issues/273) - * Limited maximum zoom change on a single mouse wheel movement (so you won't zoom across the whole zoom range in one scroll). [#149](https://github.com/Leaflet/Leaflet/issues/149) - * Significantly improved line simplification performance (noticeable when rendering polylines/polygons with tens of thousands of points) - * Improved circles performance by not drawing them if they're off the clip region. - * Improved stability of zoom animation (less flickering of tiles). - -#### API improvements - - * Added ability to add a tile layer below all others (`map.addLayer(layer, true)`) (useful for switching base tile layers). - * Added `Map` `zoomstart` event (thanks to [@Fabiz](https://github.com/Fabiz)). [#377](https://github.com/Leaflet/Leaflet/pull/377) - * Improved `Map` `locate` method, added ability to watch location continuously and more options. [#212](https://github.com/Leaflet/Leaflet/issues/212) - * Added second argument `inside` to `Map` `getBoundsZoom` method that allows you to get appropriate zoom for the view to fit *inside* the given bounds. - * Added `hasLayer` method to `Map`. - * Added `Marker` `zIndexOffset` option to be able to set certain markers below/above others. [#65](https://github.com/Leaflet/Leaflet/issues/65) - * Added `urlParams` third optional argument to `TileLayer` constructor for convenience: an object with properties that will be evaluated in the URL template. - * Added `TileLayer` `continuousWorld` option to disable tile coordinates checking/wrapping. - * Added `TileLayer` `tileunload` event fired when tile gets removed after panning (by [@CodeJosch](https://github.com/CodeJosch)). [#256](https://github.com/Leaflet/Leaflet/pull/256) - * Added `TileLayer` `zoomOffset` option useful for non-256px tiles (by [@msaspence](https://github.com/msaspence)). - * Added `TileLayer` `zoomReverse` option to reverse zoom numbering (by [@Majiir](https://github.com/Majiir)). [#406](https://github.com/Leaflet/Leaflet/pull/406) - * Added `TileLayer.Canvas` `redraw` method (by [@mortenbekditlevsen](https://github.com/mortenbekditlevsen)). [#459](https://github.com/Leaflet/Leaflet/pull/459) - * Added `Polyline` `closestLayerPoint` method that's can be useful for interaction features (by [@anru](https://github.com/anru)). [#186](https://github.com/Leaflet/Leaflet/pull/186) - * Added `setLatLngs` method to `MultiPolyline` and `MultiPolygon` (by [@anru](https://github.com/anru)). [#194](https://github.com/Leaflet/Leaflet/pull/194) - * Added `getBounds` method to `Polyline` and `Polygon` (by [@JasonSanford](https://github.com/JasonSanford)). [#253](https://github.com/Leaflet/Leaflet/pull/253) - * Added `getBounds` method to `FeatureGroup` (by [@JasonSanford](https://github.com/JasonSanford)). [#557](https://github.com/Leaflet/Leaflet/pull/557) - * Added `FeatureGroup` `setStyle` method (also inherited by `MultiPolyline` and `MultiPolygon`). [#353](https://github.com/Leaflet/Leaflet/issues/353) - * Added `FeatureGroup` `invoke` method to call a particular method on all layers of the group with the given arguments. - * Added `ImageOverlay` `load` event. [#213](https://github.com/Leaflet/Leaflet/issues/213) - * Added `minWidth` option to `Popup` (by [@marphi](https://github.com/marphi)). [#214](https://github.com/Leaflet/Leaflet/pull/214) - * Improved `LatLng` constructor to be more tolerant (and throw descriptive error if latitude or longitude can't be interpreted as a number). [#136](https://github.com/Leaflet/Leaflet/issues/136) - * Added `LatLng` `distanceTo` method (great circle distance) (by [@mortenbekditlevsen](https://github.com/mortenbekditlevsen)). [#462](https://github.com/Leaflet/Leaflet/pull/462) - * Added `LatLngBounds` `toBBoxString` method for convenience (by [@JasonSanford](https://github.com/JasonSanford)). [#263](https://github.com/Leaflet/Leaflet/pull/263) - * Added `LatLngBounds` `intersects(otherBounds)` method (thanks to [@pagameba](https://github.com/pagameba)). [#350](https://github.com/Leaflet/Leaflet/pull/350) - * Made `LatLngBounds` `extend` method to accept other `LatLngBounds` in addition to `LatLng` (by [@JasonSanford](https://github.com/JasonSanford)). [#553](https://github.com/Leaflet/Leaflet/pull/553) - * Added `Bounds` `intersects(otherBounds)` method. [#461](https://github.com/Leaflet/Leaflet/issues/461) - * Added `L.Util.template` method for simple string template evaluation. - * Added `DomUtil.removeClass` method (by [@anru](https://github.com/anru)). - * Improved browser-specific code to rely more on feature detection rather than user agent string. - * Improved superclass access mechanism to work with inheritance chains of 3 or more classes; now you should use `Klass.superclass` instead of `this.superclass` (by [@anru](https://github.com/anru)). [#179](https://github.com/Leaflet/Leaflet/pull/179) - * Added `Map` `boxzoomstart` and `boxzoomend` events (by [@zedd45](https://github.com/zedd45)). [#554](https://github.com/Leaflet/Leaflet/pull/554) - * Added `Popup` `contentupdate` event (by [@mehmeta](https://github.com/mehmeta)). [#548](https://github.com/Leaflet/Leaflet/pull/548) - -#### Breaking API changes - - * `shiftDragZoom` map option/property renamed to `boxZoom`. - * Removed `mouseEventToLatLng` method (bringed back in 0.4). - -#### Development workflow improvements - - * Build system completely overhauled to be based on Node.js, Jake, JSHint and UglifyJS. - * All code is now linted for errors and conformity with a strict code style (with JSHint), and wont build unless the check passes. - -### Bugfixes - -#### General bugfixes - - * Fixed a bug where `Circle` was rendered with incorrect radius (didn't take projection exagerration into account). [#331](https://github.com/Leaflet/Leaflet/issues/331) - * Fixed a bug where `Map` `getBounds` would work incorrectly on a date line cross. [#295](https://github.com/Leaflet/Leaflet/issues/295) - * Fixed a bug where polygons and polylines sometimes rendered incorrectly on some zoom levels. [#381](https://github.com/Leaflet/Leaflet/issues/381) - * Fixed a bug where fast mouse wheel zoom worked incorrectly when approaching min/max zoom values. - * Fixed a bug where `GeoJSON` `pointToLayer` option wouldn't work in a `GeometryCollection`. [#391](https://github.com/Leaflet/Leaflet/issues/391) - * Fixed a bug with incorrect rendering of GeoJSON on a date line cross. [#354](https://github.com/Leaflet/Leaflet/issues/354) - * Fixed a bug where map panning would stuck forever after releasing the mouse over an iframe or a flash object (thanks to [@sten82](https://github.com/sten82)). [#297](https://github.com/Leaflet/Leaflet/pull/297) [#64](https://github.com/Leaflet/Leaflet/issues/64) - * Fixed a bug where mouse wheel zoom worked incorrectly if map is inside scrolled container (partially by [@chrillo](https://github.com/chrillo)). [#206](https://github.com/Leaflet/Leaflet/issues/206) - * Fixed a bug where it was possible to add the same listener twice. [#281](https://github.com/Leaflet/Leaflet/issues/281) - * Fixed a bug where `Circle` was rendered with incorrect radius (didn't take projection exaggeration into account). [#331](https://github.com/Leaflet/Leaflet/issues/331) - * Fixed a bug where `Marker` `setIcon` was not working properly (by [@marphi](https://github.com/marphi)). [#218](https://github.com/Leaflet/Leaflet/pull/218) [#311](https://github.com/Leaflet/Leaflet/issues/311) - * Fixed a bug where `Marker` `setLatLng` was not working if it's set before adding the marker to a map. [#222](https://github.com/Leaflet/Leaflet/issues/222) - * Fixed a bug where marker popup would not move on `Marker` `setLatLng` (by [@tjarratt](https://github.com/tjarratt)). [#272](https://github.com/Leaflet/Leaflet/pull/272) - * Fixed a bug where static properties of a child class would not override the parent ones. - * Fixed broken popup `closePopup` option (by [@jgerigmeyer](https://github.com/jgerigmeyer)). - * Fixed a bug that caused en error when dragging marker with icon without shadow (by [@anru](https://github.com/anru)). [#178](https://github.com/Leaflet/Leaflet/issues/178) - * Fixed a typo in `Bounds` `contains` method (by [@anru](https://github.com/anru)). [#180](https://github.com/Leaflet/Leaflet/pull/180) - * Fixed a bug where creating an empty `Polygon` with `new L.Polygon()` would raise an error. - * Fixed a bug where drag event fired before the actual movement of layer (by [@anru](https://github.com/anru)). [#197](https://github.com/Leaflet/Leaflet/pull/197) - * Fixed a bug where map click caused an error if dragging is initially disabled. [#196](https://github.com/Leaflet/Leaflet/issues/196) - * Fixed a bug where map `movestart` event would fire after zoom animation. - * Fixed a bug where attribution prefix would not update on `setPrefix`. [#195](https://github.com/Leaflet/Leaflet/issues/195) - * Fixed a bug where `TileLayer` `load` event wouldn't fire in some edge cases (by [@dravnic](https://github.com/dravnic)). - * Fixed a bug related to clearing background tiles after zooming (by [@neno-giscloud](https://github.com/neno-giscloud) & [@dravnic](https://github.com/dravnic)). - * Fixed a bug that sometimes caused map flickering after zoom animation. - * Fixed a bug related to cleaning up after removing tile layers (by [@dravnic](https://github.com/dravnic)). [#276](https://github.com/Leaflet/Leaflet/pull/276) - * Fixed a bug that made selecting text in the attribution control impossible. [#279](https://github.com/Leaflet/Leaflet/issues/279) - * Fixed a bug when initializing a map in a non-empty div. [#278](https://github.com/Leaflet/Leaflet/issues/278) - * Fixed a bug where `movestart` didn't fire on panning animation. - * Fixed a bug in Elliptical Mercator formula that affeted `EPSG:3395` CRS (by [@Savvkin](https://github.com/Savvkin)). [#358](https://github.com/Leaflet/Leaflet/pull/358) - -#### Browser bugfixes - - * Fixed occasional crashes on Mac Safari (thanks to [@lapinos03](https://github.com/lapinos03)). [#191](https://github.com/Leaflet/Leaflet/issues/191) - * Fixed a bug where resizing the map would sometimes make it blurry on WebKit (by [@mortenbekditlevsen](https://github.com/mortenbekditlevsen)). [#453](https://github.com/Leaflet/Leaflet/pull/453) - * Fixed a bug that raised error in IE6-8 when clicking on popup close button. [#235](https://github.com/Leaflet/Leaflet/issues/235) - * Fixed a bug with Safari not redrawing UI immediately after closing a popup. [#296](https://github.com/Leaflet/Leaflet/issues/296) - * Fixed a bug that caused performance drop and high CPU usage when calling `setView` or `panTo` to the current center. [#231](https://github.com/Leaflet/Leaflet/issues/231) - * Fixed a bug that caused map overlays to appear blurry in some cases under WebKit browsers. - * Fixed a bug that was causing errors in some Webkit/Linux builds (requestAnimationFrame-related), thanks to Chris Martens. - -#### Mobile browser bugfixes - - * Fixed a bug that caused an error when clicking vector layers under iOS. [#204](https://github.com/Leaflet/Leaflet/issues/204) - * Fixed crash on Android 3+ when panning or zooming (by [@florian](https://github.com/florianf)). [#137](https://github.com/Leaflet/Leaflet/issues/137) - * Fixed a bug on Android 2/3 that sometimes caused the map to disappear after zooming. [#69](https://github.com/Leaflet/Leaflet/issues/69) - * Fixed a bug on Android 3 that caused tiles to shift position on a big map. - * Fixed a bug that caused the map to pan when touch-panning inside a popup. [#452](https://github.com/Leaflet/Leaflet/issues/452) - * Fixed a bug that caused click delays on zoom control. - - -## 0.2.1 (2011-06-18) - - * Fixed regression that caused error in `TileLayer.Canvas`. - -## 0.2 (2011-06-17) - -### Major features - - * Added **WMS** support (`TileLayer.WMS` layer). - * Added different **projections** support, having `EPSG:3857`, `EPSG:4326` and `EPSG:3395` out of the box (through `crs` option in `Map`). Thanks to [@Miroff](https://github.com/Miroff) & [@Komzpa](https://github.com/Komzpa) for great advice and explanation regarding this. - * Added **GeoJSON** layer support. - -### Improvements - -#### Usability improvements - - * Improved panning performance in Chrome and FF considerably with the help of `requestAnimationFrame`. [#130](https://github.com/Leaflet/Leaflet/issues/130) - * Improved click responsiveness in mobile WebKit (now it happens without delay). [#26](https://github.com/Leaflet/Leaflet/issues/26) - * Added tap tolerance (so click happens even if you moved your finger slighly when tapping). - * Improved geolocation error handling: better error messages, explicit timeout, set world view on locateAndSetView failure. [#61](https://github.com/Leaflet/Leaflet/issues/61) - -#### API improvements - - * Added **MultiPolyline** and **MultiPolygon** layers. [#77](https://github.com/Leaflet/Leaflet/issues/77) - * Added **LayerGroup** and **FeatureGroup** layers for grouping other layers. - * Added **TileLayer.Canvas** for easy creation of canvas-based tile layers. - * Changed `Circle` to be zoom-dependent (with radius in meters); circle of a permanent size is now called `CircleMarker`. - * Added `mouseover` and `mouseout` events to map, markers and paths; added map `mousemove` event. - * Added `setLatLngs`, `spliceLatLngs`, `addLatLng`, `getLatLngs` methods to polylines and polygons. - * Added `setLatLng` and `setRadius` methods to `Circle` and `CircleMarker`. - * Improved `LatLngBounds contains` method to accept `LatLng` in addition to `LatLngBounds`, the same for `Bounds contains` and `Point` - * Improved `LatLngBounds` & `Bounds` to allow their instantiation without arguments (by [@snc](https://github.com/snc)). - * Added TMS tile numbering support through `TileLayer` `scheme: 'tms'` option (by [@tmcw](https://github.com/tmcw)). - * Added `TileLayer` `noWrap` option to disable wrapping `x` tile coordinate (by [@jasondavies](https://github.com/jasondavies)). - * Added `opacity` option and `setOpacity` method to `TileLayer`. - * Added `setLatLng` and `setIcon` methods to `Marker`. - * Added `title` option to `Marker`. - * Added `maxZoom` argument to `map.locateAndSetView` method. - * Added ability to pass Geolocation options to map `locate` and `locateAndSetView` methods (by [@JasonSanford](https://github.com/JasonSanford)). - * Improved `Popup` to accept HTML elements in addition to strings as its content. - -#### Development workflow improvements - - * Added `Makefile` for building `leaflet.js` on non-Windows machines (by [@tmcw](https://github.com/tmcw)). - * Improved `debug/leaflet-include.js` script to allow using it outside of `debug` folder (by [@antonj](https://github.com/antonj)). - * Improved `L` definition to be compatible with CommonJS. [#122](https://github.com/Leaflet/Leaflet/issues/122) - -### Bug fixes - -#### General bugfixes - - * Fixed a bug where zooming is broken if the map contains a polygon and you zoom to an area where it's not visible. [#47](https://github.com/Leaflet/Leaflet/issues/47) - * Fixed a bug where closed polylines would not appear on the map. - * Fixed a bug where marker that was added, removed and then added again would not appear on the map. [#66](https://github.com/Leaflet/Leaflet/issues/66) - * Fixed a bug where tile layer that was added, removed and then added again would not appear on the map. - * Fixed a bug where some tiles would not load when panning across the date line. [#97](https://github.com/Leaflet/Leaflet/issues/97) - * Fixed a bug where map div with `position: absolute` is reset to `relative`. [#100](https://github.com/Leaflet/Leaflet/issues/100) - * Fixed a bug that caused an error when trying to add a marker without shadow in its icon. - * Fixed a bug where popup content would not update on `setContent` call. [#94](https://github.com/Leaflet/Leaflet/issues/94) - * Fixed a bug where double click zoom wouldn't work if popup is opened on map click - * Fixed a bug with click propagation on popup close button. [#99](https://github.com/Leaflet/Leaflet/issues/99) - * Fixed inability to remove ImageOverlay layer. - -#### Browser bugfixes - - * Fixed a bug where paths would not appear in IE8. - * Fixed a bug where there were occasional slowdowns before zoom animation in WebKit. [#123](https://github.com/Leaflet/Leaflet/issues/123) - * Fixed incorrect zoom animation & popup styling in Opera 11.11. - * Fixed popup fade animation in Firefox and Opera. - * Fixed a bug where map isn't displayed in Firefox when there's an `img { max-width: 100% }` rule. - -#### Mobile browsers bugfixes - - * Fixed a bug that prevented panning on some Android 2.1 (and possibly older) devices. [#84](https://github.com/Leaflet/Leaflet/issues/84) - * Disabled zoom animation on Android by default because it's buggy on some devices (will be enabled back when it's stable enough). [#32](https://github.com/Leaflet/Leaflet/issues/32) - * Fixed a bug where map would occasionally break while multi-touch-zooming on iOS. [#32](https://github.com/Leaflet/Leaflet/issues/32) - * Fixed a bug that prevented panning/clicking on Android 3 tablets. [#121](https://github.com/Leaflet/Leaflet/issues/121) - * Fixed a bug that prevented panning/clicking on Opera Mobile. [#138](https://github.com/Leaflet/Leaflet/issues/138) - * Fixed potentional memory leak on WebKit when removing tiles, thanks to [@Scalar4eg](https://github.com/Scalar4eg). [#107](https://github.com/Leaflet/Leaflet/issues/107) - -## 0.1 (2011-05-13) - -Initial Leaflet release. diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/leaflet/LICENSE b/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/leaflet/LICENSE deleted file mode 100755 index 8410ae638..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/leaflet/LICENSE +++ /dev/null @@ -1,23 +0,0 @@ -Copyright (c) 2010-2018, Vladimir Agafonkin -Copyright (c) 2010-2011, CloudMade -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are -permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, this list of - conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, this list - of conditions and the following disclaimer in the documentation and/or other materials - provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY -EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR -TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/leaflet/README.md b/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/leaflet/README.md deleted file mode 100755 index a49b5b579..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/leaflet/README.md +++ /dev/null @@ -1,32 +0,0 @@ -Leaflet - -Leaflet is the leading open-source JavaScript library for **mobile-friendly interactive maps**. -Weighing just about 37 KB of gzipped JS code, it has all the mapping [features][] most developers ever need. - -Leaflet is designed with *simplicity*, *performance* and *usability* in mind. -It works efficiently across all major desktop and mobile platforms out of the box, -taking advantage of HTML5 and CSS3 on modern browsers while being accessible on older ones too. -It can be extended with a huge amount of [plugins][], -has a beautiful, easy to use and [well-documented][] API -and a simple, readable [source code][] that is a joy to [contribute][] to. - -For more info, docs and tutorials, check out the [official website][].
    -For **Leaflet downloads** (including the built master version), check out the [download page][]. - -We're happy to meet new contributors. -If you want to **get involved** with Leaflet development, check out the [contribution guide][contribute]. -Let's make the best mapping library that will ever exist, -and push the limits of what's possible with online maps! - -[![Build Status](https://travis-ci.org/Leaflet/Leaflet.svg?branch=master)](https://travis-ci.org/Leaflet/Leaflet) - - [contributors]: https://github.com/Leaflet/Leaflet/graphs/contributors - [features]: http://leafletjs.com/#features - [plugins]: http://leafletjs.com/plugins.html - [well-documented]: http://leafletjs.com/reference.html "Leaflet API reference" - [source code]: https://github.com/Leaflet/Leaflet "Leaflet GitHub repository" - [hosted on GitHub]: http://github.com/Leaflet/Leaflet - [contribute]: https://github.com/Leaflet/Leaflet/blob/master/CONTRIBUTING.md "A guide to contributing to Leaflet" - [official website]: http://leafletjs.com - [download page]: http://leafletjs.com/download.html - diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/leaflet/dist/images/layers-2x.png b/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/leaflet/dist/images/layers-2x.png deleted file mode 100755 index 200c333dc..000000000 Binary files a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/leaflet/dist/images/layers-2x.png and /dev/null differ diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/leaflet/dist/images/layers.png b/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/leaflet/dist/images/layers.png deleted file mode 100755 index 1a72e5784..000000000 Binary files a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/leaflet/dist/images/layers.png and /dev/null differ diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/leaflet/dist/images/marker-icon-2x.png b/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/leaflet/dist/images/marker-icon-2x.png deleted file mode 100755 index 88f9e5018..000000000 Binary files a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/leaflet/dist/images/marker-icon-2x.png and /dev/null differ diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/leaflet/dist/images/marker-icon.png b/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/leaflet/dist/images/marker-icon.png deleted file mode 100755 index 950edf246..000000000 Binary files a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/leaflet/dist/images/marker-icon.png and /dev/null differ diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/leaflet/dist/images/marker-shadow.png b/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/leaflet/dist/images/marker-shadow.png deleted file mode 100755 index 9fd297953..000000000 Binary files a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/leaflet/dist/images/marker-shadow.png and /dev/null differ diff --git a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/leaflet/dist/leaflet-src.esm.js b/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/leaflet/dist/leaflet-src.esm.js deleted file mode 100755 index da909c7d4..000000000 --- a/qt6-after/qt6-migrated-legatus/Lts/Tools/ArAssetsV2/node_modules/leaflet/dist/leaflet-src.esm.js +++ /dev/null @@ -1,13838 +0,0 @@ -/* @preserve - * Leaflet 1.4.0, a JS library for interactive maps. http://leafletjs.com - * (c) 2010-2018 Vladimir Agafonkin, (c) 2010-2011 CloudMade - */ - -var version = "1.4.0"; - -/* - * @namespace Util - * - * Various utility functions, used by Leaflet internally. - */ - -var freeze = Object.freeze; -Object.freeze = function (obj) { return obj; }; - -// @function extend(dest: Object, src?: Object): Object -// Merges the properties of the `src` object (or multiple objects) into `dest` object and returns the latter. Has an `L.extend` shortcut. -function extend(dest) { - var i, j, len, src; - - for (j = 1, len = arguments.length; j < len; j++) { - src = arguments[j]; - for (i in src) { - dest[i] = src[i]; - } - } - return dest; -} - -// @function create(proto: Object, properties?: Object): Object -// Compatibility polyfill for [Object.create](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/create) -var create = Object.create || (function () { - function F() {} - return function (proto) { - F.prototype = proto; - return new F(); - }; -})(); - -// @function bind(fn: Function, …): Function -// Returns a new function bound to the arguments passed, like [Function.prototype.bind](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function/bind). -// Has a `L.bind()` shortcut. -function bind(fn, obj) { - var slice = Array.prototype.slice; - - if (fn.bind) { - return fn.bind.apply(fn, slice.call(arguments, 1)); - } - - var args = slice.call(arguments, 2); - - return function () { - return fn.apply(obj, args.length ? args.concat(slice.call(arguments)) : arguments); - }; -} - -// @property lastId: Number -// Last unique ID used by [`stamp()`](#util-stamp) -var lastId = 0; - -// @function stamp(obj: Object): Number -// Returns the unique ID of an object, assigning it one if it doesn't have it. -function stamp(obj) { - /*eslint-disable */ - obj._leaflet_id = obj._leaflet_id || ++lastId; - return obj._leaflet_id; - /* eslint-enable */ -} - -// @function throttle(fn: Function, time: Number, context: Object): Function -// Returns a function which executes function `fn` with the given scope `context` -// (so that the `this` keyword refers to `context` inside `fn`'s code). The function -// `fn` will be called no more than one time per given amount of `time`. The arguments -// received by the bound function will be any arguments passed when binding the -// function, followed by any arguments passed when invoking the bound function. -// Has an `L.throttle` shortcut. -function throttle(fn, time, context) { - var lock, args, wrapperFn, later; - - later = function () { - // reset lock and call if queued - lock = false; - if (args) { - wrapperFn.apply(context, args); - args = false; - } - }; - - wrapperFn = function () { - if (lock) { - // called too soon, queue to call later - args = arguments; - - } else { - // call and lock until later - fn.apply(context, arguments); - setTimeout(later, time); - lock = true; - } - }; - - return wrapperFn; -} - -// @function wrapNum(num: Number, range: Number[], includeMax?: Boolean): Number -// Returns the number `num` modulo `range` in such a way so it lies within -// `range[0]` and `range[1]`. The returned value will be always smaller than -// `range[1]` unless `includeMax` is set to `true`. -function wrapNum(x, range, includeMax) { - var max = range[1], - min = range[0], - d = max - min; - return x === max && includeMax ? x : ((x - min) % d + d) % d + min; -} - -// @function falseFn(): Function -// Returns a function which always returns `false`. -function falseFn() { return false; } - -// @function formatNum(num: Number, digits?: Number): Number -// Returns the number `num` rounded to `digits` decimals, or to 6 decimals by default. -function formatNum(num, digits) { - var pow = Math.pow(10, (digits === undefined ? 6 : digits)); - return Math.round(num * pow) / pow; -} - -// @function trim(str: String): String -// Compatibility polyfill for [String.prototype.trim](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String/Trim) -function trim(str) { - return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, ''); -} - -// @function splitWords(str: String): String[] -// Trims and splits the string on whitespace and returns the array of parts. -function splitWords(str) { - return trim(str).split(/\s+/); -} - -// @function setOptions(obj: Object, options: Object): Object -// Merges the given properties to the `options` of the `obj` object, returning the resulting options. See `Class options`. Has an `L.setOptions` shortcut. -function setOptions(obj, options) { - if (!obj.hasOwnProperty('options')) { - obj.options = obj.options ? create(obj.options) : {}; - } - for (var i in options) { - obj.options[i] = options[i]; - } - return obj.options; -} - -// @function getParamString(obj: Object, existingUrl?: String, uppercase?: Boolean): String -// Converts an object into a parameter URL string, e.g. `{a: "foo", b: "bar"}` -// translates to `'?a=foo&b=bar'`. If `existingUrl` is set, the parameters will -// be appended at the end. If `uppercase` is `true`, the parameter names will -// be uppercased (e.g. `'?A=foo&B=bar'`) -function getParamString(obj, existingUrl, uppercase) { - var params = []; - for (var i in obj) { - params.push(encodeURIComponent(uppercase ? i.toUpperCase() : i) + '=' + encodeURIComponent(obj[i])); - } - return ((!existingUrl || existingUrl.indexOf('?') === -1) ? '?' : '&') + params.join('&'); -} - -var templateRe = /\{ *([\w_-]+) *\}/g; - -// @function template(str: String, data: Object): String -// Simple templating facility, accepts a template string of the form `'Hello {a}, {b}'` -// and a data object like `{a: 'foo', b: 'bar'}`, returns evaluated string -// `('Hello foo, bar')`. You can also specify functions instead of strings for -// data values — they will be evaluated passing `data` as an argument. -function template(str, data) { - return str.replace(templateRe, function (str, key) { - var value = data[key]; - - if (value === undefined) { - throw new Error('No value provided for variable ' + str); - - } else if (typeof value === 'function') { - value = value(data); - } - return value; - }); -} - -// @function isArray(obj): Boolean -// Compatibility polyfill for [Array.isArray](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray) -var isArray = Array.isArray || function (obj) { - return (Object.prototype.toString.call(obj) === '[object Array]'); -}; - -// @function indexOf(array: Array, el: Object): Number -// Compatibility polyfill for [Array.prototype.indexOf](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf) -function indexOf(array, el) { - for (var i = 0; i < array.length; i++) { - if (array[i] === el) { return i; } - } - return -1; -} - -// @property emptyImageUrl: String -// Data URI string containing a base64-encoded empty GIF image. -// Used as a hack to free memory from unused images on WebKit-powered -// mobile devices (by setting image `src` to this string). -var emptyImageUrl = 'data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs='; - -// inspired by http://paulirish.com/2011/requestanimationframe-for-smart-animating/ - -function getPrefixed(name) { - return window['webkit' + name] || window['moz' + name] || window['ms' + name]; -} - -var lastTime = 0; - -// fallback for IE 7-8 -function timeoutDefer(fn) { - var time = +new Date(), - timeToCall = Math.max(0, 16 - (time - lastTime)); - - lastTime = time + timeToCall; - return window.setTimeout(fn, timeToCall); -} - -var requestFn = window.requestAnimationFrame || getPrefixed('RequestAnimationFrame') || timeoutDefer; -var cancelFn = window.cancelAnimationFrame || getPrefixed('CancelAnimationFrame') || - getPrefixed('CancelRequestAnimationFrame') || function (id) { window.clearTimeout(id); }; - -// @function requestAnimFrame(fn: Function, context?: Object, immediate?: Boolean): Number -// Schedules `fn` to be executed when the browser repaints. `fn` is bound to -// `context` if given. When `immediate` is set, `fn` is called immediately if -// the browser doesn't have native support for -// [`window.requestAnimationFrame`](https://developer.mozilla.org/docs/Web/API/window/requestAnimationFrame), -// otherwise it's delayed. Returns a request ID that can be used to cancel the request. -function requestAnimFrame(fn, context, immediate) { - if (immediate && requestFn === timeoutDefer) { - fn.call(context); - } else { - return requestFn.call(window, bind(fn, context)); - } -} - -// @function cancelAnimFrame(id: Number): undefined -// Cancels a previous `requestAnimFrame`. See also [window.cancelAnimationFrame](https://developer.mozilla.org/docs/Web/API/window/cancelAnimationFrame). -function cancelAnimFrame(id) { - if (id) { - cancelFn.call(window, id); - } -} - - -var Util = (Object.freeze || Object)({ - freeze: freeze, - extend: extend, - create: create, - bind: bind, - lastId: lastId, - stamp: stamp, - throttle: throttle, - wrapNum: wrapNum, - falseFn: falseFn, - formatNum: formatNum, - trim: trim, - splitWords: splitWords, - setOptions: setOptions, - getParamString: getParamString, - template: template, - isArray: isArray, - indexOf: indexOf, - emptyImageUrl: emptyImageUrl, - requestFn: requestFn, - cancelFn: cancelFn, - requestAnimFrame: requestAnimFrame, - cancelAnimFrame: cancelAnimFrame -}); - -// @class Class -// @aka L.Class - -// @section -// @uninheritable - -// Thanks to John Resig and Dean Edwards for inspiration! - -function Class() {} - -Class.extend = function (props) { - - // @function extend(props: Object): Function - // [Extends the current class](#class-inheritance) given the properties to be included. - // Returns a Javascript function that is a class constructor (to be called with `new`). - var NewClass = function () { - - // call the constructor - if (this.initialize) { - this.initialize.apply(this, arguments); - } - - // call all constructor hooks - this.callInitHooks(); - }; - - var parentProto = NewClass.__super__ = this.prototype; - - var proto = create(parentProto); - proto.constructor = NewClass; - - NewClass.prototype = proto; - - // inherit parent's statics - for (var i in this) { - if (this.hasOwnProperty(i) && i !== 'prototype' && i !== '__super__') { - NewClass[i] = this[i]; - } - } - - // mix static properties into the class - if (props.statics) { - extend(NewClass, props.statics); - delete props.statics; - } - - // mix includes into the prototype - if (props.includes) { - checkDeprecatedMixinEvents(props.includes); - extend.apply(null, [proto].concat(props.includes)); - delete props.includes; - } - - // merge options - if (proto.options) { - props.options = extend(create(proto.options), props.options); - } - - // mix given properties into the prototype - extend(proto, props); - - proto._initHooks = []; - - // add method for calling all hooks - proto.callInitHooks = function () { - - if (this._initHooksCalled) { return; } - - if (parentProto.callInitHooks) { - parentProto.callInitHooks.call(this); - } - - this._initHooksCalled = true; - - for (var i = 0, len = proto._initHooks.length; i < len; i++) { - proto._initHooks[i].call(this); - } - }; - - return NewClass; -}; - - -// @function include(properties: Object): this -// [Includes a mixin](#class-includes) into the current class. -Class.include = function (props) { - extend(this.prototype, props); - return this; -}; - -// @function mergeOptions(options: Object): this -// [Merges `options`](#class-options) into the defaults of the class. -Class.mergeOptions = function (options) { - extend(this.prototype.options, options); - return this; -}; - -// @function addInitHook(fn: Function): this -// Adds a [constructor hook](#class-constructor-hooks) to the class. -Class.addInitHook = function (fn) { // (Function) || (String, args...) - var args = Array.prototype.slice.call(arguments, 1); - - var init = typeof fn === 'function' ? fn : function () { - this[fn].apply(this, args); - }; - - this.prototype._initHooks = this.prototype._initHooks || []; - this.prototype._initHooks.push(init); - return this; -}; - -function checkDeprecatedMixinEvents(includes) { - if (typeof L === 'undefined' || !L || !L.Mixin) { return; } - - includes = isArray(includes) ? includes : [includes]; - - for (var i = 0; i < includes.length; i++) { - if (includes[i] === L.Mixin.Events) { - console.warn('Deprecated include of L.Mixin.Events: ' + - 'this property will be removed in future releases, ' + - 'please inherit from L.Evented instead.', new Error().stack); - } - } -} - -/* - * @class Evented - * @aka L.Evented - * @inherits Class - * - * A set of methods shared between event-powered classes (like `Map` and `Marker`). Generally, events allow you to execute some function when something happens with an object (e.g. the user clicks on the map, causing the map to fire `'click'` event). - * - * @example - * - * ```js - * map.on('click', function(e) { - * alert(e.latlng); - * } ); - * ``` - * - * Leaflet deals with event listeners by reference, so if you want to add a listener and then remove it, define it as a function: - * - * ```js - * function onClick(e) { ... } - * - * map.on('click', onClick); - * map.off('click', onClick); - * ``` - */ - -var Events = { - /* @method on(type: String, fn: Function, context?: Object): this - * Adds a listener function (`fn`) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. `'click dblclick'`). - * - * @alternative - * @method on(eventMap: Object): this - * Adds a set of type/listener pairs, e.g. `{click: onClick, mousemove: onMouseMove}` - */ - on: function (types, fn, context) { - - // types can be a map of types/handlers - if (typeof types === 'object') { - for (var type in types) { - // we don't process space-separated events here for performance; - // it's a hot path since Layer uses the on(obj) syntax - this._on(type, types[type], fn); - } - - } else { - // types can be a string of space-separated words - types = splitWords(types); - - for (var i = 0, len = types.length; i < len; i++) { - this._on(types[i], fn, context); - } - } - - return this; - }, - - /* @method off(type: String, fn?: Function, context?: Object): this - * Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to `on`, you must pass the same context to `off` in order to remove the listener. - * - * @alternative - * @method off(eventMap: Object): this - * Removes a set of type/listener pairs. - * - * @alternative - * @method off: this - * Removes all listeners to all events on the object. - */ - off: function (types, fn, context) { - - if (!types) { - // clear all listeners if called without arguments - delete this._events; - - } else if (typeof types === 'object') { - for (var type in types) { - this._off(type, types[type], fn); - } - - } else { - types = splitWords(types); - - for (var i = 0, len = types.length; i < len; i++) { - this._off(types[i], fn, context); - } - } - - return this; - }, - - // attach listener (without syntactic sugar now) - _on: function (type, fn, context) { - this._events = this._events || {}; - - /* get/init listeners for type */ - var typeListeners = this._events[type]; - if (!typeListeners) { - typeListeners = []; - this._events[type] = typeListeners; - } - - if (context === this) { - // Less memory footprint. - context = undefined; - } - var newListener = {fn: fn, ctx: context}, - listeners = typeListeners; - - // check if fn already there - for (var i = 0, len = listeners.length; i < len; i++) { - if (listeners[i].fn === fn && listeners[i].ctx === context) { - return; - } - } - - listeners.push(newListener); - }, - - _off: function (type, fn, context) { - var listeners, - i, - len; - - if (!this._events) { return; } - - listeners = this._events[type]; - - if (!listeners) { - return; - } - - if (!fn) { - // Set all removed listeners to noop so they are not called if remove happens in fire - for (i = 0, len = listeners.length; i < len; i++) { - listeners[i].fn = falseFn; - } - // clear all listeners for a type if function isn't specified - delete this._events[type]; - return; - } - - if (context === this) { - context = undefined; - } - - if (listeners) { - - // find fn and remove it - for (i = 0, len = listeners.length; i < len; i++) { - var l = listeners[i]; - if (l.ctx !== context) { continue; } - if (l.fn === fn) { - - // set the removed listener to noop so that's not called if remove happens in fire - l.fn = falseFn; - - if (this._firingCount) { - /* copy array in case events are being fired */ - this._events[type] = listeners = listeners.slice(); - } - listeners.splice(i, 1); - - return; - } - } - } - }, - - // @method fire(type: String, data?: Object, propagate?: Boolean): this - // Fires an event of the specified type. You can optionally provide an data - // object — the first argument of the listener function will contain its - // properties. The event can optionally be propagated to event parents. - fire: function (type, data, propagate) { - if (!this.listens(type, propagate)) { return this; } - - var event = extend({}, data, { - type: type, - target: this, - sourceTarget: data && data.sourceTarget || this - }); - - if (this._events) { - var listeners = this._events[type]; - - if (listeners) { - this._firingCount = (this._firingCount + 1) || 1; - for (var i = 0, len = listeners.length; i < len; i++) { - var l = listeners[i]; - l.fn.call(l.ctx || this, event); - } - - this._firingCount--; - } - } - - if (propagate) { - // propagate the event to parents (set with addEventParent) - this._propagateEvent(event); - } - - return this; - }, - - // @method listens(type: String): Boolean - // Returns `true` if a particular event type has any listeners attached to it. - listens: function (type, propagate) { - var listeners = this._events && this._events[type]; - if (listeners && listeners.length) { return true; } - - if (propagate) { - // also check parents for listeners if event propagates - for (var id in this._eventParents) { - if (this._eventParents[id].listens(type, propagate)) { return true; } - } - } - return false; - }, - - // @method once(…): this - // Behaves as [`on(…)`](#evented-on), except the listener will only get fired once and then removed. - once: function (types, fn, context) { - - if (typeof types === 'object') { - for (var type in types) { - this.once(type, types[type], fn); - } - return this; - } - - var handler = bind(function () { - this - .off(types, fn, context) - .off(types, handler, context); - }, this); - - // add a listener that's executed once and removed after that - return this - .on(types, fn, context) - .on(types, handler, context); - }, - - // @method addEventParent(obj: Evented): this - // Adds an event parent - an `Evented` that will receive propagated events - addEventParent: function (obj) { - this._eventParents = this._eventParents || {}; - this._eventParents[stamp(obj)] = obj; - return this; - }, - - // @method removeEventParent(obj: Evented): this - // Removes an event parent, so it will stop receiving propagated events - removeEventParent: function (obj) { - if (this._eventParents) { - delete this._eventParents[stamp(obj)]; - } - return this; - }, - - _propagateEvent: function (e) { - for (var id in this._eventParents) { - this._eventParents[id].fire(e.type, extend({ - layer: e.target, - propagatedFrom: e.target - }, e), true); - } - } -}; - -// aliases; we should ditch those eventually - -// @method addEventListener(…): this -// Alias to [`on(…)`](#evented-on) -Events.addEventListener = Events.on; - -// @method removeEventListener(…): this -// Alias to [`off(…)`](#evented-off) - -// @method clearAllEventListeners(…): this -// Alias to [`off()`](#evented-off) -Events.removeEventListener = Events.clearAllEventListeners = Events.off; - -// @method addOneTimeEventListener(…): this -// Alias to [`once(…)`](#evented-once) -Events.addOneTimeEventListener = Events.once; - -// @method fireEvent(…): this -// Alias to [`fire(…)`](#evented-fire) -Events.fireEvent = Events.fire; - -// @method hasEventListeners(…): Boolean -// Alias to [`listens(…)`](#evented-listens) -Events.hasEventListeners = Events.listens; - -var Evented = Class.extend(Events); - -/* - * @class Point - * @aka L.Point - * - * Represents a point with `x` and `y` coordinates in pixels. - * - * @example - * - * ```js - * var point = L.point(200, 300); - * ``` - * - * All Leaflet methods and options that accept `Point` objects also accept them in a simple Array form (unless noted otherwise), so these lines are equivalent: - * - * ```js - * map.panBy([200, 300]); - * map.panBy(L.point(200, 300)); - * ``` - * - * Note that `Point` does not inherit from Leafet's `Class` object, - * which means new classes can't inherit from it, and new methods - * can't be added to it with the `include` function. - */ - -function Point(x, y, round) { - // @property x: Number; The `x` coordinate of the point - this.x = (round ? Math.round(x) : x); - // @property y: Number; The `y` coordinate of the point - this.y = (round ? Math.round(y) : y); -} - -var trunc = Math.trunc || function (v) { - return v > 0 ? Math.floor(v) : Math.ceil(v); -}; - -Point.prototype = { - - // @method clone(): Point - // Returns a copy of the current point. - clone: function () { - return new Point(this.x, this.y); - }, - - // @method add(otherPoint: Point): Point - // Returns the result of addition of the current and the given points. - add: function (point) { - // non-destructive, returns a new point - return this.clone()._add(toPoint(point)); - }, - - _add: function (point) { - // destructive, used directly for performance in situations where it's safe to modify existing point - this.x += point.x; - this.y += point.y; - return this; - }, - - // @method subtract(otherPoint: Point): Point - // Returns the result of subtraction of the given point from the current. - subtract: function (point) { - return this.clone()._subtract(toPoint(point)); - }, - - _subtract: function (point) { - this.x -= point.x; - this.y -= point.y; - return this; - }, - - // @method divideBy(num: Number): Point - // Returns the result of division of the current point by the given number. - divideBy: function (num) { - return this.clone()._divideBy(num); - }, - - _divideBy: function (num) { - this.x /= num; - this.y /= num; - return this; - }, - - // @method multiplyBy(num: Number): Point - // Returns the result of multiplication of the current point by the given number. - multiplyBy: function (num) { - return this.clone()._multiplyBy(num); - }, - - _multiplyBy: function (num) { - this.x *= num; - this.y *= num; - return this; - }, - - // @method scaleBy(scale: Point): Point - // Multiply each coordinate of the current point by each coordinate of - // `scale`. In linear algebra terms, multiply the point by the - // [scaling matrix](https://en.wikipedia.org/wiki/Scaling_%28geometry%29#Matrix_representation) - // defined by `scale`. - scaleBy: function (point) { - return new Point(this.x * point.x, this.y * point.y); - }, - - // @method unscaleBy(scale: Point): Point - // Inverse of `scaleBy`. Divide each coordinate of the current point by - // each coordinate of `scale`. - unscaleBy: function (point) { - return new Point(this.x / point.x, this.y / point.y); - }, - - // @method round(): Point - // Returns a copy of the current point with rounded coordinates. - round: function () { - return this.clone()._round(); - }, - - _round: function () { - this.x = Math.round(this.x); - this.y = Math.round(this.y); - return this; - }, - - // @method floor(): Point - // Returns a copy of the current point with floored coordinates (rounded down). - floor: function () { - return this.clone()._floor(); - }, - - _floor: function () { - this.x = Math.floor(this.x); - this.y = Math.floor(this.y); - return this; - }, - - // @method ceil(): Point - // Returns a copy of the current point with ceiled coordinates (rounded up). - ceil: function () { - return this.clone()._ceil(); - }, - - _ceil: function () { - this.x = Math.ceil(this.x); - this.y = Math.ceil(this.y); - return this; - }, - - // @method trunc(): Point - // Returns a copy of the current point with truncated coordinates (rounded towards zero). - trunc: function () { - return this.clone()._trunc(); - }, - - _trunc: function () { - this.x = trunc(this.x); - this.y = trunc(this.y); - return this; - }, - - // @method distanceTo(otherPoint: Point): Number - // Returns the cartesian distance between the current and the given points. - distanceTo: function (point) { - point = toPoint(point); - - var x = point.x - this.x, - y = point.y - this.y; - - return Math.sqrt(x * x + y * y); - }, - - // @method equals(otherPoint: Point): Boolean - // Returns `true` if the given point has the same coordinates. - equals: function (point) { - point = toPoint(point); - - return point.x === this.x && - point.y === this.y; - }, - - // @method contains(otherPoint: Point): Boolean - // Returns `true` if both coordinates of the given point are less than the corresponding current point coordinates (in absolute values). - contains: function (point) { - point = toPoint(point); - - return Math.abs(point.x) <= Math.abs(this.x) && - Math.abs(point.y) <= Math.abs(this.y); - }, - - // @method toString(): String - // Returns a string representation of the point for debugging purposes. - toString: function () { - return 'Point(' + - formatNum(this.x) + ', ' + - formatNum(this.y) + ')'; - } -}; - -// @factory L.point(x: Number, y: Number, round?: Boolean) -// Creates a Point object with the given `x` and `y` coordinates. If optional `round` is set to true, rounds the `x` and `y` values. - -// @alternative -// @factory L.point(coords: Number[]) -// Expects an array of the form `[x, y]` instead. - -// @alternative -// @factory L.point(coords: Object) -// Expects a plain object of the form `{x: Number, y: Number}` instead. -function toPoint(x, y, round) { - if (x instanceof Point) { - return x; - } - if (isArray(x)) { - return new Point(x[0], x[1]); - } - if (x === undefined || x === null) { - return x; - } - if (typeof x === 'object' && 'x' in x && 'y' in x) { - return new Point(x.x, x.y); - } - return new Point(x, y, round); -} - -/* - * @class Bounds - * @aka L.Bounds - * - * Represents a rectangular area in pixel coordinates. - * - * @example - * - * ```js - * var p1 = L.point(10, 10), - * p2 = L.point(40, 60), - * bounds = L.bounds(p1, p2); - * ``` - * - * All Leaflet methods that accept `Bounds` objects also accept them in a simple Array form (unless noted otherwise), so the bounds example above can be passed like this: - * - * ```js - * otherBounds.intersects([[10, 10], [40, 60]]); - * ``` - * - * Note that `Bounds` does not inherit from Leafet's `Class` object, - * which means new classes can't inherit from it, and new methods - * can't be added to it with the `include` function. - */ - -function Bounds(a, b) { - if (!a) { return; } - - var points = b ? [a, b] : a; - - for (var i = 0, len = points.length; i < len; i++) { - this.extend(points[i]); - } -} - -Bounds.prototype = { - // @method extend(point: Point): this - // Extends the bounds to contain the given point. - extend: function (point) { // (Point) - point = toPoint(point); - - // @property min: Point - // The top left corner of the rectangle. - // @property max: Point - // The bottom right corner of the rectangle. - if (!this.min && !this.max) { - this.min = point.clone(); - this.max = point.clone(); - } else { - this.min.x = Math.min(point.x, this.min.x); - this.max.x = Math.max(point.x, this.max.x); - this.min.y = Math.min(point.y, this.min.y); - this.max.y = Math.max(point.y, this.max.y); - } - return this; - }, - - // @method getCenter(round?: Boolean): Point - // Returns the center point of the bounds. - getCenter: function (round) { - return new Point( - (this.min.x + this.max.x) / 2, - (this.min.y + this.max.y) / 2, round); - }, - - // @method getBottomLeft(): Point - // Returns the bottom-left point of the bounds. - getBottomLeft: function () { - return new Point(this.min.x, this.max.y); - }, - - // @method getTopRight(): Point - // Returns the top-right point of the bounds. - getTopRight: function () { // -> Point - return new Point(this.max.x, this.min.y); - }, - - // @method getTopLeft(): Point - // Returns the top-left point of the bounds (i.e. [`this.min`](#bounds-min)). - getTopLeft: function () { - return this.min; // left, top - }, - - // @method getBottomRight(): Point - // Returns the bottom-right point of the bounds (i.e. [`this.max`](#bounds-max)). - getBottomRight: function () { - return this.max; // right, bottom - }, - - // @method getSize(): Point - // Returns the size of the given bounds - getSize: function () { - return this.max.subtract(this.min); - }, - - // @method contains(otherBounds: Bounds): Boolean - // Returns `true` if the rectangle contains the given one. - // @alternative - // @method contains(point: Point): Boolean - // Returns `true` if the rectangle contains the given point. - contains: function (obj) { - var min, max; - - if (typeof obj[0] === 'number' || obj instanceof Point) { - obj = toPoint(obj); - } else { - obj = toBounds(obj); - } - - if (obj instanceof Bounds) { - min = obj.min; - max = obj.max; - } else { - min = max = obj; - } - - return (min.x >= this.min.x) && - (max.x <= this.max.x) && - (min.y >= this.min.y) && - (max.y <= this.max.y); - }, - - // @method intersects(otherBounds: Bounds): Boolean - // Returns `true` if the rectangle intersects the given bounds. Two bounds - // intersect if they have at least one point in common. - intersects: function (bounds) { // (Bounds) -> Boolean - bounds = toBounds(bounds); - - var min = this.min, - max = this.max, - min2 = bounds.min, - max2 = bounds.max, - xIntersects = (max2.x >= min.x) && (min2.x <= max.x), - yIntersects = (max2.y >= min.y) && (min2.y <= max.y); - - return xIntersects && yIntersects; - }, - - // @method overlaps(otherBounds: Bounds): Boolean - // Returns `true` if the rectangle overlaps the given bounds. Two bounds - // overlap if their intersection is an area. - overlaps: function (bounds) { // (Bounds) -> Boolean - bounds = toBounds(bounds); - - var min = this.min, - max = this.max, - min2 = bounds.min, - max2 = bounds.max, - xOverlaps = (max2.x > min.x) && (min2.x < max.x), - yOverlaps = (max2.y > min.y) && (min2.y < max.y); - - return xOverlaps && yOverlaps; - }, - - isValid: function () { - return !!(this.min && this.max); - } -}; - - -// @factory L.bounds(corner1: Point, corner2: Point) -// Creates a Bounds object from two corners coordinate pairs. -// @alternative -// @factory L.bounds(points: Point[]) -// Creates a Bounds object from the given array of points. -function toBounds(a, b) { - if (!a || a instanceof Bounds) { - return a; - } - return new Bounds(a, b); -} - -/* - * @class LatLngBounds - * @aka L.LatLngBounds - * - * Represents a rectangular geographical area on a map. - * - * @example - * - * ```js - * var corner1 = L.latLng(40.712, -74.227), - * corner2 = L.latLng(40.774, -74.125), - * bounds = L.latLngBounds(corner1, corner2); - * ``` - * - * All Leaflet methods that accept LatLngBounds objects also accept them in a simple Array form (unless noted otherwise), so the bounds example above can be passed like this: - * - * ```js - * map.fitBounds([ - * [40.712, -74.227], - * [40.774, -74.125] - * ]); - * ``` - * - * Caution: if the area crosses the antimeridian (often confused with the International Date Line), you must specify corners _outside_ the [-180, 180] degrees longitude range. - * - * Note that `LatLngBounds` does not inherit from Leafet's `Class` object, - * which means new classes can't inherit from it, and new methods - * can't be added to it with the `include` function. - */ - -function LatLngBounds(corner1, corner2) { // (LatLng, LatLng) or (LatLng[]) - if (!corner1) { return; } - - var latlngs = corner2 ? [corner1, corner2] : corner1; - - for (var i = 0, len = latlngs.length; i < len; i++) { - this.extend(latlngs[i]); - } -} - -LatLngBounds.prototype = { - - // @method extend(latlng: LatLng): this - // Extend the bounds to contain the given point - - // @alternative - // @method extend(otherBounds: LatLngBounds): this - // Extend the bounds to contain the given bounds - extend: function (obj) { - var sw = this._southWest, - ne = this._northEast, - sw2, ne2; - - if (obj instanceof LatLng) { - sw2 = obj; - ne2 = obj; - - } else if (obj instanceof LatLngBounds) { - sw2 = obj._southWest; - ne2 = obj._northEast; - - if (!sw2 || !ne2) { return this; } - - } else { - return obj ? this.extend(toLatLng(obj) || toLatLngBounds(obj)) : this; - } - - if (!sw && !ne) { - this._southWest = new LatLng(sw2.lat, sw2.lng); - this._northEast = new LatLng(ne2.lat, ne2.lng); - } else { - sw.lat = Math.min(sw2.lat, sw.lat); - sw.lng = Math.min(sw2.lng, sw.lng); - ne.lat = Math.max(ne2.lat, ne.lat); - ne.lng = Math.max(ne2.lng, ne.lng); - } - - return this; - }, - - // @method pad(bufferRatio: Number): LatLngBounds - // Returns bounds created by extending or retracting the current bounds by a given ratio in each direction. - // For example, a ratio of 0.5 extends the bounds by 50% in each direction. - // Negative values will retract the bounds. - pad: function (bufferRatio) { - var sw = this._southWest, - ne = this._northEast, - heightBuffer = Math.abs(sw.lat - ne.lat) * bufferRatio, - widthBuffer = Math.abs(sw.lng - ne.lng) * bufferRatio; - - return new LatLngBounds( - new LatLng(sw.lat - heightBuffer, sw.lng - widthBuffer), - new LatLng(ne.lat + heightBuffer, ne.lng + widthBuffer)); - }, - - // @method getCenter(): LatLng - // Returns the center point of the bounds. - getCenter: function () { - return new LatLng( - (this._southWest.lat + this._northEast.lat) / 2, - (this._southWest.lng + this._northEast.lng) / 2); - }, - - // @method getSouthWest(): LatLng - // Returns the south-west point of the bounds. - getSouthWest: function () { - return this._southWest; - }, - - // @method getNorthEast(): LatLng - // Returns the north-east point of the bounds. - getNorthEast: function () { - return this._northEast; - }, - - // @method getNorthWest(): LatLng - // Returns the north-west point of the bounds. - getNorthWest: function () { - return new LatLng(this.getNorth(), this.getWest()); - }, - - // @method getSouthEast(): LatLng - // Returns the south-east point of the bounds. - getSouthEast: function () { - return new LatLng(this.getSouth(), this.getEast()); - }, - - // @method getWest(): Number - // Returns the west longitude of the bounds - getWest: function () { - return this._southWest.lng; - }, - - // @method getSouth(): Number - // Returns the south latitude of the bounds - getSouth: function () { - return this._southWest.lat; - }, - - // @method getEast(): Number - // Returns the east longitude of the bounds - getEast: function () { - return this._northEast.lng; - }, - - // @method getNorth(): Number - // Returns the north latitude of the bounds - getNorth: function () { - return this._northEast.lat; - }, - - // @method contains(otherBounds: LatLngBounds): Boolean - // Returns `true` if the rectangle contains the given one. - - // @alternative - // @method contains (latlng: LatLng): Boolean - // Returns `true` if the rectangle contains the given point. - contains: function (obj) { // (LatLngBounds) or (LatLng) -> Boolean - if (typeof obj[0] === 'number' || obj instanceof LatLng || 'lat' in obj) { - obj = toLatLng(obj); - } else { - obj = toLatLngBounds(obj); - } - - var sw = this._southWest, - ne = this._northEast, - sw2, ne2; - - if (obj instanceof LatLngBounds) { - sw2 = obj.getSouthWest(); - ne2 = obj.getNorthEast(); - } else { - sw2 = ne2 = obj; - } - - return (sw2.lat >= sw.lat) && (ne2.lat <= ne.lat) && - (sw2.lng >= sw.lng) && (ne2.lng <= ne.lng); - }, - - // @method intersects(otherBounds: LatLngBounds): Boolean - // Returns `true` if the rectangle intersects the given bounds. Two bounds intersect if they have at least one point in common. - intersects: function (bounds) { - bounds = toLatLngBounds(bounds); - - var sw = this._southWest, - ne = this._northEast, - sw2 = bounds.getSouthWest(), - ne2 = bounds.getNorthEast(), - - latIntersects = (ne2.lat >= sw.lat) && (sw2.lat <= ne.lat), - lngIntersects = (ne2.lng >= sw.lng) && (sw2.lng <= ne.lng); - - return latIntersects && lngIntersects; - }, - - // @method overlaps(otherBounds: Bounds): Boolean - // Returns `true` if the rectangle overlaps the given bounds. Two bounds overlap if their intersection is an area. - overlaps: function (bounds) { - bounds = toLatLngBounds(bounds); - - var sw = this._southWest, - ne = this._northEast, - sw2 = bounds.getSouthWest(), - ne2 = bounds.getNorthEast(), - - latOverlaps = (ne2.lat > sw.lat) && (sw2.lat < ne.lat), - lngOverlaps = (ne2.lng > sw.lng) && (sw2.lng < ne.lng); - - return latOverlaps && lngOverlaps; - }, - - // @method toBBoxString(): String - // Returns a string with bounding box coordinates in a 'southwest_lng,southwest_lat,northeast_lng,northeast_lat' format. Useful for sending requests to web services that return geo data. - toBBoxString: function () { - return [this.getWest(), this.getSouth(), this.getEast(), this.getNorth()].join(','); - }, - - // @method equals(otherBounds: LatLngBounds, maxMargin?: Number): Boolean - // Returns `true` if the rectangle is equivalent (within a small margin of error) to the given bounds. The margin of error can be overridden by setting `maxMargin` to a small number. - equals: function (bounds, maxMargin) { - if (!bounds) { return false; } - - bounds = toLatLngBounds(bounds); - - return this._southWest.equals(bounds.getSouthWest(), maxMargin) && - this._northEast.equals(bounds.getNorthEast(), maxMargin); - }, - - // @method isValid(): Boolean - // Returns `true` if the bounds are properly initialized. - isValid: function () { - return !!(this._southWest && this._northEast); - } -}; - -// TODO International date line? - -// @factory L.latLngBounds(corner1: LatLng, corner2: LatLng) -// Creates a `LatLngBounds` object by defining two diagonally opposite corners of the rectangle. - -// @alternative -// @factory L.latLngBounds(latlngs: LatLng[]) -// Creates a `LatLngBounds` object defined by the geographical points it contains. Very useful for zooming the map to fit a particular set of locations with [`fitBounds`](#map-fitbounds). -function toLatLngBounds(a, b) { - if (a instanceof LatLngBounds) { - return a; - } - return new LatLngBounds(a, b); -} - -/* @class LatLng - * @aka L.LatLng - * - * Represents a geographical point with a certain latitude and longitude. - * - * @example - * - * ``` - * var latlng = L.latLng(50.5, 30.5); - * ``` - * - * All Leaflet methods that accept LatLng objects also accept them in a simple Array form and simple object form (unless noted otherwise), so these lines are equivalent: - * - * ``` - * map.panTo([50, 30]); - * map.panTo({lon: 30, lat: 50}); - * map.panTo({lat: 50, lng: 30}); - * map.panTo(L.latLng(50, 30)); - * ``` - * - * Note that `LatLng` does not inherit from Leaflet's `Class` object, - * which means new classes can't inherit from it, and new methods - * can't be added to it with the `include` function. - */ - -function LatLng(lat, lng, alt) { - if (isNaN(lat) || isNaN(lng)) { - throw new Error('Invalid LatLng object: (' + lat + ', ' + lng + ')'); - } - - // @property lat: Number - // Latitude in degrees - this.lat = +lat; - - // @property lng: Number - // Longitude in degrees - this.lng = +lng; - - // @property alt: Number - // Altitude in meters (optional) - if (alt !== undefined) { - this.alt = +alt; - } -} - -LatLng.prototype = { - // @method equals(otherLatLng: LatLng, maxMargin?: Number): Boolean - // Returns `true` if the given `LatLng` point is at the same position (within a small margin of error). The margin of error can be overridden by setting `maxMargin` to a small number. - equals: function (obj, maxMargin) { - if (!obj) { return false; } - - obj = toLatLng(obj); - - var margin = Math.max( - Math.abs(this.lat - obj.lat), - Math.abs(this.lng - obj.lng)); - - return margin <= (maxMargin === undefined ? 1.0E-9 : maxMargin); - }, - - // @method toString(): String - // Returns a string representation of the point (for debugging purposes). - toString: function (precision) { - return 'LatLng(' + - formatNum(this.lat, precision) + ', ' + - formatNum(this.lng, precision) + ')'; - }, - - // @method distanceTo(otherLatLng: LatLng): Number - // Returns the distance (in meters) to the given `LatLng` calculated using the [Spherical Law of Cosines](https://en.wikipedia.org/wiki/Spherical_law_of_cosines). - distanceTo: function (other) { - return Earth.distance(this, toLatLng(other)); - }, - - // @method wrap(): LatLng - // Returns a new `LatLng` object with the longitude wrapped so it's always between -180 and +180 degrees. - wrap: function () { - return Earth.wrapLatLng(this); - }, - - // @method toBounds(sizeInMeters: Number): LatLngBounds - // Returns a new `LatLngBounds` object in which each boundary is `sizeInMeters/2` meters apart from the `LatLng`. - toBounds: function (sizeInMeters) { - var latAccuracy = 180 * sizeInMeters / 40075017, - lngAccuracy = latAccuracy / Math.cos((Math.PI / 180) * this.lat); - - return toLatLngBounds( - [this.lat - latAccuracy, this.lng - lngAccuracy], - [this.lat + latAccuracy, this.lng + lngAccuracy]); - }, - - clone: function () { - return new LatLng(this.lat, this.lng, this.alt); - } -}; - - - -// @factory L.latLng(latitude: Number, longitude: Number, altitude?: Number): LatLng -// Creates an object representing a geographical point with the given latitude and longitude (and optionally altitude). - -// @alternative -// @factory L.latLng(coords: Array): LatLng -// Expects an array of the form `[Number, Number]` or `[Number, Number, Number]` instead. - -// @alternative -// @factory L.latLng(coords: Object): LatLng -// Expects an plain object of the form `{lat: Number, lng: Number}` or `{lat: Number, lng: Number, alt: Number}` instead. - -function toLatLng(a, b, c) { - if (a instanceof LatLng) { - return a; - } - if (isArray(a) && typeof a[0] !== 'object') { - if (a.length === 3) { - return new LatLng(a[0], a[1], a[2]); - } - if (a.length === 2) { - return new LatLng(a[0], a[1]); - } - return null; - } - if (a === undefined || a === null) { - return a; - } - if (typeof a === 'object' && 'lat' in a) { - return new LatLng(a.lat, 'lng' in a ? a.lng : a.lon, a.alt); - } - if (b === undefined) { - return null; - } - return new LatLng(a, b, c); -} - -/* - * @namespace CRS - * @crs L.CRS.Base - * Object that defines coordinate reference systems for projecting - * geographical points into pixel (screen) coordinates and back (and to - * coordinates in other units for [WMS](https://en.wikipedia.org/wiki/Web_Map_Service) services). See - * [spatial reference system](http://en.wikipedia.org/wiki/Coordinate_reference_system). - * - * Leaflet defines the most usual CRSs by default. If you want to use a - * CRS not defined by default, take a look at the - * [Proj4Leaflet](https://github.com/kartena/Proj4Leaflet) plugin. - * - * Note that the CRS instances do not inherit from Leafet's `Class` object, - * and can't be instantiated. Also, new classes can't inherit from them, - * and methods can't be added to them with the `include` function. - */ - -var CRS = { - // @method latLngToPoint(latlng: LatLng, zoom: Number): Point - // Projects geographical coordinates into pixel coordinates for a given zoom. - latLngToPoint: function (latlng, zoom) { - var projectedPoint = this.projection.project(latlng), - scale = this.scale(zoom); - - return this.transformation._transform(projectedPoint, scale); - }, - - // @method pointToLatLng(point: Point, zoom: Number): LatLng - // The inverse of `latLngToPoint`. Projects pixel coordinates on a given - // zoom into geographical coordinates. - pointToLatLng: function (point, zoom) { - var scale = this.scale(zoom), - untransformedPoint = this.transformation.untransform(point, scale); - - return this.projection.unproject(untransformedPoint); - }, - - // @method project(latlng: LatLng): Point - // Projects geographical coordinates into coordinates in units accepted for - // this CRS (e.g. meters for EPSG:3857, for passing it to WMS services). - project: function (latlng) { - return this.projection.project(latlng); - }, - - // @method unproject(point: Point): LatLng - // Given a projected coordinate returns the corresponding LatLng. - // The inverse of `project`. - unproject: function (point) { - return this.projection.unproject(point); - }, - - // @method scale(zoom: Number): Number - // Returns the scale used when transforming projected coordinates into - // pixel coordinates for a particular zoom. For example, it returns - // `256 * 2^zoom` for Mercator-based CRS. - scale: function (zoom) { - return 256 * Math.pow(2, zoom); - }, - - // @method zoom(scale: Number): Number - // Inverse of `scale()`, returns the zoom level corresponding to a scale - // factor of `scale`. - zoom: function (scale) { - return Math.log(scale / 256) / Math.LN2; - }, - - // @method getProjectedBounds(zoom: Number): Bounds - // Returns the projection's bounds scaled and transformed for the provided `zoom`. - getProjectedBounds: function (zoom) { - if (this.infinite) { return null; } - - var b = this.projection.bounds, - s = this.scale(zoom), - min = this.transformation.transform(b.min, s), - max = this.transformation.transform(b.max, s); - - return new Bounds(min, max); - }, - - // @method distance(latlng1: LatLng, latlng2: LatLng): Number - // Returns the distance between two geographical coordinates. - - // @property code: String - // Standard code name of the CRS passed into WMS services (e.g. `'EPSG:3857'`) - // - // @property wrapLng: Number[] - // An array of two numbers defining whether the longitude (horizontal) coordinate - // axis wraps around a given range and how. Defaults to `[-180, 180]` in most - // geographical CRSs. If `undefined`, the longitude axis does not wrap around. - // - // @property wrapLat: Number[] - // Like `wrapLng`, but for the latitude (vertical) axis. - - // wrapLng: [min, max], - // wrapLat: [min, max], - - // @property infinite: Boolean - // If true, the coordinate space will be unbounded (infinite in both axes) - infinite: false, - - // @method wrapLatLng(latlng: LatLng): LatLng - // Returns a `LatLng` where lat and lng has been wrapped according to the - // CRS's `wrapLat` and `wrapLng` properties, if they are outside the CRS's bounds. - wrapLatLng: function (latlng) { - var lng = this.wrapLng ? wrapNum(latlng.lng, this.wrapLng, true) : latlng.lng, - lat = this.wrapLat ? wrapNum(latlng.lat, this.wrapLat, true) : latlng.lat, - alt = latlng.alt; - - return new LatLng(lat, lng, alt); - }, - - // @method wrapLatLngBounds(bounds: LatLngBounds): LatLngBounds - // Returns a `LatLngBounds` with the same size as the given one, ensuring - // that its center is within the CRS's bounds. - // Only accepts actual `L.LatLngBounds` instances, not arrays. - wrapLatLngBounds: function (bounds) { - var center = bounds.getCenter(), - newCenter = this.wrapLatLng(center), - latShift = center.lat - newCenter.lat, - lngShift = center.lng - newCenter.lng; - - if (latShift === 0 && lngShift === 0) { - return bounds; - } - - var sw = bounds.getSouthWest(), - ne = bounds.getNorthEast(), - newSw = new LatLng(sw.lat - latShift, sw.lng - lngShift), - newNe = new LatLng(ne.lat - latShift, ne.lng - lngShift); - - return new LatLngBounds(newSw, newNe); - } -}; - -/* - * @namespace CRS - * @crs L.CRS.Earth - * - * Serves as the base for CRS that are global such that they cover the earth. - * Can only be used as the base for other CRS and cannot be used directly, - * since it does not have a `code`, `projection` or `transformation`. `distance()` returns - * meters. - */ - -var Earth = extend({}, CRS, { - wrapLng: [-180, 180], - - // Mean Earth Radius, as recommended for use by - // the International Union of Geodesy and Geophysics, - // see http://rosettacode.org/wiki/Haversine_formula - R: 6371000, - - // distance between two geographical points using spherical law of cosines approximation - distance: function (latlng1, latlng2) { - var rad = Math.PI / 180, - lat1 = latlng1.lat * rad, - lat2 = latlng2.lat * rad, - sinDLat = Math.sin((latlng2.lat - latlng1.lat) * rad / 2), - sinDLon = Math.sin((latlng2.lng - latlng1.lng) * rad / 2), - a = sinDLat * sinDLat + Math.cos(lat1) * Math.cos(lat2) * sinDLon * sinDLon, - c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)); - return this.R * c; - } -}); - -/* - * @namespace Projection - * @projection L.Projection.SphericalMercator - * - * Spherical Mercator projection — the most common projection for online maps, - * used by almost all free and commercial tile providers. Assumes that Earth is - * a sphere. Used by the `EPSG:3857` CRS. - */ - -var SphericalMercator = { - - R: 6378137, - MAX_LATITUDE: 85.0511287798, - - project: function (latlng) { - var d = Math.PI / 180, - max = this.MAX_LATITUDE, - lat = Math.max(Math.min(max, latlng.lat), -max), - sin = Math.sin(lat * d); - - return new Point( - this.R * latlng.lng * d, - this.R * Math.log((1 + sin) / (1 - sin)) / 2); - }, - - unproject: function (point) { - var d = 180 / Math.PI; - - return new LatLng( - (2 * Math.atan(Math.exp(point.y / this.R)) - (Math.PI / 2)) * d, - point.x * d / this.R); - }, - - bounds: (function () { - var d = 6378137 * Math.PI; - return new Bounds([-d, -d], [d, d]); - })() -}; - -/* - * @class Transformation - * @aka L.Transformation - * - * Represents an affine transformation: a set of coefficients `a`, `b`, `c`, `d` - * for transforming a point of a form `(x, y)` into `(a*x + b, c*y + d)` and doing - * the reverse. Used by Leaflet in its projections code. - * - * @example - * - * ```js - * var transformation = L.transformation(2, 5, -1, 10), - * p = L.point(1, 2), - * p2 = transformation.transform(p), // L.point(7, 8) - * p3 = transformation.untransform(p2); // L.point(1, 2) - * ``` - */ - - -// factory new L.Transformation(a: Number, b: Number, c: Number, d: Number) -// Creates a `Transformation` object with the given coefficients. -function Transformation(a, b, c, d) { - if (isArray(a)) { - // use array properties - this._a = a[0]; - this._b = a[1]; - this._c = a[2]; - this._d = a[3]; - return; - } - this._a = a; - this._b = b; - this._c = c; - this._d = d; -} - -Transformation.prototype = { - // @method transform(point: Point, scale?: Number): Point - // Returns a transformed point, optionally multiplied by the given scale. - // Only accepts actual `L.Point` instances, not arrays. - transform: function (point, scale) { // (Point, Number) -> Point - return this._transform(point.clone(), scale); - }, - - // destructive transform (faster) - _transform: function (point, scale) { - scale = scale || 1; - point.x = scale * (this._a * point.x + this._b); - point.y = scale * (this._c * point.y + this._d); - return point; - }, - - // @method untransform(point: Point, scale?: Number): Point - // Returns the reverse transformation of the given point, optionally divided - // by the given scale. Only accepts actual `L.Point` instances, not arrays. - untransform: function (point, scale) { - scale = scale || 1; - return new Point( - (point.x / scale - this._b) / this._a, - (point.y / scale - this._d) / this._c); - } -}; - -// factory L.transformation(a: Number, b: Number, c: Number, d: Number) - -// @factory L.transformation(a: Number, b: Number, c: Number, d: Number) -// Instantiates a Transformation object with the given coefficients. - -// @alternative -// @factory L.transformation(coefficients: Array): Transformation -// Expects an coefficients array of the form -// `[a: Number, b: Number, c: Number, d: Number]`. - -function toTransformation(a, b, c, d) { - return new Transformation(a, b, c, d); -} - -/* - * @namespace CRS - * @crs L.CRS.EPSG3857 - * - * The most common CRS for online maps, used by almost all free and commercial - * tile providers. Uses Spherical Mercator projection. Set in by default in - * Map's `crs` option. - */ - -var EPSG3857 = extend({}, Earth, { - code: 'EPSG:3857', - projection: SphericalMercator, - - transformation: (function () { - var scale = 0.5 / (Math.PI * SphericalMercator.R); - return toTransformation(scale, 0.5, -scale, 0.5); - }()) -}); - -var EPSG900913 = extend({}, EPSG3857, { - code: 'EPSG:900913' -}); - -// @namespace SVG; @section -// There are several static functions which can be called without instantiating L.SVG: - -// @function create(name: String): SVGElement -// Returns a instance of [SVGElement](https://developer.mozilla.org/docs/Web/API/SVGElement), -// corresponding to the class name passed. For example, using 'line' will return -// an instance of [SVGLineElement](https://developer.mozilla.org/docs/Web/API/SVGLineElement). -function svgCreate(name) { - return document.createElementNS('http://www.w3.org/2000/svg', name); -} - -// @function pointsToPath(rings: Point[], closed: Boolean): String -// Generates a SVG path string for multiple rings, with each ring turning -// into "M..L..L.." instructions -function pointsToPath(rings, closed) { - var str = '', - i, j, len, len2, points, p; - - for (i = 0, len = rings.length; i < len; i++) { - points = rings[i]; - - for (j = 0, len2 = points.length; j < len2; j++) { - p = points[j]; - str += (j ? 'L' : 'M') + p.x + ' ' + p.y; - } - - // closes the ring for polygons; "x" is VML syntax - str += closed ? (svg ? 'z' : 'x') : ''; - } - - // SVG complains about empty path strings - return str || 'M0 0'; -} - -/* - * @namespace Browser - * @aka L.Browser - * - * A namespace with static properties for browser/feature detection used by Leaflet internally. - * - * @example - * - * ```js - * if (L.Browser.ielt9) { - * alert('Upgrade your browser, dude!'); - * } - * ``` - */ - -var style$1 = document.documentElement.style; - -// @property ie: Boolean; `true` for all Internet Explorer versions (not Edge). -var ie = 'ActiveXObject' in window; - -// @property ielt9: Boolean; `true` for Internet Explorer versions less than 9. -var ielt9 = ie && !document.addEventListener; - -// @property edge: Boolean; `true` for the Edge web browser. -var edge = 'msLaunchUri' in navigator && !('documentMode' in document); - -// @property webkit: Boolean; -// `true` for webkit-based browsers like Chrome and Safari (including mobile versions). -var webkit = userAgentContains('webkit'); - -// @property android: Boolean -// `true` for any browser running on an Android platform. -var android = userAgentContains('android'); - -// @property android23: Boolean; `true` for browsers running on Android 2 or Android 3. -var android23 = userAgentContains('android 2') || userAgentContains('android 3'); - -/* See https://stackoverflow.com/a/17961266 for details on detecting stock Android */ -var webkitVer = parseInt(/WebKit\/([0-9]+)|$/.exec(navigator.userAgent)[1], 10); // also matches AppleWebKit -// @property androidStock: Boolean; `true` for the Android stock browser (i.e. not Chrome) -var androidStock = android && userAgentContains('Google') && webkitVer < 537 && !('AudioNode' in window); - -// @property opera: Boolean; `true` for the Opera browser -var opera = !!window.opera; - -// @property chrome: Boolean; `true` for the Chrome browser. -var chrome = userAgentContains('chrome'); - -// @property gecko: Boolean; `true` for gecko-based browsers like Firefox. -var gecko = userAgentContains('gecko') && !webkit && !opera && !ie; - -// @property safari: Boolean; `true` for the Safari browser. -var safari = !chrome && userAgentContains('safari'); - -var phantom = userAgentContains('phantom'); - -// @property opera12: Boolean -// `true` for the Opera browser supporting CSS transforms (version 12 or later). -var opera12 = 'OTransition' in style$1; - -// @property win: Boolean; `true` when the browser is running in a Windows platform -var win = navigator.platform.indexOf('Win') === 0; - -// @property ie3d: Boolean; `true` for all Internet Explorer versions supporting CSS transforms. -var ie3d = ie && ('transition' in style$1); - -// @property webkit3d: Boolean; `true` for webkit-based browsers supporting CSS transforms. -var webkit3d = ('WebKitCSSMatrix' in window) && ('m11' in new window.WebKitCSSMatrix()) && !android23; - -// @property gecko3d: Boolean; `true` for gecko-based browsers supporting CSS transforms. -var gecko3d = 'MozPerspective' in style$1; - -// @property any3d: Boolean -// `true` for all browsers supporting CSS transforms. -var any3d = !window.L_DISABLE_3D && (ie3d || webkit3d || gecko3d) && !opera12 && !phantom; - -// @property mobile: Boolean; `true` for all browsers running in a mobile device. -var mobile = typeof orientation !== 'undefined' || userAgentContains('mobile'); - -// @property mobileWebkit: Boolean; `true` for all webkit-based browsers in a mobile device. -var mobileWebkit = mobile && webkit; - -// @property mobileWebkit3d: Boolean -// `true` for all webkit-based browsers in a mobile device supporting CSS transforms. -var mobileWebkit3d = mobile && webkit3d; - -// @property msPointer: Boolean -// `true` for browsers implementing the Microsoft touch events model (notably IE10). -var msPointer = !window.PointerEvent && window.MSPointerEvent; - -// @property pointer: Boolean -// `true` for all browsers supporting [pointer events](https://msdn.microsoft.com/en-us/library/dn433244%28v=vs.85%29.aspx). -var pointer = !!(window.PointerEvent || msPointer); - -// @property touch: Boolean -// `true` for all browsers supporting [touch events](https://developer.mozilla.org/docs/Web/API/Touch_events). -// This does not necessarily mean that the browser is running in a computer with -// a touchscreen, it only means that the browser is capable of understanding -// touch events. -var touch = !window.L_NO_TOUCH && (pointer || 'ontouchstart' in window || - (window.DocumentTouch && document instanceof window.DocumentTouch)); - -// @property mobileOpera: Boolean; `true` for the Opera browser in a mobile device. -var mobileOpera = mobile && opera; - -// @property mobileGecko: Boolean -// `true` for gecko-based browsers running in a mobile device. -var mobileGecko = mobile && gecko; - -// @property retina: Boolean -// `true` for browsers on a high-resolution "retina" screen or on any screen when browser's display zoom is more than 100%. -var retina = (window.devicePixelRatio || (window.screen.deviceXDPI / window.screen.logicalXDPI)) > 1; - - -// @property canvas: Boolean -// `true` when the browser supports [``](https://developer.mozilla.org/docs/Web/API/Canvas_API). -var canvas = (function () { - return !!document.createElement('canvas').getContext; -}()); - -// @property svg: Boolean -// `true` when the browser supports [SVG](https://developer.mozilla.org/docs/Web/SVG). -var svg = !!(document.createElementNS && svgCreate('svg').createSVGRect); - -// @property vml: Boolean -// `true` if the browser supports [VML](https://en.wikipedia.org/wiki/Vector_Markup_Language). -var vml = !svg && (function () { - try { - var div = document.createElement('div'); - div.innerHTML = ''; - - var shape = div.firstChild; - shape.style.behavior = 'url(#default#VML)'; - - return shape && (typeof shape.adj === 'object'); - - } catch (e) { - return false; - } -}()); - - -function userAgentContains(str) { - return navigator.userAgent.toLowerCase().indexOf(str) >= 0; -} - - -var Browser = (Object.freeze || Object)({ - ie: ie, - ielt9: ielt9, - edge: edge, - webkit: webkit, - android: android, - android23: android23, - androidStock: androidStock, - opera: opera, - chrome: chrome, - gecko: gecko, - safari: safari, - phantom: phantom, - opera12: opera12, - win: win, - ie3d: ie3d, - webkit3d: webkit3d, - gecko3d: gecko3d, - any3d: any3d, - mobile: mobile, - mobileWebkit: mobileWebkit, - mobileWebkit3d: mobileWebkit3d, - msPointer: msPointer, - pointer: pointer, - touch: touch, - mobileOpera: mobileOpera, - mobileGecko: mobileGecko, - retina: retina, - canvas: canvas, - svg: svg, - vml: vml -}); - -/* - * Extends L.DomEvent to provide touch support for Internet Explorer and Windows-based devices. - */ - - -var POINTER_DOWN = msPointer ? 'MSPointerDown' : 'pointerdown'; -var POINTER_MOVE = msPointer ? 'MSPointerMove' : 'pointermove'; -var POINTER_UP = msPointer ? 'MSPointerUp' : 'pointerup'; -var POINTER_CANCEL = msPointer ? 'MSPointerCancel' : 'pointercancel'; -var TAG_WHITE_LIST = ['INPUT', 'SELECT', 'OPTION']; - -var _pointers = {}; -var _pointerDocListener = false; - -// DomEvent.DoubleTap needs to know about this -var _pointersCount = 0; - -// Provides a touch events wrapper for (ms)pointer events. -// ref http://www.w3.org/TR/pointerevents/ https://www.w3.org/Bugs/Public/show_bug.cgi?id=22890 - -function addPointerListener(obj, type, handler, id) { - if (type === 'touchstart') { - _addPointerStart(obj, handler, id); - - } else if (type === 'touchmove') { - _addPointerMove(obj, handler, id); - - } else if (type === 'touchend') { - _addPointerEnd(obj, handler, id); - } - - return this; -} - -function removePointerListener(obj, type, id) { - var handler = obj['_leaflet_' + type + id]; - - if (type === 'touchstart') { - obj.removeEventListener(POINTER_DOWN, handler, false); - - } else if (type === 'touchmove') { - obj.removeEventListener(POINTER_MOVE, handler, false); - - } else if (type === 'touchend') { - obj.removeEventListener(POINTER_UP, handler, false); - obj.removeEventListener(POINTER_CANCEL, handler, false); - } - - return this; -} - -function _addPointerStart(obj, handler, id) { - var onDown = bind(function (e) { - if (e.pointerType !== 'mouse' && e.MSPOINTER_TYPE_MOUSE && e.pointerType !== e.MSPOINTER_TYPE_MOUSE) { - // In IE11, some touch events needs to fire for form controls, or - // the controls will stop working. We keep a whitelist of tag names that - // need these events. For other target tags, we prevent default on the event. - if (TAG_WHITE_LIST.indexOf(e.target.tagName) < 0) { - preventDefault(e); - } else { - return; - } - } - - _handlePointer(e, handler); - }); - - obj['_leaflet_touchstart' + id] = onDown; - obj.addEventListener(POINTER_DOWN, onDown, false); - - // need to keep track of what pointers and how many are active to provide e.touches emulation - if (!_pointerDocListener) { - // we listen documentElement as any drags that end by moving the touch off the screen get fired there - document.documentElement.addEventListener(POINTER_DOWN, _globalPointerDown, true); - document.documentElement.addEventListener(POINTER_MOVE, _globalPointerMove, true); - document.documentElement.addEventListener(POINTER_UP, _globalPointerUp, true); - document.documentElement.addEventListener(POINTER_CANCEL, _globalPointerUp, true); - - _pointerDocListener = true; - } -} - -function _globalPointerDown(e) { - _pointers[e.pointerId] = e; - _pointersCount++; -} - -function _globalPointerMove(e) { - if (_pointers[e.pointerId]) { - _pointers[e.pointerId] = e; - } -} - -function _globalPointerUp(e) { - delete _pointers[e.pointerId]; - _pointersCount--; -} - -function _handlePointer(e, handler) { - e.touches = []; - for (var i in _pointers) { - e.touches.push(_pointers[i]); - } - e.changedTouches = [e]; - - handler(e); -} - -function _addPointerMove(obj, handler, id) { - var onMove = function (e) { - // don't fire touch moves when mouse isn't down - if ((e.pointerType === e.MSPOINTER_TYPE_MOUSE || e.pointerType === 'mouse') && e.buttons === 0) { return; } - - _handlePointer(e, handler); - }; - - obj['_leaflet_touchmove' + id] = onMove; - obj.addEventListener(POINTER_MOVE, onMove, false); -} - -function _addPointerEnd(obj, handler, id) { - var onUp = function (e) { - _handlePointer(e, handler); - }; - - obj['_leaflet_touchend' + id] = onUp; - obj.addEventListener(POINTER_UP, onUp, false); - obj.addEventListener(POINTER_CANCEL, onUp, false); -} - -/* - * Extends the event handling code with double tap support for mobile browsers. - */ - -var _touchstart = msPointer ? 'MSPointerDown' : pointer ? 'pointerdown' : 'touchstart'; -var _touchend = msPointer ? 'MSPointerUp' : pointer ? 'pointerup' : 'touchend'; -var _pre = '_leaflet_'; - -// inspired by Zepto touch code by Thomas Fuchs -function addDoubleTapListener(obj, handler, id) { - var last, touch$$1, - doubleTap = false, - delay = 250; - - function onTouchStart(e) { - var count; - - if (pointer) { - if ((!edge) || e.pointerType === 'mouse') { return; } - count = _pointersCount; - } else { - count = e.touches.length; - } - - if (count > 1) { return; } - - var now = Date.now(), - delta = now - (last || now); - - touch$$1 = e.touches ? e.touches[0] : e; - doubleTap = (delta > 0 && delta <= delay); - last = now; - } - - function onTouchEnd(e) { - if (doubleTap && !touch$$1.cancelBubble) { - if (pointer) { - if ((!edge) || e.pointerType === 'mouse') { return; } - // work around .type being readonly with MSPointer* events - var newTouch = {}, - prop, i; - - for (i in touch$$1) { - prop = touch$$1[i]; - newTouch[i] = prop && prop.bind ? prop.bind(touch$$1) : prop; - } - touch$$1 = newTouch; - } - touch$$1.type = 'dblclick'; - handler(touch$$1); - last = null; - } - } - - obj[_pre + _touchstart + id] = onTouchStart; - obj[_pre + _touchend + id] = onTouchEnd; - obj[_pre + 'dblclick' + id] = handler; - - obj.addEventListener(_touchstart, onTouchStart, false); - obj.addEventListener(_touchend, onTouchEnd, false); - - // On some platforms (notably, chrome<55 on win10 + touchscreen + mouse), - // the browser doesn't fire touchend/pointerup events but does fire - // native dblclicks. See #4127. - // Edge 14 also fires native dblclicks, but only for pointerType mouse, see #5180. - obj.addEventListener('dblclick', handler, false); - - return this; -} - -function removeDoubleTapListener(obj, id) { - var touchstart = obj[_pre + _touchstart + id], - touchend = obj[_pre + _touchend + id], - dblclick = obj[_pre + 'dblclick' + id]; - - obj.removeEventListener(_touchstart, touchstart, false); - obj.removeEventListener(_touchend, touchend, false); - if (!edge) { - obj.removeEventListener('dblclick', dblclick, false); - } - - return this; -} - -/* - * @namespace DomUtil - * - * Utility functions to work with the [DOM](https://developer.mozilla.org/docs/Web/API/Document_Object_Model) - * tree, used by Leaflet internally. - * - * Most functions expecting or returning a `HTMLElement` also work for - * SVG elements. The only difference is that classes refer to CSS classes - * in HTML and SVG classes in SVG. - */ - - -// @property TRANSFORM: String -// Vendor-prefixed transform style name (e.g. `'webkitTransform'` for WebKit). -var TRANSFORM = testProp( - ['transform', 'webkitTransform', 'OTransform', 'MozTransform', 'msTransform']); - -// webkitTransition comes first because some browser versions that drop vendor prefix don't do -// the same for the transitionend event, in particular the Android 4.1 stock browser - -// @property TRANSITION: String -// Vendor-prefixed transition style name. -var TRANSITION = testProp( - ['webkitTransition', 'transition', 'OTransition', 'MozTransition', 'msTransition']); - -// @property TRANSITION_END: String -// Vendor-prefixed transitionend event name. -var TRANSITION_END = - TRANSITION === 'webkitTransition' || TRANSITION === 'OTransition' ? TRANSITION + 'End' : 'transitionend'; - - -// @function get(id: String|HTMLElement): HTMLElement -// Returns an element given its DOM id, or returns the element itself -// if it was passed directly. -function get(id) { - return typeof id === 'string' ? document.getElementById(id) : id; -} - -// @function getStyle(el: HTMLElement, styleAttrib: String): String -// Returns the value for a certain style attribute on an element, -// including computed values or values set through CSS. -function getStyle(el, style) { - var value = el.style[style] || (el.currentStyle && el.currentStyle[style]); - - if ((!value || value === 'auto') && document.defaultView) { - var css = document.defaultView.getComputedStyle(el, null); - value = css ? css[style] : null; - } - return value === 'auto' ? null : value; -} - -// @function create(tagName: String, className?: String, container?: HTMLElement): HTMLElement -// Creates an HTML element with `tagName`, sets its class to `className`, and optionally appends it to `container` element. -function create$1(tagName, className, container) { - var el = document.createElement(tagName); - el.className = className || ''; - - if (container) { - container.appendChild(el); - } - return el; -} - -// @function remove(el: HTMLElement) -// Removes `el` from its parent element -function remove(el) { - var parent = el.parentNode; - if (parent) { - parent.removeChild(el); - } -} - -// @function empty(el: HTMLElement) -// Removes all of `el`'s children elements from `el` -function empty(el) { - while (el.firstChild) { - el.removeChild(el.firstChild); - } -} - -// @function toFront(el: HTMLElement) -// Makes `el` the last child of its parent, so it renders in front of the other children. -function toFront(el) { - var parent = el.parentNode; - if (parent && parent.lastChild !== el) { - parent.appendChild(el); - } -} - -// @function toBack(el: HTMLElement) -// Makes `el` the first child of its parent, so it renders behind the other children. -function toBack(el) { - var parent = el.parentNode; - if (parent && parent.firstChild !== el) { - parent.insertBefore(el, parent.firstChild); - } -} - -// @function hasClass(el: HTMLElement, name: String): Boolean -// Returns `true` if the element's class attribute contains `name`. -function hasClass(el, name) { - if (el.classList !== undefined) { - return el.classList.contains(name); - } - var className = getClass(el); - return className.length > 0 && new RegExp('(^|\\s)' + name + '(\\s|$)').test(className); -} - -// @function addClass(el: HTMLElement, name: String) -// Adds `name` to the element's class attribute. -function addClass(el, name) { - if (el.classList !== undefined) { - var classes = splitWords(name); - for (var i = 0, len = classes.length; i < len; i++) { - el.classList.add(classes[i]); - } - } else if (!hasClass(el, name)) { - var className = getClass(el); - setClass(el, (className ? className + ' ' : '') + name); - } -} - -// @function removeClass(el: HTMLElement, name: String) -// Removes `name` from the element's class attribute. -function removeClass(el, name) { - if (el.classList !== undefined) { - el.classList.remove(name); - } else { - setClass(el, trim((' ' + getClass(el) + ' ').replace(' ' + name + ' ', ' '))); - } -} - -// @function setClass(el: HTMLElement, name: String) -// Sets the element's class. -function setClass(el, name) { - if (el.className.baseVal === undefined) { - el.className = name; - } else { - // in case of SVG element - el.className.baseVal = name; - } -} - -// @function getClass(el: HTMLElement): String -// Returns the element's class. -function getClass(el) { - // Check if the element is an SVGElementInstance and use the correspondingElement instead - // (Required for linked SVG elements in IE11.) - if (el.correspondingElement) { - el = el.correspondingElement; - } - return el.className.baseVal === undefined ? el.className : el.className.baseVal; -} - -// @function setOpacity(el: HTMLElement, opacity: Number) -// Set the opacity of an element (including old IE support). -// `opacity` must be a number from `0` to `1`. -function setOpacity(el, value) { - if ('opacity' in el.style) { - el.style.opacity = value; - } else if ('filter' in el.style) { - _setOpacityIE(el, value); - } -} - -function _setOpacityIE(el, value) { - var filter = false, - filterName = 'DXImageTransform.Microsoft.Alpha'; - - // filters collection throws an error if we try to retrieve a filter that doesn't exist - try { - filter = el.filters.item(filterName); - } catch (e) { - // don't set opacity to 1 if we haven't already set an opacity, - // it isn't needed and breaks transparent pngs. - if (value === 1) { return; } - } - - value = Math.round(value * 100); - - if (filter) { - filter.Enabled = (value !== 100); - filter.Opacity = value; - } else { - el.style.filter += ' progid:' + filterName + '(opacity=' + value + ')'; - } -} - -// @function testProp(props: String[]): String|false -// Goes through the array of style names and returns the first name -// that is a valid style name for an element. If no such name is found, -// it returns false. Useful for vendor-prefixed styles like `transform`. -function testProp(props) { - var style = document.documentElement.style; - - for (var i = 0; i < props.length; i++) { - if (props[i] in style) { - return props[i]; - } - } - return false; -} - -// @function setTransform(el: HTMLElement, offset: Point, scale?: Number) -// Resets the 3D CSS transform of `el` so it is translated by `offset` pixels -// and optionally scaled by `scale`. Does not have an effect if the -// browser doesn't support 3D CSS transforms. -function setTransform(el, offset, scale) { - var pos = offset || new Point(0, 0); - - el.style[TRANSFORM] = - (ie3d ? - 'translate(' + pos.x + 'px,' + pos.y + 'px)' : - 'translate3d(' + pos.x + 'px,' + pos.y + 'px,0)') + - (scale ? ' scale(' + scale + ')' : ''); -} - -// @function setPosition(el: HTMLElement, position: Point) -// Sets the position of `el` to coordinates specified by `position`, -// using CSS translate or top/left positioning depending on the browser -// (used by Leaflet internally to position its layers). -function setPosition(el, point) { - - /*eslint-disable */ - el._leaflet_pos = point; - /* eslint-enable */ - - if (any3d) { - setTransform(el, point); - } else { - el.style.left = point.x + 'px'; - el.style.top = point.y + 'px'; - } -} - -// @function getPosition(el: HTMLElement): Point -// Returns the coordinates of an element previously positioned with setPosition. -function getPosition(el) { - // this method is only used for elements previously positioned using setPosition, - // so it's safe to cache the position for performance - - return el._leaflet_pos || new Point(0, 0); -} - -// @function disableTextSelection() -// Prevents the user from generating `selectstart` DOM events, usually generated -// when the user drags the mouse through a page with text. Used internally -// by Leaflet to override the behaviour of any click-and-drag interaction on -// the map. Affects drag interactions on the whole document. - -// @function enableTextSelection() -// Cancels the effects of a previous [`L.DomUtil.disableTextSelection`](#domutil-disabletextselection). -var disableTextSelection; -var enableTextSelection; -var _userSelect; -if ('onselectstart' in document) { - disableTextSelection = function () { - on(window, 'selectstart', preventDefault); - }; - enableTextSelection = function () { - off(window, 'selectstart', preventDefault); - }; -} else { - var userSelectProperty = testProp( - ['userSelect', 'WebkitUserSelect', 'OUserSelect', 'MozUserSelect', 'msUserSelect']); - - disableTextSelection = function () { - if (userSelectProperty) { - var style = document.documentElement.style; - _userSelect = style[userSelectProperty]; - style[userSelectProperty] = 'none'; - } - }; - enableTextSelection = function () { - if (userSelectProperty) { - document.documentElement.style[userSelectProperty] = _userSelect; - _userSelect = undefined; - } - }; -} - -// @function disableImageDrag() -// As [`L.DomUtil.disableTextSelection`](#domutil-disabletextselection), but -// for `dragstart` DOM events, usually generated when the user drags an image. -function disableImageDrag() { - on(window, 'dragstart', preventDefault); -} - -// @function enableImageDrag() -// Cancels the effects of a previous [`L.DomUtil.disableImageDrag`](#domutil-disabletextselection). -function enableImageDrag() { - off(window, 'dragstart', preventDefault); -} - -var _outlineElement; -var _outlineStyle; -// @function preventOutline(el: HTMLElement) -// Makes the [outline](https://developer.mozilla.org/docs/Web/CSS/outline) -// of the element `el` invisible. Used internally by Leaflet to prevent -// focusable elements from displaying an outline when the user performs a -// drag interaction on them. -function preventOutline(element) { - while (element.tabIndex === -1) { - element = element.parentNode; - } - if (!element.style) { return; } - restoreOutline(); - _outlineElement = element; - _outlineStyle = element.style.outline; - element.style.outline = 'none'; - on(window, 'keydown', restoreOutline); -} - -// @function restoreOutline() -// Cancels the effects of a previous [`L.DomUtil.preventOutline`](). -function restoreOutline() { - if (!_outlineElement) { return; } - _outlineElement.style.outline = _outlineStyle; - _outlineElement = undefined; - _outlineStyle = undefined; - off(window, 'keydown', restoreOutline); -} - -// @function getSizedParentNode(el: HTMLElement): HTMLElement -// Finds the closest parent node which size (width and height) is not null. -function getSizedParentNode(element) { - do { - element = element.parentNode; - } while ((!element.offsetWidth || !element.offsetHeight) && element !== document.body); - return element; -} - -// @function getScale(el: HTMLElement): Object -// Computes the CSS scale currently applied on the element. -// Returns an object with `x` and `y` members as horizontal and vertical scales respectively, -// and `boundingClientRect` as the result of [`getBoundingClientRect()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect). -function getScale(element) { - var rect = element.getBoundingClientRect(); // Read-only in old browsers. - - return { - x: rect.width / element.offsetWidth || 1, - y: rect.height / element.offsetHeight || 1, - boundingClientRect: rect - }; -} - - -var DomUtil = (Object.freeze || Object)({ - TRANSFORM: TRANSFORM, - TRANSITION: TRANSITION, - TRANSITION_END: TRANSITION_END, - get: get, - getStyle: getStyle, - create: create$1, - remove: remove, - empty: empty, - toFront: toFront, - toBack: toBack, - hasClass: hasClass, - addClass: addClass, - removeClass: removeClass, - setClass: setClass, - getClass: getClass, - setOpacity: setOpacity, - testProp: testProp, - setTransform: setTransform, - setPosition: setPosition, - getPosition: getPosition, - disableTextSelection: disableTextSelection, - enableTextSelection: enableTextSelection, - disableImageDrag: disableImageDrag, - enableImageDrag: enableImageDrag, - preventOutline: preventOutline, - restoreOutline: restoreOutline, - getSizedParentNode: getSizedParentNode, - getScale: getScale -}); - -/* - * @namespace DomEvent - * Utility functions to work with the [DOM events](https://developer.mozilla.org/docs/Web/API/Event), used by Leaflet internally. - */ - -// Inspired by John Resig, Dean Edwards and YUI addEvent implementations. - -// @function on(el: HTMLElement, types: String, fn: Function, context?: Object): this -// Adds a listener function (`fn`) to a particular DOM event type of the -// element `el`. You can optionally specify the context of the listener -// (object the `this` keyword will point to). You can also pass several -// space-separated types (e.g. `'click dblclick'`). - -// @alternative -// @function on(el: HTMLElement, eventMap: Object, context?: Object): this -// Adds a set of type/listener pairs, e.g. `{click: onClick, mousemove: onMouseMove}` -function on(obj, types, fn, context) { - - if (typeof types === 'object') { - for (var type in types) { - addOne(obj, type, types[type], fn); - } - } else { - types = splitWords(types); - - for (var i = 0, len = types.length; i < len; i++) { - addOne(obj, types[i], fn, context); - } - } - - return this; -} - -var eventsKey = '_leaflet_events'; - -// @function off(el: HTMLElement, types: String, fn: Function, context?: Object): this -// Removes a previously added listener function. -// Note that if you passed a custom context to on, you must pass the same -// context to `off` in order to remove the listener. - -// @alternative -// @function off(el: HTMLElement, eventMap: Object, context?: Object): this -// Removes a set of type/listener pairs, e.g. `{click: onClick, mousemove: onMouseMove}` -function off(obj, types, fn, context) { - - if (typeof types === 'object') { - for (var type in types) { - removeOne(obj, type, types[type], fn); - } - } else if (types) { - types = splitWords(types); - - for (var i = 0, len = types.length; i < len; i++) { - removeOne(obj, types[i], fn, context); - } - } else { - for (var j in obj[eventsKey]) { - removeOne(obj, j, obj[eventsKey][j]); - } - delete obj[eventsKey]; - } - - return this; -} - -function addOne(obj, type, fn, context) { - var id = type + stamp(fn) + (context ? '_' + stamp(context) : ''); - - if (obj[eventsKey] && obj[eventsKey][id]) { return this; } - - var handler = function (e) { - return fn.call(context || obj, e || window.event); - }; - - var originalHandler = handler; - - if (pointer && type.indexOf('touch') === 0) { - // Needs DomEvent.Pointer.js - addPointerListener(obj, type, handler, id); - - } else if (touch && (type === 'dblclick') && addDoubleTapListener && - !(pointer && chrome)) { - // Chrome >55 does not need the synthetic dblclicks from addDoubleTapListener - // See #5180 - addDoubleTapListener(obj, handler, id); - - } else if ('addEventListener' in obj) { - - if (type === 'mousewheel') { - obj.addEventListener('onwheel' in obj ? 'wheel' : 'mousewheel', handler, false); - - } else if ((type === 'mouseenter') || (type === 'mouseleave')) { - handler = function (e) { - e = e || window.event; - if (isExternalTarget(obj, e)) { - originalHandler(e); - } - }; - obj.addEventListener(type === 'mouseenter' ? 'mouseover' : 'mouseout', handler, false); - - } else { - if (type === 'click' && android) { - handler = function (e) { - filterClick(e, originalHandler); - }; - } - obj.addEventListener(type, handler, false); - } - - } else if ('attachEvent' in obj) { - obj.attachEvent('on' + type, handler); - } - - obj[eventsKey] = obj[eventsKey] || {}; - obj[eventsKey][id] = handler; -} - -function removeOne(obj, type, fn, context) { - - var id = type + stamp(fn) + (context ? '_' + stamp(context) : ''), - handler = obj[eventsKey] && obj[eventsKey][id]; - - if (!handler) { return this; } - - if (pointer && type.indexOf('touch') === 0) { - removePointerListener(obj, type, id); - - } else if (touch && (type === 'dblclick') && removeDoubleTapListener && - !(pointer && chrome)) { - removeDoubleTapListener(obj, id); - - } else if ('removeEventListener' in obj) { - - if (type === 'mousewheel') { - obj.removeEventListener('onwheel' in obj ? 'wheel' : 'mousewheel', handler, false); - - } else { - obj.removeEventListener( - type === 'mouseenter' ? 'mouseover' : - type === 'mouseleave' ? 'mouseout' : type, handler, false); - } - - } else if ('detachEvent' in obj) { - obj.detachEvent('on' + type, handler); - } - - obj[eventsKey][id] = null; -} - -// @function stopPropagation(ev: DOMEvent): this -// Stop the given event from propagation to parent elements. Used inside the listener functions: -// ```js -// L.DomEvent.on(div, 'click', function (ev) { -// L.DomEvent.stopPropagation(ev); -// }); -// ``` -function stopPropagation(e) { - - if (e.stopPropagation) { - e.stopPropagation(); - } else if (e.originalEvent) { // In case of Leaflet event. - e.originalEvent._stopped = true; - } else { - e.cancelBubble = true; - } - skipped(e); - - return this; -} - -// @function disableScrollPropagation(el: HTMLElement): this -// Adds `stopPropagation` to the element's `'mousewheel'` events (plus browser variants). -function disableScrollPropagation(el) { - addOne(el, 'mousewheel', stopPropagation); - return this; -} - -// @function disableClickPropagation(el: HTMLElement): this -// Adds `stopPropagation` to the element's `'click'`, `'doubleclick'`, -// `'mousedown'` and `'touchstart'` events (plus browser variants). -function disableClickPropagation(el) { - on(el, 'mousedown touchstart dblclick', stopPropagation); - addOne(el, 'click', fakeStop); - return this; -} - -// @function preventDefault(ev: DOMEvent): this -// Prevents the default action of the DOM Event `ev` from happening (such as -// following a link in the href of the a element, or doing a POST request -// with page reload when a `
    ` is submitted). -// Use it inside listener functions. -function preventDefault(e) { - if (e.preventDefault) { - e.preventDefault(); - } else { - e.returnValue = false; - } - return this; -} - -// @function stop(ev: DOMEvent): this -// Does `stopPropagation` and `preventDefault` at the same time. -function stop(e) { - preventDefault(e); - stopPropagation(e); - return this; -} - -// @function getMousePosition(ev: DOMEvent, container?: HTMLElement): Point -// Gets normalized mouse position from a DOM event relative to the -// `container` (border excluded) or to the whole page if not specified. -function getMousePosition(e, container) { - if (!container) { - return new Point(e.clientX, e.clientY); - } - - var scale = getScale(container), - offset = scale.boundingClientRect; // left and top values are in page scale (like the event clientX/Y) - - return new Point( - // offset.left/top values are in page scale (like clientX/Y), - // whereas clientLeft/Top (border width) values are the original values (before CSS scale applies). - (e.clientX - offset.left) / scale.x - container.clientLeft, - (e.clientY - offset.top) / scale.y - container.clientTop - ); -} - -// Chrome on Win scrolls double the pixels as in other platforms (see #4538), -// and Firefox scrolls device pixels, not CSS pixels -var wheelPxFactor = - (win && chrome) ? 2 * window.devicePixelRatio : - gecko ? window.devicePixelRatio : 1; - -// @function getWheelDelta(ev: DOMEvent): Number -// Gets normalized wheel delta from a mousewheel DOM event, in vertical -// pixels scrolled (negative if scrolling down). -// Events from pointing devices without precise scrolling are mapped to -// a best guess of 60 pixels. -function getWheelDelta(e) { - return (edge) ? e.wheelDeltaY / 2 : // Don't trust window-geometry-based delta - (e.deltaY && e.deltaMode === 0) ? -e.deltaY / wheelPxFactor : // Pixels - (e.deltaY && e.deltaMode === 1) ? -e.deltaY * 20 : // Lines - (e.deltaY && e.deltaMode === 2) ? -e.deltaY * 60 : // Pages - (e.deltaX || e.deltaZ) ? 0 : // Skip horizontal/depth wheel events - e.wheelDelta ? (e.wheelDeltaY || e.wheelDelta) / 2 : // Legacy IE pixels - (e.detail && Math.abs(e.detail) < 32765) ? -e.detail * 20 : // Legacy Moz lines - e.detail ? e.detail / -32765 * 60 : // Legacy Moz pages - 0; -} - -var skipEvents = {}; - -function fakeStop(e) { - // fakes stopPropagation by setting a special event flag, checked/reset with skipped(e) - skipEvents[e.type] = true; -} - -function skipped(e) { - var events = skipEvents[e.type]; - // reset when checking, as it's only used in map container and propagates outside of the map - skipEvents[e.type] = false; - return events; -} - -// check if element really left/entered the event target (for mouseenter/mouseleave) -function isExternalTarget(el, e) { - - var related = e.relatedTarget; - - if (!related) { return true; } - - try { - while (related && (related !== el)) { - related = related.parentNode; - } - } catch (err) { - return false; - } - return (related !== el); -} - -var lastClick; - -// this is a horrible workaround for a bug in Android where a single touch triggers two click events -function filterClick(e, handler) { - var timeStamp = (e.timeStamp || (e.originalEvent && e.originalEvent.timeStamp)), - elapsed = lastClick && (timeStamp - lastClick); - - // are they closer together than 500ms yet more than 100ms? - // Android typically triggers them ~300ms apart while multiple listeners - // on the same event should be triggered far faster; - // or check if click is simulated on the element, and if it is, reject any non-simulated events - - if ((elapsed && elapsed > 100 && elapsed < 500) || (e.target._simulatedClick && !e._simulated)) { - stop(e); - return; - } - lastClick = timeStamp; - - handler(e); -} - - - - -var DomEvent = (Object.freeze || Object)({ - on: on, - off: off, - stopPropagation: stopPropagation, - disableScrollPropagation: disableScrollPropagation, - disableClickPropagation: disableClickPropagation, - preventDefault: preventDefault, - stop: stop, - getMousePosition: getMousePosition, - getWheelDelta: getWheelDelta, - fakeStop: fakeStop, - skipped: skipped, - isExternalTarget: isExternalTarget, - addListener: on, - removeListener: off -}); - -/* - * @class PosAnimation - * @aka L.PosAnimation - * @inherits Evented - * Used internally for panning animations, utilizing CSS3 Transitions for modern browsers and a timer fallback for IE6-9. - * - * @example - * ```js - * var fx = new L.PosAnimation(); - * fx.run(el, [300, 500], 0.5); - * ``` - * - * @constructor L.PosAnimation() - * Creates a `PosAnimation` object. - * - */ - -var PosAnimation = Evented.extend({ - - // @method run(el: HTMLElement, newPos: Point, duration?: Number, easeLinearity?: Number) - // Run an animation of a given element to a new position, optionally setting - // duration in seconds (`0.25` by default) and easing linearity factor (3rd - // argument of the [cubic bezier curve](http://cubic-bezier.com/#0,0,.5,1), - // `0.5` by default). - run: function (el, newPos, duration, easeLinearity) { - this.stop(); - - this._el = el; - this._inProgress = true; - this._duration = duration || 0.25; - this._easeOutPower = 1 / Math.max(easeLinearity || 0.5, 0.2); - - this._startPos = getPosition(el); - this._offset = newPos.subtract(this._startPos); - this._startTime = +new Date(); - - // @event start: Event - // Fired when the animation starts - this.fire('start'); - - this._animate(); - }, - - // @method stop() - // Stops the animation (if currently running). - stop: function () { - if (!this._inProgress) { return; } - - this._step(true); - this._complete(); - }, - - _animate: function () { - // animation loop - this._animId = requestAnimFrame(this._animate, this); - this._step(); - }, - - _step: function (round) { - var elapsed = (+new Date()) - this._startTime, - duration = this._duration * 1000; - - if (elapsed < duration) { - this._runFrame(this._easeOut(elapsed / duration), round); - } else { - this._runFrame(1); - this._complete(); - } - }, - - _runFrame: function (progress, round) { - var pos = this._startPos.add(this._offset.multiplyBy(progress)); - if (round) { - pos._round(); - } - setPosition(this._el, pos); - - // @event step: Event - // Fired continuously during the animation. - this.fire('step'); - }, - - _complete: function () { - cancelAnimFrame(this._animId); - - this._inProgress = false; - // @event end: Event - // Fired when the animation ends. - this.fire('end'); - }, - - _easeOut: function (t) { - return 1 - Math.pow(1 - t, this._easeOutPower); - } -}); - -/* - * @class Map - * @aka L.Map - * @inherits Evented - * - * The central class of the API — it is used to create a map on a page and manipulate it. - * - * @example - * - * ```js - * // initialize the map on the "map" div with a given center and zoom - * var map = L.map('map', { - * center: [51.505, -0.09], - * zoom: 13 - * }); - * ``` - * - */ - -var Map = Evented.extend({ - - options: { - // @section Map State Options - // @option crs: CRS = L.CRS.EPSG3857 - // The [Coordinate Reference System](#crs) to use. Don't change this if you're not - // sure what it means. - crs: EPSG3857, - - // @option center: LatLng = undefined - // Initial geographic center of the map - center: undefined, - - // @option zoom: Number = undefined - // Initial map zoom level - zoom: undefined, - - // @option minZoom: Number = * - // Minimum zoom level of the map. - // If not specified and at least one `GridLayer` or `TileLayer` is in the map, - // the lowest of their `minZoom` options will be used instead. - minZoom: undefined, - - // @option maxZoom: Number = * - // Maximum zoom level of the map. - // If not specified and at least one `GridLayer` or `TileLayer` is in the map, - // the highest of their `maxZoom` options will be used instead. - maxZoom: undefined, - - // @option layers: Layer[] = [] - // Array of layers that will be added to the map initially - layers: [], - - // @option maxBounds: LatLngBounds = null - // When this option is set, the map restricts the view to the given - // geographical bounds, bouncing the user back if the user tries to pan - // outside the view. To set the restriction dynamically, use - // [`setMaxBounds`](#map-setmaxbounds) method. - maxBounds: undefined, - - // @option renderer: Renderer = * - // The default method for drawing vector layers on the map. `L.SVG` - // or `L.Canvas` by default depending on browser support. - renderer: undefined, - - - // @section Animation Options - // @option zoomAnimation: Boolean = true - // Whether the map zoom animation is enabled. By default it's enabled - // in all browsers that support CSS3 Transitions except Android. - zoomAnimation: true, - - // @option zoomAnimationThreshold: Number = 4 - // Won't animate zoom if the zoom difference exceeds this value. - zoomAnimationThreshold: 4, - - // @option fadeAnimation: Boolean = true - // Whether the tile fade animation is enabled. By default it's enabled - // in all browsers that support CSS3 Transitions except Android. - fadeAnimation: true, - - // @option markerZoomAnimation: Boolean = true - // Whether markers animate their zoom with the zoom animation, if disabled - // they will disappear for the length of the animation. By default it's - // enabled in all browsers that support CSS3 Transitions except Android. - markerZoomAnimation: true, - - // @option transform3DLimit: Number = 2^23 - // Defines the maximum size of a CSS translation transform. The default - // value should not be changed unless a web browser positions layers in - // the wrong place after doing a large `panBy`. - transform3DLimit: 8388608, // Precision limit of a 32-bit float - - // @section Interaction Options - // @option zoomSnap: Number = 1 - // Forces the map's zoom level to always be a multiple of this, particularly - // right after a [`fitBounds()`](#map-fitbounds) or a pinch-zoom. - // By default, the zoom level snaps to the nearest integer; lower values - // (e.g. `0.5` or `0.1`) allow for greater granularity. A value of `0` - // means the zoom level will not be snapped after `fitBounds` or a pinch-zoom. - zoomSnap: 1, - - // @option zoomDelta: Number = 1 - // Controls how much the map's zoom level will change after a - // [`zoomIn()`](#map-zoomin), [`zoomOut()`](#map-zoomout), pressing `+` - // or `-` on the keyboard, or using the [zoom controls](#control-zoom). - // Values smaller than `1` (e.g. `0.5`) allow for greater granularity. - zoomDelta: 1, - - // @option trackResize: Boolean = true - // Whether the map automatically handles browser window resize to update itself. - trackResize: true - }, - - initialize: function (id, options) { // (HTMLElement or String, Object) - options = setOptions(this, options); - - // Make sure to assign internal flags at the beginning, - // to avoid inconsistent state in some edge cases. - this._handlers = []; - this._layers = {}; - this._zoomBoundLayers = {}; - this._sizeChanged = true; - - this._initContainer(id); - this._initLayout(); - - // hack for https://github.com/Leaflet/Leaflet/issues/1980 - this._onResize = bind(this._onResize, this); - - this._initEvents(); - - if (options.maxBounds) { - this.setMaxBounds(options.maxBounds); - } - - if (options.zoom !== undefined) { - this._zoom = this._limitZoom(options.zoom); - } - - if (options.center && options.zoom !== undefined) { - this.setView(toLatLng(options.center), options.zoom, {reset: true}); - } - - this.callInitHooks(); - - // don't animate on browsers without hardware-accelerated transitions or old Android/Opera - this._zoomAnimated = TRANSITION && any3d && !mobileOpera && - this.options.zoomAnimation; - - // zoom transitions run with the same duration for all layers, so if one of transitionend events - // happens after starting zoom animation (propagating to the map pane), we know that it ended globally - if (this._zoomAnimated) { - this._createAnimProxy(); - on(this._proxy, TRANSITION_END, this._catchTransitionEnd, this); - } - - this._addLayers(this.options.layers); - }, - - - // @section Methods for modifying map state - - // @method setView(center: LatLng, zoom: Number, options?: Zoom/pan options): this - // Sets the view of the map (geographical center and zoom) with the given - // animation options. - setView: function (center, zoom, options) { - - zoom = zoom === undefined ? this._zoom : this._limitZoom(zoom); - center = this._limitCenter(toLatLng(center), zoom, this.options.maxBounds); - options = options || {}; - - this._stop(); - - if (this._loaded && !options.reset && options !== true) { - - if (options.animate !== undefined) { - options.zoom = extend({animate: options.animate}, options.zoom); - options.pan = extend({animate: options.animate, duration: options.duration}, options.pan); - } - - // try animating pan or zoom - var moved = (this._zoom !== zoom) ? - this._tryAnimatedZoom && this._tryAnimatedZoom(center, zoom, options.zoom) : - this._tryAnimatedPan(center, options.pan); - - if (moved) { - // prevent resize handler call, the view will refresh after animation anyway - clearTimeout(this._sizeTimer); - return this; - } - } - - // animation didn't start, just reset the map view - this._resetView(center, zoom); - - return this; - }, - - // @method setZoom(zoom: Number, options?: Zoom/pan options): this - // Sets the zoom of the map. - setZoom: function (zoom, options) { - if (!this._loaded) { - this._zoom = zoom; - return this; - } - return this.setView(this.getCenter(), zoom, {zoom: options}); - }, - - // @method zoomIn(delta?: Number, options?: Zoom options): this - // Increases the zoom of the map by `delta` ([`zoomDelta`](#map-zoomdelta) by default). - zoomIn: function (delta, options) { - delta = delta || (any3d ? this.options.zoomDelta : 1); - return this.setZoom(this._zoom + delta, options); - }, - - // @method zoomOut(delta?: Number, options?: Zoom options): this - // Decreases the zoom of the map by `delta` ([`zoomDelta`](#map-zoomdelta) by default). - zoomOut: function (delta, options) { - delta = delta || (any3d ? this.options.zoomDelta : 1); - return this.setZoom(this._zoom - delta, options); - }, - - // @method setZoomAround(latlng: LatLng, zoom: Number, options: Zoom options): this - // Zooms the map while keeping a specified geographical point on the map - // stationary (e.g. used internally for scroll zoom and double-click zoom). - // @alternative - // @method setZoomAround(offset: Point, zoom: Number, options: Zoom options): this - // Zooms the map while keeping a specified pixel on the map (relative to the top-left corner) stationary. - setZoomAround: function (latlng, zoom, options) { - var scale = this.getZoomScale(zoom), - viewHalf = this.getSize().divideBy(2), - containerPoint = latlng instanceof Point ? latlng : this.latLngToContainerPoint(latlng), - - centerOffset = containerPoint.subtract(viewHalf).multiplyBy(1 - 1 / scale), - newCenter = this.containerPointToLatLng(viewHalf.add(centerOffset)); - - return this.setView(newCenter, zoom, {zoom: options}); - }, - - _getBoundsCenterZoom: function (bounds, options) { - - options = options || {}; - bounds = bounds.getBounds ? bounds.getBounds() : toLatLngBounds(bounds); - - var paddingTL = toPoint(options.paddingTopLeft || options.padding || [0, 0]), - paddingBR = toPoint(options.paddingBottomRight || options.padding || [0, 0]), - - zoom = this.getBoundsZoom(bounds, false, paddingTL.add(paddingBR)); - - zoom = (typeof options.maxZoom === 'number') ? Math.min(options.maxZoom, zoom) : zoom; - - if (zoom === Infinity) { - return { - center: bounds.getCenter(), - zoom: zoom - }; - } - - var paddingOffset = paddingBR.subtract(paddingTL).divideBy(2), - - swPoint = this.project(bounds.getSouthWest(), zoom), - nePoint = this.project(bounds.getNorthEast(), zoom), - center = this.unproject(swPoint.add(nePoint).divideBy(2).add(paddingOffset), zoom); - - return { - center: center, - zoom: zoom - }; - }, - - // @method fitBounds(bounds: LatLngBounds, options?: fitBounds options): this - // Sets a map view that contains the given geographical bounds with the - // maximum zoom level possible. - fitBounds: function (bounds, options) { - - bounds = toLatLngBounds(bounds); - - if (!bounds.isValid()) { - throw new Error('Bounds are not valid.'); - } - - var target = this._getBoundsCenterZoom(bounds, options); - return this.setView(target.center, target.zoom, options); - }, - - // @method fitWorld(options?: fitBounds options): this - // Sets a map view that mostly contains the whole world with the maximum - // zoom level possible. - fitWorld: function (options) { - return this.fitBounds([[-90, -180], [90, 180]], options); - }, - - // @method panTo(latlng: LatLng, options?: Pan options): this - // Pans the map to a given center. - panTo: function (center, options) { // (LatLng) - return this.setView(center, this._zoom, {pan: options}); - }, - - // @method panBy(offset: Point, options?: Pan options): this - // Pans the map by a given number of pixels (animated). - panBy: function (offset, options) { - offset = toPoint(offset).round(); - options = options || {}; - - if (!offset.x && !offset.y) { - return this.fire('moveend'); - } - // If we pan too far, Chrome gets issues with tiles - // and makes them disappear or appear in the wrong place (slightly offset) #2602 - if (options.animate !== true && !this.getSize().contains(offset)) { - this._resetView(this.unproject(this.project(this.getCenter()).add(offset)), this.getZoom()); - return this; - } - - if (!this._panAnim) { - this._panAnim = new PosAnimation(); - - this._panAnim.on({ - 'step': this._onPanTransitionStep, - 'end': this._onPanTransitionEnd - }, this); - } - - // don't fire movestart if animating inertia - if (!options.noMoveStart) { - this.fire('movestart'); - } - - // animate pan unless animate: false specified - if (options.animate !== false) { - addClass(this._mapPane, 'leaflet-pan-anim'); - - var newPos = this._getMapPanePos().subtract(offset).round(); - this._panAnim.run(this._mapPane, newPos, options.duration || 0.25, options.easeLinearity); - } else { - this._rawPanBy(offset); - this.fire('move').fire('moveend'); - } - - return this; - }, - - // @method flyTo(latlng: LatLng, zoom?: Number, options?: Zoom/pan options): this - // Sets the view of the map (geographical center and zoom) performing a smooth - // pan-zoom animation. - flyTo: function (targetCenter, targetZoom, options) { - - options = options || {}; - if (options.animate === false || !any3d) { - return this.setView(targetCenter, targetZoom, options); - } - - this._stop(); - - var from = this.project(this.getCenter()), - to = this.project(targetCenter), - size = this.getSize(), - startZoom = this._zoom; - - targetCenter = toLatLng(targetCenter); - targetZoom = targetZoom === undefined ? startZoom : targetZoom; - - var w0 = Math.max(size.x, size.y), - w1 = w0 * this.getZoomScale(startZoom, targetZoom), - u1 = (to.distanceTo(from)) || 1, - rho = 1.42, - rho2 = rho * rho; - - function r(i) { - var s1 = i ? -1 : 1, - s2 = i ? w1 : w0, - t1 = w1 * w1 - w0 * w0 + s1 * rho2 * rho2 * u1 * u1, - b1 = 2 * s2 * rho2 * u1, - b = t1 / b1, - sq = Math.sqrt(b * b + 1) - b; - - // workaround for floating point precision bug when sq = 0, log = -Infinite, - // thus triggering an infinite loop in flyTo - var log = sq < 0.000000001 ? -18 : Math.log(sq); - - return log; - } - - function sinh(n) { return (Math.exp(n) - Math.exp(-n)) / 2; } - function cosh(n) { return (Math.exp(n) + Math.exp(-n)) / 2; } - function tanh(n) { return sinh(n) / cosh(n); } - - var r0 = r(0); - - function w(s) { return w0 * (cosh(r0) / cosh(r0 + rho * s)); } - function u(s) { return w0 * (cosh(r0) * tanh(r0 + rho * s) - sinh(r0)) / rho2; } - - function easeOut(t) { return 1 - Math.pow(1 - t, 1.5); } - - var start = Date.now(), - S = (r(1) - r0) / rho, - duration = options.duration ? 1000 * options.duration : 1000 * S * 0.8; - - function frame() { - var t = (Date.now() - start) / duration, - s = easeOut(t) * S; - - if (t <= 1) { - this._flyToFrame = requestAnimFrame(frame, this); - - this._move( - this.unproject(from.add(to.subtract(from).multiplyBy(u(s) / u1)), startZoom), - this.getScaleZoom(w0 / w(s), startZoom), - {flyTo: true}); - - } else { - this - ._move(targetCenter, targetZoom) - ._moveEnd(true); - } - } - - this._moveStart(true, options.noMoveStart); - - frame.call(this); - return this; - }, - - // @method flyToBounds(bounds: LatLngBounds, options?: fitBounds options): this - // Sets the view of the map with a smooth animation like [`flyTo`](#map-flyto), - // but takes a bounds parameter like [`fitBounds`](#map-fitbounds). - flyToBounds: function (bounds, options) { - var target = this._getBoundsCenterZoom(bounds, options); - return this.flyTo(target.center, target.zoom, options); - }, - - // @method setMaxBounds(bounds: Bounds): this - // Restricts the map view to the given bounds (see the [maxBounds](#map-maxbounds) option). - setMaxBounds: function (bounds) { - bounds = toLatLngBounds(bounds); - - if (!bounds.isValid()) { - this.options.maxBounds = null; - return this.off('moveend', this._panInsideMaxBounds); - } else if (this.options.maxBounds) { - this.off('moveend', this._panInsideMaxBounds); - } - - this.options.maxBounds = bounds; - - if (this._loaded) { - this._panInsideMaxBounds(); - } - - return this.on('moveend', this._panInsideMaxBounds); - }, - - // @method setMinZoom(zoom: Number): this - // Sets the lower limit for the available zoom levels (see the [minZoom](#map-minzoom) option). - setMinZoom: function (zoom) { - var oldZoom = this.options.minZoom; - this.options.minZoom = zoom; - - if (this._loaded && oldZoom !== zoom) { - this.fire('zoomlevelschange'); - - if (this.getZoom() < this.options.minZoom) { - return this.setZoom(zoom); - } - } - - return this; - }, - - // @method setMaxZoom(zoom: Number): this - // Sets the upper limit for the available zoom levels (see the [maxZoom](#map-maxzoom) option). - setMaxZoom: function (zoom) { - var oldZoom = this.options.maxZoom; - this.options.maxZoom = zoom; - - if (this._loaded && oldZoom !== zoom) { - this.fire('zoomlevelschange'); - - if (this.getZoom() > this.options.maxZoom) { - return this.setZoom(zoom); - } - } - - return this; - }, - - // @method panInsideBounds(bounds: LatLngBounds, options?: Pan options): this - // Pans the map to the closest view that would lie inside the given bounds (if it's not already), controlling the animation using the options specific, if any. - panInsideBounds: function (bounds, options) { - this._enforcingBounds = true; - var center = this.getCenter(), - newCenter = this._limitCenter(center, this._zoom, toLatLngBounds(bounds)); - - if (!center.equals(newCenter)) { - this.panTo(newCenter, options); - } - - this._enforcingBounds = false; - return this; - }, - - // @method panInside(latlng: LatLng, options?: options): this - // Pans the map the minimum amount to make the `latlng` visible. Use - // `padding`, `paddingTopLeft` and `paddingTopRight` options to fit - // the display to more restricted bounds, like [`fitBounds`](#map-fitbounds). - // If `latlng` is already within the (optionally padded) display bounds, - // the map will not be panned. - panInside: function (latlng, options) { - options = options || {}; - - var paddingTL = toPoint(options.paddingTopLeft || options.padding || [0, 0]), - paddingBR = toPoint(options.paddingBottomRight || options.padding || [0, 0]), - center = this.getCenter(), - pixelCenter = this.project(center), - pixelPoint = this.project(latlng), - pixelBounds = this.getPixelBounds(), - halfPixelBounds = pixelBounds.getSize().divideBy(2), - paddedBounds = toBounds([pixelBounds.min.add(paddingTL), pixelBounds.max.subtract(paddingBR)]); - - if (!paddedBounds.contains(pixelPoint)) { - this._enforcingBounds = true; - var diff = pixelCenter.subtract(pixelPoint), - newCenter = toPoint(pixelPoint.x + diff.x, pixelPoint.y + diff.y); - - if (pixelPoint.x < paddedBounds.min.x || pixelPoint.x > paddedBounds.max.x) { - newCenter.x = pixelCenter.x - diff.x; - if (diff.x > 0) { - newCenter.x += halfPixelBounds.x - paddingTL.x; - } else { - newCenter.x -= halfPixelBounds.x - paddingBR.x; - } - } - if (pixelPoint.y < paddedBounds.min.y || pixelPoint.y > paddedBounds.max.y) { - newCenter.y = pixelCenter.y - diff.y; - if (diff.y > 0) { - newCenter.y += halfPixelBounds.y - paddingTL.y; - } else { - newCenter.y -= halfPixelBounds.y - paddingBR.y; - } - } - this.panTo(this.unproject(newCenter), options); - this._enforcingBounds = false; - } - return this; - }, - - // @method invalidateSize(options: Zoom/pan options): this - // Checks if the map container size changed and updates the map if so — - // call it after you've changed the map size dynamically, also animating - // pan by default. If `options.pan` is `false`, panning will not occur. - // If `options.debounceMoveend` is `true`, it will delay `moveend` event so - // that it doesn't happen often even if the method is called many - // times in a row. - - // @alternative - // @method invalidateSize(animate: Boolean): this - // Checks if the map container size changed and updates the map if so — - // call it after you've changed the map size dynamically, also animating - // pan by default. - invalidateSize: function (options) { - if (!this._loaded) { return this; } - - options = extend({ - animate: false, - pan: true - }, options === true ? {animate: true} : options); - - var oldSize = this.getSize(); - this._sizeChanged = true; - this._lastCenter = null; - - var newSize = this.getSize(), - oldCenter = oldSize.divideBy(2).round(), - newCenter = newSize.divideBy(2).round(), - offset = oldCenter.subtract(newCenter); - - if (!offset.x && !offset.y) { return this; } - - if (options.animate && options.pan) { - this.panBy(offset); - - } else { - if (options.pan) { - this._rawPanBy(offset); - } - - this.fire('move'); - - if (options.debounceMoveend) { - clearTimeout(this._sizeTimer); - this._sizeTimer = setTimeout(bind(this.fire, this, 'moveend'), 200); - } else { - this.fire('moveend'); - } - } - - // @section Map state change events - // @event resize: ResizeEvent - // Fired when the map is resized. - return this.fire('resize', { - oldSize: oldSize, - newSize: newSize - }); - }, - - // @section Methods for modifying map state - // @method stop(): this - // Stops the currently running `panTo` or `flyTo` animation, if any. - stop: function () { - this.setZoom(this._limitZoom(this._zoom)); - if (!this.options.zoomSnap) { - this.fire('viewreset'); - } - return this._stop(); - }, - - // @section Geolocation methods - // @method locate(options?: Locate options): this - // Tries to locate the user using the Geolocation API, firing a [`locationfound`](#map-locationfound) - // event with location data on success or a [`locationerror`](#map-locationerror) event on failure, - // and optionally sets the map view to the user's location with respect to - // detection accuracy (or to the world view if geolocation failed). - // Note that, if your page doesn't use HTTPS, this method will fail in - // modern browsers ([Chrome 50 and newer](https://sites.google.com/a/chromium.org/dev/Home/chromium-security/deprecating-powerful-features-on-insecure-origins)) - // See `Locate options` for more details. - locate: function (options) { - - options = this._locateOptions = extend({ - timeout: 10000, - watch: false - // setView: false - // maxZoom: - // maximumAge: 0 - // enableHighAccuracy: false - }, options); - - if (!('geolocation' in navigator)) { - this._handleGeolocationError({ - code: 0, - message: 'Geolocation not supported.' - }); - return this; - } - - var onResponse = bind(this._handleGeolocationResponse, this), - onError = bind(this._handleGeolocationError, this); - - if (options.watch) { - this._locationWatchId = - navigator.geolocation.watchPosition(onResponse, onError, options); - } else { - navigator.geolocation.getCurrentPosition(onResponse, onError, options); - } - return this; - }, - - // @method stopLocate(): this - // Stops watching location previously initiated by `map.locate({watch: true})` - // and aborts resetting the map view if map.locate was called with - // `{setView: true}`. - stopLocate: function () { - if (navigator.geolocation && navigator.geolocation.clearWatch) { - navigator.geolocation.clearWatch(this._locationWatchId); - } - if (this._locateOptions) { - this._locateOptions.setView = false; - } - return this; - }, - - _handleGeolocationError: function (error) { - var c = error.code, - message = error.message || - (c === 1 ? 'permission denied' : - (c === 2 ? 'position unavailable' : 'timeout')); - - if (this._locateOptions.setView && !this._loaded) { - this.fitWorld(); - } - - // @section Location events - // @event locationerror: ErrorEvent - // Fired when geolocation (using the [`locate`](#map-locate) method) failed. - this.fire('locationerror', { - code: c, - message: 'Geolocation error: ' + message + '.' - }); - }, - - _handleGeolocationResponse: function (pos) { - var lat = pos.coords.latitude, - lng = pos.coords.longitude, - latlng = new LatLng(lat, lng), - bounds = latlng.toBounds(pos.coords.accuracy * 2), - options = this._locateOptions; - - if (options.setView) { - var zoom = this.getBoundsZoom(bounds); - this.setView(latlng, options.maxZoom ? Math.min(zoom, options.maxZoom) : zoom); - } - - var data = { - latlng: latlng, - bounds: bounds, - timestamp: pos.timestamp - }; - - for (var i in pos.coords) { - if (typeof pos.coords[i] === 'number') { - data[i] = pos.coords[i]; - } - } - - // @event locationfound: LocationEvent - // Fired when geolocation (using the [`locate`](#map-locate) method) - // went successfully. - this.fire('locationfound', data); - }, - - // TODO Appropriate docs section? - // @section Other Methods - // @method addHandler(name: String, HandlerClass: Function): this - // Adds a new `Handler` to the map, given its name and constructor function. - addHandler: function (name, HandlerClass) { - if (!HandlerClass) { return this; } - - var handler = this[name] = new HandlerClass(this); - - this._handlers.push(handler); - - if (this.options[name]) { - handler.enable(); - } - - return this; - }, - - // @method remove(): this - // Destroys the map and clears all related event listeners. - remove: function () { - - this._initEvents(true); - - if (this._containerId !== this._container._leaflet_id) { - throw new Error('Map container is being reused by another instance'); - } - - try { - // throws error in IE6-8 - delete this._container._leaflet_id; - delete this._containerId; - } catch (e) { - /*eslint-disable */ - this._container._leaflet_id = undefined; - /* eslint-enable */ - this._containerId = undefined; - } - - if (this._locationWatchId !== undefined) { - this.stopLocate(); - } - - this._stop(); - - remove(this._mapPane); - - if (this._clearControlPos) { - this._clearControlPos(); - } - if (this._resizeRequest) { - cancelAnimFrame(this._resizeRequest); - this._resizeRequest = null; - } - - this._clearHandlers(); - - if (this._loaded) { - // @section Map state change events - // @event unload: Event - // Fired when the map is destroyed with [remove](#map-remove) method. - this.fire('unload'); - } - - var i; - for (i in this._layers) { - this._layers[i].remove(); - } - for (i in this._panes) { - remove(this._panes[i]); - } - - this._layers = []; - this._panes = []; - delete this._mapPane; - delete this._renderer; - - return this; - }, - - // @section Other Methods - // @method createPane(name: String, container?: HTMLElement): HTMLElement - // Creates a new [map pane](#map-pane) with the given name if it doesn't exist already, - // then returns it. The pane is created as a child of `container`, or - // as a child of the main map pane if not set. - createPane: function (name, container) { - var className = 'leaflet-pane' + (name ? ' leaflet-' + name.replace('Pane', '') + '-pane' : ''), - pane = create$1('div', className, container || this._mapPane); - - if (name) { - this._panes[name] = pane; - } - return pane; - }, - - // @section Methods for Getting Map State - - // @method getCenter(): LatLng - // Returns the geographical center of the map view - getCenter: function () { - this._checkIfLoaded(); - - if (this._lastCenter && !this._moved()) { - return this._lastCenter; - } - return this.layerPointToLatLng(this._getCenterLayerPoint()); - }, - - // @method getZoom(): Number - // Returns the current zoom level of the map view - getZoom: function () { - return this._zoom; - }, - - // @method getBounds(): LatLngBounds - // Returns the geographical bounds visible in the current map view - getBounds: function () { - var bounds = this.getPixelBounds(), - sw = this.unproject(bounds.getBottomLeft()), - ne = this.unproject(bounds.getTopRight()); - - return new LatLngBounds(sw, ne); - }, - - // @method getMinZoom(): Number - // Returns the minimum zoom level of the map (if set in the `minZoom` option of the map or of any layers), or `0` by default. - getMinZoom: function () { - return this.options.minZoom === undefined ? this._layersMinZoom || 0 : this.options.minZoom; - }, - - // @method getMaxZoom(): Number - // Returns the maximum zoom level of the map (if set in the `maxZoom` option of the map or of any layers). - getMaxZoom: function () { - return this.options.maxZoom === undefined ? - (this._layersMaxZoom === undefined ? Infinity : this._layersMaxZoom) : - this.options.maxZoom; - }, - - // @method getBoundsZoom(bounds: LatLngBounds, inside?: Boolean, padding?: Point): Number - // Returns the maximum zoom level on which the given bounds fit to the map - // view in its entirety. If `inside` (optional) is set to `true`, the method - // instead returns the minimum zoom level on which the map view fits into - // the given bounds in its entirety. - getBoundsZoom: function (bounds, inside, padding) { // (LatLngBounds[, Boolean, Point]) -> Number - bounds = toLatLngBounds(bounds); - padding = toPoint(padding || [0, 0]); - - var zoom = this.getZoom() || 0, - min = this.getMinZoom(), - max = this.getMaxZoom(), - nw = bounds.getNorthWest(), - se = bounds.getSouthEast(), - size = this.getSize().subtract(padding), - boundsSize = toBounds(this.project(se, zoom), this.project(nw, zoom)).getSize(), - snap = any3d ? this.options.zoomSnap : 1, - scalex = size.x / boundsSize.x, - scaley = size.y / boundsSize.y, - scale = inside ? Math.max(scalex, scaley) : Math.min(scalex, scaley); - - zoom = this.getScaleZoom(scale, zoom); - - if (snap) { - zoom = Math.round(zoom / (snap / 100)) * (snap / 100); // don't jump if within 1% of a snap level - zoom = inside ? Math.ceil(zoom / snap) * snap : Math.floor(zoom / snap) * snap; - } - - return Math.max(min, Math.min(max, zoom)); - }, - - // @method getSize(): Point - // Returns the current size of the map container (in pixels). - getSize: function () { - if (!this._size || this._sizeChanged) { - this._size = new Point( - this._container.clientWidth || 0, - this._container.clientHeight || 0); - - this._sizeChanged = false; - } - return this._size.clone(); - }, - - // @method getPixelBounds(): Bounds - // Returns the bounds of the current map view in projected pixel - // coordinates (sometimes useful in layer and overlay implementations). - getPixelBounds: function (center, zoom) { - var topLeftPoint = this._getTopLeftPoint(center, zoom); - return new Bounds(topLeftPoint, topLeftPoint.add(this.getSize())); - }, - - // TODO: Check semantics - isn't the pixel origin the 0,0 coord relative to - // the map pane? "left point of the map layer" can be confusing, specially - // since there can be negative offsets. - // @method getPixelOrigin(): Point - // Returns the projected pixel coordinates of the top left point of - // the map layer (useful in custom layer and overlay implementations). - getPixelOrigin: function () { - this._checkIfLoaded(); - return this._pixelOrigin; - }, - - // @method getPixelWorldBounds(zoom?: Number): Bounds - // Returns the world's bounds in pixel coordinates for zoom level `zoom`. - // If `zoom` is omitted, the map's current zoom level is used. - getPixelWorldBounds: function (zoom) { - return this.options.crs.getProjectedBounds(zoom === undefined ? this.getZoom() : zoom); - }, - - // @section Other Methods - - // @method getPane(pane: String|HTMLElement): HTMLElement - // Returns a [map pane](#map-pane), given its name or its HTML element (its identity). - getPane: function (pane) { - return typeof pane === 'string' ? this._panes[pane] : pane; - }, - - // @method getPanes(): Object - // Returns a plain object containing the names of all [panes](#map-pane) as keys and - // the panes as values. - getPanes: function () { - return this._panes; - }, - - // @method getContainer: HTMLElement - // Returns the HTML element that contains the map. - getContainer: function () { - return this._container; - }, - - - // @section Conversion Methods - - // @method getZoomScale(toZoom: Number, fromZoom: Number): Number - // Returns the scale factor to be applied to a map transition from zoom level - // `fromZoom` to `toZoom`. Used internally to help with zoom animations. - getZoomScale: function (toZoom, fromZoom) { - // TODO replace with universal implementation after refactoring projections - var crs = this.options.crs; - fromZoom = fromZoom === undefined ? this._zoom : fromZoom; - return crs.scale(toZoom) / crs.scale(fromZoom); - }, - - // @method getScaleZoom(scale: Number, fromZoom: Number): Number - // Returns the zoom level that the map would end up at, if it is at `fromZoom` - // level and everything is scaled by a factor of `scale`. Inverse of - // [`getZoomScale`](#map-getZoomScale). - getScaleZoom: function (scale, fromZoom) { - var crs = this.options.crs; - fromZoom = fromZoom === undefined ? this._zoom : fromZoom; - var zoom = crs.zoom(scale * crs.scale(fromZoom)); - return isNaN(zoom) ? Infinity : zoom; - }, - - // @method project(latlng: LatLng, zoom: Number): Point - // Projects a geographical coordinate `LatLng` according to the projection - // of the map's CRS, then scales it according to `zoom` and the CRS's - // `Transformation`. The result is pixel coordinate relative to - // the CRS origin. - project: function (latlng, zoom) { - zoom = zoom === undefined ? this._zoom : zoom; - return this.options.crs.latLngToPoint(toLatLng(latlng), zoom); - }, - - // @method unproject(point: Point, zoom: Number): LatLng - // Inverse of [`project`](#map-project). - unproject: function (point, zoom) { - zoom = zoom === undefined ? this._zoom : zoom; - return this.options.crs.pointToLatLng(toPoint(point), zoom); - }, - - // @method layerPointToLatLng(point: Point): LatLng - // Given a pixel coordinate relative to the [origin pixel](#map-getpixelorigin), - // returns the corresponding geographical coordinate (for the current zoom level). - layerPointToLatLng: function (point) { - var projectedPoint = toPoint(point).add(this.getPixelOrigin()); - return this.unproject(projectedPoint); - }, - - // @method latLngToLayerPoint(latlng: LatLng): Point - // Given a geographical coordinate, returns the corresponding pixel coordinate - // relative to the [origin pixel](#map-getpixelorigin). - latLngToLayerPoint: function (latlng) { - var projectedPoint = this.project(toLatLng(latlng))._round(); - return projectedPoint._subtract(this.getPixelOrigin()); - }, - - // @method wrapLatLng(latlng: LatLng): LatLng - // Returns a `LatLng` where `lat` and `lng` has been wrapped according to the - // map's CRS's `wrapLat` and `wrapLng` properties, if they are outside the - // CRS's bounds. - // By default this means longitude is wrapped around the dateline so its - // value is between -180 and +180 degrees. - wrapLatLng: function (latlng) { - return this.options.crs.wrapLatLng(toLatLng(latlng)); - }, - - // @method wrapLatLngBounds(bounds: LatLngBounds): LatLngBounds - // Returns a `LatLngBounds` with the same size as the given one, ensuring that - // its center is within the CRS's bounds. - // By default this means the center longitude is wrapped around the dateline so its - // value is between -180 and +180 degrees, and the majority of the bounds - // overlaps the CRS's bounds. - wrapLatLngBounds: function (latlng) { - return this.options.crs.wrapLatLngBounds(toLatLngBounds(latlng)); - }, - - // @method distance(latlng1: LatLng, latlng2: LatLng): Number - // Returns the distance between two geographical coordinates according to - // the map's CRS. By default this measures distance in meters. - distance: function (latlng1, latlng2) { - return this.options.crs.distance(toLatLng(latlng1), toLatLng(latlng2)); - }, - - // @method containerPointToLayerPoint(point: Point): Point - // Given a pixel coordinate relative to the map container, returns the corresponding - // pixel coordinate relative to the [origin pixel](#map-getpixelorigin). - containerPointToLayerPoint: function (point) { // (Point) - return toPoint(point).subtract(this._getMapPanePos()); - }, - - // @method layerPointToContainerPoint(point: Point): Point - // Given a pixel coordinate relative to the [origin pixel](#map-getpixelorigin), - // returns the corresponding pixel coordinate relative to the map container. - layerPointToContainerPoint: function (point) { // (Point) - return toPoint(point).add(this._getMapPanePos()); - }, - - // @method containerPointToLatLng(point: Point): LatLng - // Given a pixel coordinate relative to the map container, returns - // the corresponding geographical coordinate (for the current zoom level). - containerPointToLatLng: function (point) { - var layerPoint = this.containerPointToLayerPoint(toPoint(point)); - return this.layerPointToLatLng(layerPoint); - }, - - // @method latLngToContainerPoint(latlng: LatLng): Point - // Given a geographical coordinate, returns the corresponding pixel coordinate - // relative to the map container. - latLngToContainerPoint: function (latlng) { - return this.layerPointToContainerPoint(this.latLngToLayerPoint(toLatLng(latlng))); - }, - - // @method mouseEventToContainerPoint(ev: MouseEvent): Point - // Given a MouseEvent object, returns the pixel coordinate relative to the - // map container where the event took place. - mouseEventToContainerPoint: function (e) { - return getMousePosition(e, this._container); - }, - - // @method mouseEventToLayerPoint(ev: MouseEvent): Point - // Given a MouseEvent object, returns the pixel coordinate relative to - // the [origin pixel](#map-getpixelorigin) where the event took place. - mouseEventToLayerPoint: function (e) { - return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(e)); - }, - - // @method mouseEventToLatLng(ev: MouseEvent): LatLng - // Given a MouseEvent object, returns geographical coordinate where the - // event took place. - mouseEventToLatLng: function (e) { // (MouseEvent) - return this.layerPointToLatLng(this.mouseEventToLayerPoint(e)); - }, - - - // map initialization methods - - _initContainer: function (id) { - var container = this._container = get(id); - - if (!container) { - throw new Error('Map container not found.'); - } else if (container._leaflet_id) { - throw new Error('Map container is already initialized.'); - } - - on(container, 'scroll', this._onScroll, this); - this._containerId = stamp(container); - }, - - _initLayout: function () { - var container = this._container; - - this._fadeAnimated = this.options.fadeAnimation && any3d; - - addClass(container, 'leaflet-container' + - (touch ? ' leaflet-touch' : '') + - (retina ? ' leaflet-retina' : '') + - (ielt9 ? ' leaflet-oldie' : '') + - (safari ? ' leaflet-safari' : '') + - (this._fadeAnimated ? ' leaflet-fade-anim' : '')); - - var position = getStyle(container, 'position'); - - if (position !== 'absolute' && position !== 'relative' && position !== 'fixed') { - container.style.position = 'relative'; - } - - this._initPanes(); - - if (this._initControlPos) { - this._initControlPos(); - } - }, - - _initPanes: function () { - var panes = this._panes = {}; - this._paneRenderers = {}; - - // @section - // - // Panes are DOM elements used to control the ordering of layers on the map. You - // can access panes with [`map.getPane`](#map-getpane) or - // [`map.getPanes`](#map-getpanes) methods. New panes can be created with the - // [`map.createPane`](#map-createpane) method. - // - // Every map has the following default panes that differ only in zIndex. - // - // @pane mapPane: HTMLElement = 'auto' - // Pane that contains all other map panes - - this._mapPane = this.createPane('mapPane', this._container); - setPosition(this._mapPane, new Point(0, 0)); - - // @pane tilePane: HTMLElement = 200 - // Pane for `GridLayer`s and `TileLayer`s - this.createPane('tilePane'); - // @pane overlayPane: HTMLElement = 400 - // Pane for vectors (`Path`s, like `Polyline`s and `Polygon`s), `ImageOverlay`s and `VideoOverlay`s - this.createPane('shadowPane'); - // @pane shadowPane: HTMLElement = 500 - // Pane for overlay shadows (e.g. `Marker` shadows) - this.createPane('overlayPane'); - // @pane markerPane: HTMLElement = 600 - // Pane for `Icon`s of `Marker`s - this.createPane('markerPane'); - // @pane tooltipPane: HTMLElement = 650 - // Pane for `Tooltip`s. - this.createPane('tooltipPane'); - // @pane popupPane: HTMLElement = 700 - // Pane for `Popup`s. - this.createPane('popupPane'); - - if (!this.options.markerZoomAnimation) { - addClass(panes.markerPane, 'leaflet-zoom-hide'); - addClass(panes.shadowPane, 'leaflet-zoom-hide'); - } - }, - - - // private methods that modify map state - - // @section Map state change events - _resetView: function (center, zoom) { - setPosition(this._mapPane, new Point(0, 0)); - - var loading = !this._loaded; - this._loaded = true; - zoom = this._limitZoom(zoom); - - this.fire('viewprereset'); - - var zoomChanged = this._zoom !== zoom; - this - ._moveStart(zoomChanged, false) - ._move(center, zoom) - ._moveEnd(zoomChanged); - - // @event viewreset: Event - // Fired when the map needs to redraw its content (this usually happens - // on map zoom or load). Very useful for creating custom overlays. - this.fire('viewreset'); - - // @event load: Event - // Fired when the map is initialized (when its center and zoom are set - // for the first time). - if (loading) { - this.fire('load'); - } - }, - - _moveStart: function (zoomChanged, noMoveStart) { - // @event zoomstart: Event - // Fired when the map zoom is about to change (e.g. before zoom animation). - // @event movestart: Event - // Fired when the view of the map starts changing (e.g. user starts dragging the map). - if (zoomChanged) { - this.fire('zoomstart'); - } - if (!noMoveStart) { - this.fire('movestart'); - } - return this; - }, - - _move: function (center, zoom, data) { - if (zoom === undefined) { - zoom = this._zoom; - } - var zoomChanged = this._zoom !== zoom; - - this._zoom = zoom; - this._lastCenter = center; - this._pixelOrigin = this._getNewPixelOrigin(center); - - // @event zoom: Event - // Fired repeatedly during any change in zoom level, including zoom - // and fly animations. - if (zoomChanged || (data && data.pinch)) { // Always fire 'zoom' if pinching because #3530 - this.fire('zoom', data); - } - - // @event move: Event - // Fired repeatedly during any movement of the map, including pan and - // fly animations. - return this.fire('move', data); - }, - - _moveEnd: function (zoomChanged) { - // @event zoomend: Event - // Fired when the map has changed, after any animations. - if (zoomChanged) { - this.fire('zoomend'); - } - - // @event moveend: Event - // Fired when the center of the map stops changing (e.g. user stopped - // dragging the map). - return this.fire('moveend'); - }, - - _stop: function () { - cancelAnimFrame(this._flyToFrame); - if (this._panAnim) { - this._panAnim.stop(); - } - return this; - }, - - _rawPanBy: function (offset) { - setPosition(this._mapPane, this._getMapPanePos().subtract(offset)); - }, - - _getZoomSpan: function () { - return this.getMaxZoom() - this.getMinZoom(); - }, - - _panInsideMaxBounds: function () { - if (!this._enforcingBounds) { - this.panInsideBounds(this.options.maxBounds); - } - }, - - _checkIfLoaded: function () { - if (!this._loaded) { - throw new Error('Set map center and zoom first.'); - } - }, - - // DOM event handling - - // @section Interaction events - _initEvents: function (remove$$1) { - this._targets = {}; - this._targets[stamp(this._container)] = this; - - var onOff = remove$$1 ? off : on; - - // @event click: MouseEvent - // Fired when the user clicks (or taps) the map. - // @event dblclick: MouseEvent - // Fired when the user double-clicks (or double-taps) the map. - // @event mousedown: MouseEvent - // Fired when the user pushes the mouse button on the map. - // @event mouseup: MouseEvent - // Fired when the user releases the mouse button on the map. - // @event mouseover: MouseEvent - // Fired when the mouse enters the map. - // @event mouseout: MouseEvent - // Fired when the mouse leaves the map. - // @event mousemove: MouseEvent - // Fired while the mouse moves over the map. - // @event contextmenu: MouseEvent - // Fired when the user pushes the right mouse button on the map, prevents - // default browser context menu from showing if there are listeners on - // this event. Also fired on mobile when the user holds a single touch - // for a second (also called long press). - // @event keypress: KeyboardEvent - // Fired when the user presses a key from the keyboard while the map is focused. - onOff(this._container, 'click dblclick mousedown mouseup ' + - 'mouseover mouseout mousemove contextmenu keypress', this._handleDOMEvent, this); - - if (this.options.trackResize) { - onOff(window, 'resize', this._onResize, this); - } - - if (any3d && this.options.transform3DLimit) { - (remove$$1 ? this.off : this.on).call(this, 'moveend', this._onMoveEnd); - } - }, - - _onResize: function () { - cancelAnimFrame(this._resizeRequest); - this._resizeRequest = requestAnimFrame( - function () { this.invalidateSize({debounceMoveend: true}); }, this); - }, - - _onScroll: function () { - this._container.scrollTop = 0; - this._container.scrollLeft = 0; - }, - - _onMoveEnd: function () { - var pos = this._getMapPanePos(); - if (Math.max(Math.abs(pos.x), Math.abs(pos.y)) >= this.options.transform3DLimit) { - // https://bugzilla.mozilla.org/show_bug.cgi?id=1203873 but Webkit also have - // a pixel offset on very high values, see: http://jsfiddle.net/dg6r5hhb/ - this._resetView(this.getCenter(), this.getZoom()); - } - }, - - _findEventTargets: function (e, type) { - var targets = [], - target, - isHover = type === 'mouseout' || type === 'mouseover', - src = e.target || e.srcElement, - dragging = false; - - while (src) { - target = this._targets[stamp(src)]; - if (target && (type === 'click' || type === 'preclick') && !e._simulated && this._draggableMoved(target)) { - // Prevent firing click after you just dragged an object. - dragging = true; - break; - } - if (target && target.listens(type, true)) { - if (isHover && !isExternalTarget(src, e)) { break; } - targets.push(target); - if (isHover) { break; } - } - if (src === this._container) { break; } - src = src.parentNode; - } - if (!targets.length && !dragging && !isHover && isExternalTarget(src, e)) { - targets = [this]; - } - return targets; - }, - - _handleDOMEvent: function (e) { - if (!this._loaded || skipped(e)) { return; } - - var type = e.type; - - if (type === 'mousedown' || type === 'keypress') { - // prevents outline when clicking on keyboard-focusable element - preventOutline(e.target || e.srcElement); - } - - this._fireDOMEvent(e, type); - }, - - _mouseEvents: ['click', 'dblclick', 'mouseover', 'mouseout', 'contextmenu'], - - _fireDOMEvent: function (e, type, targets) { - - if (e.type === 'click') { - // Fire a synthetic 'preclick' event which propagates up (mainly for closing popups). - // @event preclick: MouseEvent - // Fired before mouse click on the map (sometimes useful when you - // want something to happen on click before any existing click - // handlers start running). - var synth = extend({}, e); - synth.type = 'preclick'; - this._fireDOMEvent(synth, synth.type, targets); - } - - if (e._stopped) { return; } - - // Find the layer the event is propagating from and its parents. - targets = (targets || []).concat(this._findEventTargets(e, type)); - - if (!targets.length) { return; } - - var target = targets[0]; - if (type === 'contextmenu' && target.listens(type, true)) { - preventDefault(e); - } - - var data = { - originalEvent: e - }; - - if (e.type !== 'keypress') { - var isMarker = target.getLatLng && (!target._radius || target._radius <= 10); - data.containerPoint = isMarker ? - this.latLngToContainerPoint(target.getLatLng()) : this.mouseEventToContainerPoint(e); - data.layerPoint = this.containerPointToLayerPoint(data.containerPoint); - data.latlng = isMarker ? target.getLatLng() : this.layerPointToLatLng(data.layerPoint); - } - - for (var i = 0; i < targets.length; i++) { - targets[i].fire(type, data, true); - if (data.originalEvent._stopped || - (targets[i].options.bubblingMouseEvents === false && indexOf(this._mouseEvents, type) !== -1)) { return; } - } - }, - - _draggableMoved: function (obj) { - obj = obj.dragging && obj.dragging.enabled() ? obj : this; - return (obj.dragging && obj.dragging.moved()) || (this.boxZoom && this.boxZoom.moved()); - }, - - _clearHandlers: function () { - for (var i = 0, len = this._handlers.length; i < len; i++) { - this._handlers[i].disable(); - } - }, - - // @section Other Methods - - // @method whenReady(fn: Function, context?: Object): this - // Runs the given function `fn` when the map gets initialized with - // a view (center and zoom) and at least one layer, or immediately - // if it's already initialized, optionally passing a function context. - whenReady: function (callback, context) { - if (this._loaded) { - callback.call(context || this, {target: this}); - } else { - this.on('load', callback, context); - } - return this; - }, - - - // private methods for getting map state - - _getMapPanePos: function () { - return getPosition(this._mapPane) || new Point(0, 0); - }, - - _moved: function () { - var pos = this._getMapPanePos(); - return pos && !pos.equals([0, 0]); - }, - - _getTopLeftPoint: function (center, zoom) { - var pixelOrigin = center && zoom !== undefined ? - this._getNewPixelOrigin(center, zoom) : - this.getPixelOrigin(); - return pixelOrigin.subtract(this._getMapPanePos()); - }, - - _getNewPixelOrigin: function (center, zoom) { - var viewHalf = this.getSize()._divideBy(2); - return this.project(center, zoom)._subtract(viewHalf)._add(this._getMapPanePos())._round(); - }, - - _latLngToNewLayerPoint: function (latlng, zoom, center) { - var topLeft = this._getNewPixelOrigin(center, zoom); - return this.project(latlng, zoom)._subtract(topLeft); - }, - - _latLngBoundsToNewLayerBounds: function (latLngBounds, zoom, center) { - var topLeft = this._getNewPixelOrigin(center, zoom); - return toBounds([ - this.project(latLngBounds.getSouthWest(), zoom)._subtract(topLeft), - this.project(latLngBounds.getNorthWest(), zoom)._subtract(topLeft), - this.project(latLngBounds.getSouthEast(), zoom)._subtract(topLeft), - this.project(latLngBounds.getNorthEast(), zoom)._subtract(topLeft) - ]); - }, - - // layer point of the current center - _getCenterLayerPoint: function () { - return this.containerPointToLayerPoint(this.getSize()._divideBy(2)); - }, - - // offset of the specified place to the current center in pixels - _getCenterOffset: function (latlng) { - return this.latLngToLayerPoint(latlng).subtract(this._getCenterLayerPoint()); - }, - - // adjust center for view to get inside bounds - _limitCenter: function (center, zoom, bounds) { - - if (!bounds) { return center; } - - var centerPoint = this.project(center, zoom), - viewHalf = this.getSize().divideBy(2), - viewBounds = new Bounds(centerPoint.subtract(viewHalf), centerPoint.add(viewHalf)), - offset = this._getBoundsOffset(viewBounds, bounds, zoom); - - // If offset is less than a pixel, ignore. - // This prevents unstable projections from getting into - // an infinite loop of tiny offsets. - if (offset.round().equals([0, 0])) { - return center; - } - - return this.unproject(centerPoint.add(offset), zoom); - }, - - // adjust offset for view to get inside bounds - _limitOffset: function (offset, bounds) { - if (!bounds) { return offset; } - - var viewBounds = this.getPixelBounds(), - newBounds = new Bounds(viewBounds.min.add(offset), viewBounds.max.add(offset)); - - return offset.add(this._getBoundsOffset(newBounds, bounds)); - }, - - // returns offset needed for pxBounds to get inside maxBounds at a specified zoom - _getBoundsOffset: function (pxBounds, maxBounds, zoom) { - var projectedMaxBounds = toBounds( - this.project(maxBounds.getNorthEast(), zoom), - this.project(maxBounds.getSouthWest(), zoom) - ), - minOffset = projectedMaxBounds.min.subtract(pxBounds.min), - maxOffset = projectedMaxBounds.max.subtract(pxBounds.max), - - dx = this._rebound(minOffset.x, -maxOffset.x), - dy = this._rebound(minOffset.y, -maxOffset.y); - - return new Point(dx, dy); - }, - - _rebound: function (left, right) { - return left + right > 0 ? - Math.round(left - right) / 2 : - Math.max(0, Math.ceil(left)) - Math.max(0, Math.floor(right)); - }, - - _limitZoom: function (zoom) { - var min = this.getMinZoom(), - max = this.getMaxZoom(), - snap = any3d ? this.options.zoomSnap : 1; - if (snap) { - zoom = Math.round(zoom / snap) * snap; - } - return Math.max(min, Math.min(max, zoom)); - }, - - _onPanTransitionStep: function () { - this.fire('move'); - }, - - _onPanTransitionEnd: function () { - removeClass(this._mapPane, 'leaflet-pan-anim'); - this.fire('moveend'); - }, - - _tryAnimatedPan: function (center, options) { - // difference between the new and current centers in pixels - var offset = this._getCenterOffset(center)._trunc(); - - // don't animate too far unless animate: true specified in options - if ((options && options.animate) !== true && !this.getSize().contains(offset)) { return false; } - - this.panBy(offset, options); - - return true; - }, - - _createAnimProxy: function () { - - var proxy = this._proxy = create$1('div', 'leaflet-proxy leaflet-zoom-animated'); - this._panes.mapPane.appendChild(proxy); - - this.on('zoomanim', function (e) { - var prop = TRANSFORM, - transform = this._proxy.style[prop]; - - setTransform(this._proxy, this.project(e.center, e.zoom), this.getZoomScale(e.zoom, 1)); - - // workaround for case when transform is the same and so transitionend event is not fired - if (transform === this._proxy.style[prop] && this._animatingZoom) { - this._onZoomTransitionEnd(); - } - }, this); - - this.on('load moveend', function () { - var c = this.getCenter(), - z = this.getZoom(); - setTransform(this._proxy, this.project(c, z), this.getZoomScale(z, 1)); - }, this); - - this._on('unload', this._destroyAnimProxy, this); - }, - - _destroyAnimProxy: function () { - remove(this._proxy); - delete this._proxy; - }, - - _catchTransitionEnd: function (e) { - if (this._animatingZoom && e.propertyName.indexOf('transform') >= 0) { - this._onZoomTransitionEnd(); - } - }, - - _nothingToAnimate: function () { - return !this._container.getElementsByClassName('leaflet-zoom-animated').length; - }, - - _tryAnimatedZoom: function (center, zoom, options) { - - if (this._animatingZoom) { return true; } - - options = options || {}; - - // don't animate if disabled, not supported or zoom difference is too large - if (!this._zoomAnimated || options.animate === false || this._nothingToAnimate() || - Math.abs(zoom - this._zoom) > this.options.zoomAnimationThreshold) { return false; } - - // offset is the pixel coords of the zoom origin relative to the current center - var scale = this.getZoomScale(zoom), - offset = this._getCenterOffset(center)._divideBy(1 - 1 / scale); - - // don't animate if the zoom origin isn't within one screen from the current center, unless forced - if (options.animate !== true && !this.getSize().contains(offset)) { return false; } - - requestAnimFrame(function () { - this - ._moveStart(true, false) - ._animateZoom(center, zoom, true); - }, this); - - return true; - }, - - _animateZoom: function (center, zoom, startAnim, noUpdate) { - if (!this._mapPane) { return; } - - if (startAnim) { - this._animatingZoom = true; - - // remember what center/zoom to set after animation - this._animateToCenter = center; - this._animateToZoom = zoom; - - addClass(this._mapPane, 'leaflet-zoom-anim'); - } - - // @event zoomanim: ZoomAnimEvent - // Fired at least once per zoom animation. For continous zoom, like pinch zooming, fired once per frame during zoom. - this.fire('zoomanim', { - center: center, - zoom: zoom, - noUpdate: noUpdate - }); - - // Work around webkit not firing 'transitionend', see https://github.com/Leaflet/Leaflet/issues/3689, 2693 - setTimeout(bind(this._onZoomTransitionEnd, this), 250); - }, - - _onZoomTransitionEnd: function () { - if (!this._animatingZoom) { return; } - - if (this._mapPane) { - removeClass(this._mapPane, 'leaflet-zoom-anim'); - } - - this._animatingZoom = false; - - this._move(this._animateToCenter, this._animateToZoom); - - // This anim frame should prevent an obscure iOS webkit tile loading race condition. - requestAnimFrame(function () { - this._moveEnd(true); - }, this); - } -}); - -// @section - -// @factory L.map(id: String, options?: Map options) -// Instantiates a map object given the DOM ID of a `
    ` element -// and optionally an object literal with `Map options`. -// -// @alternative -// @factory L.map(el: HTMLElement, options?: Map options) -// Instantiates a map object given an instance of a `
    ` HTML element -// and optionally an object literal with `Map options`. -function createMap(id, options) { - return new Map(id, options); -} - -/* - * @class Control - * @aka L.Control - * @inherits Class - * - * L.Control is a base class for implementing map controls. Handles positioning. - * All other controls extend from this class. - */ - -var Control = Class.extend({ - // @section - // @aka Control options - options: { - // @option position: String = 'topright' - // The position of the control (one of the map corners). Possible values are `'topleft'`, - // `'topright'`, `'bottomleft'` or `'bottomright'` - position: 'topright' - }, - - initialize: function (options) { - setOptions(this, options); - }, - - /* @section - * Classes extending L.Control will inherit the following methods: - * - * @method getPosition: string - * Returns the position of the control. - */ - getPosition: function () { - return this.options.position; - }, - - // @method setPosition(position: string): this - // Sets the position of the control. - setPosition: function (position) { - var map = this._map; - - if (map) { - map.removeControl(this); - } - - this.options.position = position; - - if (map) { - map.addControl(this); - } - - return this; - }, - - // @method getContainer: HTMLElement - // Returns the HTMLElement that contains the control. - getContainer: function () { - return this._container; - }, - - // @method addTo(map: Map): this - // Adds the control to the given map. - addTo: function (map) { - this.remove(); - this._map = map; - - var container = this._container = this.onAdd(map), - pos = this.getPosition(), - corner = map._controlCorners[pos]; - - addClass(container, 'leaflet-control'); - - if (pos.indexOf('bottom') !== -1) { - corner.insertBefore(container, corner.firstChild); - } else { - corner.appendChild(container); - } - - return this; - }, - - // @method remove: this - // Removes the control from the map it is currently active on. - remove: function () { - if (!this._map) { - return this; - } - - remove(this._container); - - if (this.onRemove) { - this.onRemove(this._map); - } - - this._map = null; - - return this; - }, - - _refocusOnMap: function (e) { - // if map exists and event is not a keyboard event - if (this._map && e && e.screenX > 0 && e.screenY > 0) { - this._map.getContainer().focus(); - } - } -}); - -var control = function (options) { - return new Control(options); -}; - -/* @section Extension methods - * @uninheritable - * - * Every control should extend from `L.Control` and (re-)implement the following methods. - * - * @method onAdd(map: Map): HTMLElement - * Should return the container DOM element for the control and add listeners on relevant map events. Called on [`control.addTo(map)`](#control-addTo). - * - * @method onRemove(map: Map) - * Optional method. Should contain all clean up code that removes the listeners previously added in [`onAdd`](#control-onadd). Called on [`control.remove()`](#control-remove). - */ - -/* @namespace Map - * @section Methods for Layers and Controls - */ -Map.include({ - // @method addControl(control: Control): this - // Adds the given control to the map - addControl: function (control) { - control.addTo(this); - return this; - }, - - // @method removeControl(control: Control): this - // Removes the given control from the map - removeControl: function (control) { - control.remove(); - return this; - }, - - _initControlPos: function () { - var corners = this._controlCorners = {}, - l = 'leaflet-', - container = this._controlContainer = - create$1('div', l + 'control-container', this._container); - - function createCorner(vSide, hSide) { - var className = l + vSide + ' ' + l + hSide; - - corners[vSide + hSide] = create$1('div', className, container); - } - - createCorner('top', 'left'); - createCorner('top', 'right'); - createCorner('bottom', 'left'); - createCorner('bottom', 'right'); - }, - - _clearControlPos: function () { - for (var i in this._controlCorners) { - remove(this._controlCorners[i]); - } - remove(this._controlContainer); - delete this._controlCorners; - delete this._controlContainer; - } -}); - -/* - * @class Control.Layers - * @aka L.Control.Layers - * @inherits Control - * - * The layers control gives users the ability to switch between different base layers and switch overlays on/off (check out the [detailed example](http://leafletjs.com/examples/layers-control/)). Extends `Control`. - * - * @example - * - * ```js - * var baseLayers = { - * "Mapbox": mapbox, - * "OpenStreetMap": osm - * }; - * - * var overlays = { - * "Marker": marker, - * "Roads": roadsLayer - * }; - * - * L.control.layers(baseLayers, overlays).addTo(map); - * ``` - * - * The `baseLayers` and `overlays` parameters are object literals with layer names as keys and `Layer` objects as values: - * - * ```js - * { - * "": layer1, - * "": layer2 - * } - * ``` - * - * The layer names can contain HTML, which allows you to add additional styling to the items: - * - * ```js - * {" My Layer": myLayer} - * ``` - */ - -var Layers = Control.extend({ - // @section - // @aka Control.Layers options - options: { - // @option collapsed: Boolean = true - // If `true`, the control will be collapsed into an icon and expanded on mouse hover or touch. - collapsed: true, - position: 'topright', - - // @option autoZIndex: Boolean = true - // If `true`, the control will assign zIndexes in increasing order to all of its layers so that the order is preserved when switching them on/off. - autoZIndex: true, - - // @option hideSingleBase: Boolean = false - // If `true`, the base layers in the control will be hidden when there is only one. - hideSingleBase: false, - - // @option sortLayers: Boolean = false - // Whether to sort the layers. When `false`, layers will keep the order - // in which they were added to the control. - sortLayers: false, - - // @option sortFunction: Function = * - // A [compare function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/sort) - // that will be used for sorting the layers, when `sortLayers` is `true`. - // The function receives both the `L.Layer` instances and their names, as in - // `sortFunction(layerA, layerB, nameA, nameB)`. - // By default, it sorts layers alphabetically by their name. - sortFunction: function (layerA, layerB, nameA, nameB) { - return nameA < nameB ? -1 : (nameB < nameA ? 1 : 0); - } - }, - - initialize: function (baseLayers, overlays, options) { - setOptions(this, options); - - this._layerControlInputs = []; - this._layers = []; - this._lastZIndex = 0; - this._handlingClick = false; - - for (var i in baseLayers) { - this._addLayer(baseLayers[i], i); - } - - for (i in overlays) { - this._addLayer(overlays[i], i, true); - } - }, - - onAdd: function (map) { - this._initLayout(); - this._update(); - - this._map = map; - map.on('zoomend', this._checkDisabledLayers, this); - - for (var i = 0; i < this._layers.length; i++) { - this._layers[i].layer.on('add remove', this._onLayerChange, this); - } - - return this._container; - }, - - addTo: function (map) { - Control.prototype.addTo.call(this, map); - // Trigger expand after Layers Control has been inserted into DOM so that is now has an actual height. - return this._expandIfNotCollapsed(); - }, - - onRemove: function () { - this._map.off('zoomend', this._checkDisabledLayers, this); - - for (var i = 0; i < this._layers.length; i++) { - this._layers[i].layer.off('add remove', this._onLayerChange, this); - } - }, - - // @method addBaseLayer(layer: Layer, name: String): this - // Adds a base layer (radio button entry) with the given name to the control. - addBaseLayer: function (layer, name) { - this._addLayer(layer, name); - return (this._map) ? this._update() : this; - }, - - // @method addOverlay(layer: Layer, name: String): this - // Adds an overlay (checkbox entry) with the given name to the control. - addOverlay: function (layer, name) { - this._addLayer(layer, name, true); - return (this._map) ? this._update() : this; - }, - - // @method removeLayer(layer: Layer): this - // Remove the given layer from the control. - removeLayer: function (layer) { - layer.off('add remove', this._onLayerChange, this); - - var obj = this._getLayer(stamp(layer)); - if (obj) { - this._layers.splice(this._layers.indexOf(obj), 1); - } - return (this._map) ? this._update() : this; - }, - - // @method expand(): this - // Expand the control container if collapsed. - expand: function () { - addClass(this._container, 'leaflet-control-layers-expanded'); - this._section.style.height = null; - var acceptableHeight = this._map.getSize().y - (this._container.offsetTop + 50); - if (acceptableHeight < this._section.clientHeight) { - addClass(this._section, 'leaflet-control-layers-scrollbar'); - this._section.style.height = acceptableHeight + 'px'; - } else { - removeClass(this._section, 'leaflet-control-layers-scrollbar'); - } - this._checkDisabledLayers(); - return this; - }, - - // @method collapse(): this - // Collapse the control container if expanded. - collapse: function () { - removeClass(this._container, 'leaflet-control-layers-expanded'); - return this; - }, - - _initLayout: function () { - var className = 'leaflet-control-layers', - container = this._container = create$1('div', className), - collapsed = this.options.collapsed; - - // makes this work on IE touch devices by stopping it from firing a mouseout event when the touch is released - container.setAttribute('aria-haspopup', true); - - disableClickPropagation(container); - disableScrollPropagation(container); - - var section = this._section = create$1('section', className + '-list'); - - if (collapsed) { - this._map.on('click', this.collapse, this); - - if (!android) { - on(container, { - mouseenter: this.expand, - mouseleave: this.collapse - }, this); - } - } - - var link = this._layersLink = create$1('a', className + '-toggle', container); - link.href = '#'; - link.title = 'Layers'; - - if (touch) { - on(link, 'click', stop); - on(link, 'click', this.expand, this); - } else { - on(link, 'focus', this.expand, this); - } - - if (!collapsed) { - this.expand(); - } - - this._baseLayersList = create$1('div', className + '-base', section); - this._separator = create$1('div', className + '-separator', section); - this._overlaysList = create$1('div', className + '-overlays', section); - - container.appendChild(section); - }, - - _getLayer: function (id) { - for (var i = 0; i < this._layers.length; i++) { - - if (this._layers[i] && stamp(this._layers[i].layer) === id) { - return this._layers[i]; - } - } - }, - - _addLayer: function (layer, name, overlay) { - if (this._map) { - layer.on('add remove', this._onLayerChange, this); - } - - this._layers.push({ - layer: layer, - name: name, - overlay: overlay - }); - - if (this.options.sortLayers) { - this._layers.sort(bind(function (a, b) { - return this.options.sortFunction(a.layer, b.layer, a.name, b.name); - }, this)); - } - - if (this.options.autoZIndex && layer.setZIndex) { - this._lastZIndex++; - layer.setZIndex(this._lastZIndex); - } - - this._expandIfNotCollapsed(); - }, - - _update: function () { - if (!this._container) { return this; } - - empty(this._baseLayersList); - empty(this._overlaysList); - - this._layerControlInputs = []; - var baseLayersPresent, overlaysPresent, i, obj, baseLayersCount = 0; - - for (i = 0; i < this._layers.length; i++) { - obj = this._layers[i]; - this._addItem(obj); - overlaysPresent = overlaysPresent || obj.overlay; - baseLayersPresent = baseLayersPresent || !obj.overlay; - baseLayersCount += !obj.overlay ? 1 : 0; - } - - // Hide base layers section if there's only one layer. - if (this.options.hideSingleBase) { - baseLayersPresent = baseLayersPresent && baseLayersCount > 1; - this._baseLayersList.style.display = baseLayersPresent ? '' : 'none'; - } - - this._separator.style.display = overlaysPresent && baseLayersPresent ? '' : 'none'; - - return this; - }, - - _onLayerChange: function (e) { - if (!this._handlingClick) { - this._update(); - } - - var obj = this._getLayer(stamp(e.target)); - - // @namespace Map - // @section Layer events - // @event baselayerchange: LayersControlEvent - // Fired when the base layer is changed through the [layer control](#control-layers). - // @event overlayadd: LayersControlEvent - // Fired when an overlay is selected through the [layer control](#control-layers). - // @event overlayremove: LayersControlEvent - // Fired when an overlay is deselected through the [layer control](#control-layers). - // @namespace Control.Layers - var type = obj.overlay ? - (e.type === 'add' ? 'overlayadd' : 'overlayremove') : - (e.type === 'add' ? 'baselayerchange' : null); - - if (type) { - this._map.fire(type, obj); - } - }, - - // IE7 bugs out if you create a radio dynamically, so you have to do it this hacky way (see http://bit.ly/PqYLBe) - _createRadioElement: function (name, checked) { - - var radioHtml = ''; - - var radioFragment = document.createElement('div'); - radioFragment.innerHTML = radioHtml; - - return radioFragment.firstChild; - }, - - _addItem: function (obj) { - var label = document.createElement('label'), - checked = this._map.hasLayer(obj.layer), - input; - - if (obj.overlay) { - input = document.createElement('input'); - input.type = 'checkbox'; - input.className = 'leaflet-control-layers-selector'; - input.defaultChecked = checked; - } else { - input = this._createRadioElement('leaflet-base-layers', checked); - } - - this._layerControlInputs.push(input); - input.layerId = stamp(obj.layer); - - on(input, 'click', this._onInputClick, this); - - var name = document.createElement('span'); - name.innerHTML = ' ' + obj.name; - - // Helps from preventing layer control flicker when checkboxes are disabled - // https://github.com/Leaflet/Leaflet/issues/2771 - var holder = document.createElement('div'); - - label.appendChild(holder); - holder.appendChild(input); - holder.appendChild(name); - - var container = obj.overlay ? this._overlaysList : this._baseLayersList; - container.appendChild(label); - - this._checkDisabledLayers(); - return label; - }, - - _onInputClick: function () { - var inputs = this._layerControlInputs, - input, layer; - var addedLayers = [], - removedLayers = []; - - this._handlingClick = true; - - for (var i = inputs.length - 1; i >= 0; i--) { - input = inputs[i]; - layer = this._getLayer(input.layerId).layer; - - if (input.checked) { - addedLayers.push(layer); - } else if (!input.checked) { - removedLayers.push(layer); - } - } - - // Bugfix issue 2318: Should remove all old layers before readding new ones - for (i = 0; i < removedLayers.length; i++) { - if (this._map.hasLayer(removedLayers[i])) { - this._map.removeLayer(removedLayers[i]); - } - } - for (i = 0; i < addedLayers.length; i++) { - if (!this._map.hasLayer(addedLayers[i])) { - this._map.addLayer(addedLayers[i]); - } - } - - this._handlingClick = false; - - this._refocusOnMap(); - }, - - _checkDisabledLayers: function () { - var inputs = this._layerControlInputs, - input, - layer, - zoom = this._map.getZoom(); - - for (var i = inputs.length - 1; i >= 0; i--) { - input = inputs[i]; - layer = this._getLayer(input.layerId).layer; - input.disabled = (layer.options.minZoom !== undefined && zoom < layer.options.minZoom) || - (layer.options.maxZoom !== undefined && zoom > layer.options.maxZoom); - - } - }, - - _expandIfNotCollapsed: function () { - if (this._map && !this.options.collapsed) { - this.expand(); - } - return this; - }, - - _expand: function () { - // Backward compatibility, remove me in 1.1. - return this.expand(); - }, - - _collapse: function () { - // Backward compatibility, remove me in 1.1. - return this.collapse(); - } - -}); - - -// @factory L.control.layers(baselayers?: Object, overlays?: Object, options?: Control.Layers options) -// Creates an attribution control with the given layers. Base layers will be switched with radio buttons, while overlays will be switched with checkboxes. Note that all base layers should be passed in the base layers object, but only one should be added to the map during map instantiation. -var layers = function (baseLayers, overlays, options) { - return new Layers(baseLayers, overlays, options); -}; - -/* - * @class Control.Zoom - * @aka L.Control.Zoom - * @inherits Control - * - * A basic zoom control with two buttons (zoom in and zoom out). It is put on the map by default unless you set its [`zoomControl` option](#map-zoomcontrol) to `false`. Extends `Control`. - */ - -var Zoom = Control.extend({ - // @section - // @aka Control.Zoom options - options: { - position: 'topleft', - - // @option zoomInText: String = '+' - // The text set on the 'zoom in' button. - zoomInText: '+', - - // @option zoomInTitle: String = 'Zoom in' - // The title set on the 'zoom in' button. - zoomInTitle: 'Zoom in', - - // @option zoomOutText: String = '−' - // The text set on the 'zoom out' button. - zoomOutText: '−', - - // @option zoomOutTitle: String = 'Zoom out' - // The title set on the 'zoom out' button. - zoomOutTitle: 'Zoom out' - }, - - onAdd: function (map) { - var zoomName = 'leaflet-control-zoom', - container = create$1('div', zoomName + ' leaflet-bar'), - options = this.options; - - this._zoomInButton = this._createButton(options.zoomInText, options.zoomInTitle, - zoomName + '-in', container, this._zoomIn); - this._zoomOutButton = this._createButton(options.zoomOutText, options.zoomOutTitle, - zoomName + '-out', container, this._zoomOut); - - this._updateDisabled(); - map.on('zoomend zoomlevelschange', this._updateDisabled, this); - - return container; - }, - - onRemove: function (map) { - map.off('zoomend zoomlevelschange', this._updateDisabled, this); - }, - - disable: function () { - this._disabled = true; - this._updateDisabled(); - return this; - }, - - enable: function () { - this._disabled = false; - this._updateDisabled(); - return this; - }, - - _zoomIn: function (e) { - if (!this._disabled && this._map._zoom < this._map.getMaxZoom()) { - this._map.zoomIn(this._map.options.zoomDelta * (e.shiftKey ? 3 : 1)); - } - }, - - _zoomOut: function (e) { - if (!this._disabled && this._map._zoom > this._map.getMinZoom()) { - this._map.zoomOut(this._map.options.zoomDelta * (e.shiftKey ? 3 : 1)); - } - }, - - _createButton: function (html, title, className, container, fn) { - var link = create$1('a', className, container); - link.innerHTML = html; - link.href = '#'; - link.title = title; - - /* - * Will force screen readers like VoiceOver to read this as "Zoom in - button" - */ - link.setAttribute('role', 'button'); - link.setAttribute('aria-label', title); - - disableClickPropagation(link); - on(link, 'click', stop); - on(link, 'click', fn, this); - on(link, 'click', this._refocusOnMap, this); - - return link; - }, - - _updateDisabled: function () { - var map = this._map, - className = 'leaflet-disabled'; - - removeClass(this._zoomInButton, className); - removeClass(this._zoomOutButton, className); - - if (this._disabled || map._zoom === map.getMinZoom()) { - addClass(this._zoomOutButton, className); - } - if (this._disabled || map._zoom === map.getMaxZoom()) { - addClass(this._zoomInButton, className); - } - } -}); - -// @namespace Map -// @section Control options -// @option zoomControl: Boolean = true -// Whether a [zoom control](#control-zoom) is added to the map by default. -Map.mergeOptions({ - zoomControl: true -}); - -Map.addInitHook(function () { - if (this.options.zoomControl) { - // @section Controls - // @property zoomControl: Control.Zoom - // The default zoom control (only available if the - // [`zoomControl` option](#map-zoomcontrol) was `true` when creating the map). - this.zoomControl = new Zoom(); - this.addControl(this.zoomControl); - } -}); - -// @namespace Control.Zoom -// @factory L.control.zoom(options: Control.Zoom options) -// Creates a zoom control -var zoom = function (options) { - return new Zoom(options); -}; - -/* - * @class Control.Scale - * @aka L.Control.Scale - * @inherits Control - * - * A simple scale control that shows the scale of the current center of screen in metric (m/km) and imperial (mi/ft) systems. Extends `Control`. - * - * @example - * - * ```js - * L.control.scale().addTo(map); - * ``` - */ - -var Scale = Control.extend({ - // @section - // @aka Control.Scale options - options: { - position: 'bottomleft', - - // @option maxWidth: Number = 100 - // Maximum width of the control in pixels. The width is set dynamically to show round values (e.g. 100, 200, 500). - maxWidth: 100, - - // @option metric: Boolean = True - // Whether to show the metric scale line (m/km). - metric: true, - - // @option imperial: Boolean = True - // Whether to show the imperial scale line (mi/ft). - imperial: true - - // @option updateWhenIdle: Boolean = false - // If `true`, the control is updated on [`moveend`](#map-moveend), otherwise it's always up-to-date (updated on [`move`](#map-move)). - }, - - onAdd: function (map) { - var className = 'leaflet-control-scale', - container = create$1('div', className), - options = this.options; - - this._addScales(options, className + '-line', container); - - map.on(options.updateWhenIdle ? 'moveend' : 'move', this._update, this); - map.whenReady(this._update, this); - - return container; - }, - - onRemove: function (map) { - map.off(this.options.updateWhenIdle ? 'moveend' : 'move', this._update, this); - }, - - _addScales: function (options, className, container) { - if (options.metric) { - this._mScale = create$1('div', className, container); - } - if (options.imperial) { - this._iScale = create$1('div', className, container); - } - }, - - _update: function () { - var map = this._map, - y = map.getSize().y / 2; - - var maxMeters = map.distance( - map.containerPointToLatLng([0, y]), - map.containerPointToLatLng([this.options.maxWidth, y])); - - this._updateScales(maxMeters); - }, - - _updateScales: function (maxMeters) { - if (this.options.metric && maxMeters) { - this._updateMetric(maxMeters); - } - if (this.options.imperial && maxMeters) { - this._updateImperial(maxMeters); - } - }, - - _updateMetric: function (maxMeters) { - var meters = this._getRoundNum(maxMeters), - label = meters < 1000 ? meters + ' m' : (meters / 1000) + ' km'; - - this._updateScale(this._mScale, label, meters / maxMeters); - }, - - _updateImperial: function (maxMeters) { - var maxFeet = maxMeters * 3.2808399, - maxMiles, miles, feet; - - if (maxFeet > 5280) { - maxMiles = maxFeet / 5280; - miles = this._getRoundNum(maxMiles); - this._updateScale(this._iScale, miles + ' mi', miles / maxMiles); - - } else { - feet = this._getRoundNum(maxFeet); - this._updateScale(this._iScale, feet + ' ft', feet / maxFeet); - } - }, - - _updateScale: function (scale, text, ratio) { - scale.style.width = Math.round(this.options.maxWidth * ratio) + 'px'; - scale.innerHTML = text; - }, - - _getRoundNum: function (num) { - var pow10 = Math.pow(10, (Math.floor(num) + '').length - 1), - d = num / pow10; - - d = d >= 10 ? 10 : - d >= 5 ? 5 : - d >= 3 ? 3 : - d >= 2 ? 2 : 1; - - return pow10 * d; - } -}); - - -// @factory L.control.scale(options?: Control.Scale options) -// Creates an scale control with the given options. -var scale = function (options) { - return new Scale(options); -}; - -/* - * @class Control.Attribution - * @aka L.Control.Attribution - * @inherits Control - * - * The attribution control allows you to display attribution data in a small text box on a map. It is put on the map by default unless you set its [`attributionControl` option](#map-attributioncontrol) to `false`, and it fetches attribution texts from layers with the [`getAttribution` method](#layer-getattribution) automatically. Extends Control. - */ - -var Attribution = Control.extend({ - // @section - // @aka Control.Attribution options - options: { - position: 'bottomright', - - // @option prefix: String = 'Leaflet' - // The HTML text shown before the attributions. Pass `false` to disable. - prefix: 'Leaflet' - }, - - initialize: function (options) { - setOptions(this, options); - - this._attributions = {}; - }, - - onAdd: function (map) { - map.attributionControl = this; - this._container = create$1('div', 'leaflet-control-attribution'); - disableClickPropagation(this._container); - - // TODO ugly, refactor - for (var i in map._layers) { - if (map._layers[i].getAttribution) { - this.addAttribution(map._layers[i].getAttribution()); - } - } - - this._update(); - - return this._container; - }, - - // @method setPrefix(prefix: String): this - // Sets the text before the attributions. - setPrefix: function (prefix) { - this.options.prefix = prefix; - this._update(); - return this; - }, - - // @method addAttribution(text: String): this - // Adds an attribution text (e.g. `'Vector data © Mapbox'`). - addAttribution: function (text) { - if (!text) { return this; } - - if (!this._attributions[text]) { - this._attributions[text] = 0; - } - this._attributions[text]++; - - this._update(); - - return this; - }, - - // @method removeAttribution(text: String): this - // Removes an attribution text. - removeAttribution: function (text) { - if (!text) { return this; } - - if (this._attributions[text]) { - this._attributions[text]--; - this._update(); - } - - return this; - }, - - _update: function () { - if (!this._map) { return; } - - var attribs = []; - - for (var i in this._attributions) { - if (this._attributions[i]) { - attribs.push(i); - } - } - - var prefixAndAttribs = []; - - if (this.options.prefix) { - prefixAndAttribs.push(this.options.prefix); - } - if (attribs.length) { - prefixAndAttribs.push(attribs.join(', ')); - } - - this._container.innerHTML = prefixAndAttribs.join(' | '); - } -}); - -// @namespace Map -// @section Control options -// @option attributionControl: Boolean = true -// Whether a [attribution control](#control-attribution) is added to the map by default. -Map.mergeOptions({ - attributionControl: true -}); - -Map.addInitHook(function () { - if (this.options.attributionControl) { - new Attribution().addTo(this); - } -}); - -// @namespace Control.Attribution -// @factory L.control.attribution(options: Control.Attribution options) -// Creates an attribution control. -var attribution = function (options) { - return new Attribution(options); -}; - -Control.Layers = Layers; -Control.Zoom = Zoom; -Control.Scale = Scale; -Control.Attribution = Attribution; - -control.layers = layers; -control.zoom = zoom; -control.scale = scale; -control.attribution = attribution; - -/* - L.Handler is a base class for handler classes that are used internally to inject - interaction features like dragging to classes like Map and Marker. -*/ - -// @class Handler -// @aka L.Handler -// Abstract class for map interaction handlers - -var Handler = Class.extend({ - initialize: function (map) { - this._map = map; - }, - - // @method enable(): this - // Enables the handler - enable: function () { - if (this._enabled) { return this; } - - this._enabled = true; - this.addHooks(); - return this; - }, - - // @method disable(): this - // Disables the handler - disable: function () { - if (!this._enabled) { return this; } - - this._enabled = false; - this.removeHooks(); - return this; - }, - - // @method enabled(): Boolean - // Returns `true` if the handler is enabled - enabled: function () { - return !!this._enabled; - } - - // @section Extension methods - // Classes inheriting from `Handler` must implement the two following methods: - // @method addHooks() - // Called when the handler is enabled, should add event hooks. - // @method removeHooks() - // Called when the handler is disabled, should remove the event hooks added previously. -}); - -// @section There is static function which can be called without instantiating L.Handler: -// @function addTo(map: Map, name: String): this -// Adds a new Handler to the given map with the given name. -Handler.addTo = function (map, name) { - map.addHandler(name, this); - return this; -}; - -var Mixin = {Events: Events}; - -/* - * @class Draggable - * @aka L.Draggable - * @inherits Evented - * - * A class for making DOM elements draggable (including touch support). - * Used internally for map and marker dragging. Only works for elements - * that were positioned with [`L.DomUtil.setPosition`](#domutil-setposition). - * - * @example - * ```js - * var draggable = new L.Draggable(elementToDrag); - * draggable.enable(); - * ``` - */ - -var START = touch ? 'touchstart mousedown' : 'mousedown'; -var END = { - mousedown: 'mouseup', - touchstart: 'touchend', - pointerdown: 'touchend', - MSPointerDown: 'touchend' -}; -var MOVE = { - mousedown: 'mousemove', - touchstart: 'touchmove', - pointerdown: 'touchmove', - MSPointerDown: 'touchmove' -}; - - -var Draggable = Evented.extend({ - - options: { - // @section - // @aka Draggable options - // @option clickTolerance: Number = 3 - // The max number of pixels a user can shift the mouse pointer during a click - // for it to be considered a valid click (as opposed to a mouse drag). - clickTolerance: 3 - }, - - // @constructor L.Draggable(el: HTMLElement, dragHandle?: HTMLElement, preventOutline?: Boolean, options?: Draggable options) - // Creates a `Draggable` object for moving `el` when you start dragging the `dragHandle` element (equals `el` itself by default). - initialize: function (element, dragStartTarget, preventOutline$$1, options) { - setOptions(this, options); - - this._element = element; - this._dragStartTarget = dragStartTarget || element; - this._preventOutline = preventOutline$$1; - }, - - // @method enable() - // Enables the dragging ability - enable: function () { - if (this._enabled) { return; } - - on(this._dragStartTarget, START, this._onDown, this); - - this._enabled = true; - }, - - // @method disable() - // Disables the dragging ability - disable: function () { - if (!this._enabled) { return; } - - // If we're currently dragging this draggable, - // disabling it counts as first ending the drag. - if (Draggable._dragging === this) { - this.finishDrag(); - } - - off(this._dragStartTarget, START, this._onDown, this); - - this._enabled = false; - this._moved = false; - }, - - _onDown: function (e) { - // Ignore simulated events, since we handle both touch and - // mouse explicitly; otherwise we risk getting duplicates of - // touch events, see #4315. - // Also ignore the event if disabled; this happens in IE11 - // under some circumstances, see #3666. - if (e._simulated || !this._enabled) { return; } - - this._moved = false; - - if (hasClass(this._element, 'leaflet-zoom-anim')) { return; } - - if (Draggable._dragging || e.shiftKey || ((e.which !== 1) && (e.button !== 1) && !e.touches)) { return; } - Draggable._dragging = this; // Prevent dragging multiple objects at once. - - if (this._preventOutline) { - preventOutline(this._element); - } - - disableImageDrag(); - disableTextSelection(); - - if (this._moving) { return; } - - // @event down: Event - // Fired when a drag is about to start. - this.fire('down'); - - var first = e.touches ? e.touches[0] : e, - sizedParent = getSizedParentNode(this._element); - - this._startPoint = new Point(first.clientX, first.clientY); - - // Cache the scale, so that we can continuously compensate for it during drag (_onMove). - this._parentScale = getScale(sizedParent); - - on(document, MOVE[e.type], this._onMove, this); - on(document, END[e.type], this._onUp, this); - }, - - _onMove: function (e) { - // Ignore simulated events, since we handle both touch and - // mouse explicitly; otherwise we risk getting duplicates of - // touch events, see #4315. - // Also ignore the event if disabled; this happens in IE11 - // under some circumstances, see #3666. - if (e._simulated || !this._enabled) { return; } - - if (e.touches && e.touches.length > 1) { - this._moved = true; - return; - } - - var first = (e.touches && e.touches.length === 1 ? e.touches[0] : e), - offset = new Point(first.clientX, first.clientY)._subtract(this._startPoint); - - if (!offset.x && !offset.y) { return; } - if (Math.abs(offset.x) + Math.abs(offset.y) < this.options.clickTolerance) { return; } - - // We assume that the parent container's position, border and scale do not change for the duration of the drag. - // Therefore there is no need to account for the position and border (they are eliminated by the subtraction) - // and we can use the cached value for the scale. - offset.x /= this._parentScale.x; - offset.y /= this._parentScale.y; - - preventDefault(e); - - if (!this._moved) { - // @event dragstart: Event - // Fired when a drag starts - this.fire('dragstart'); - - this._moved = true; - this._startPos = getPosition(this._element).subtract(offset); - - addClass(document.body, 'leaflet-dragging'); - - this._lastTarget = e.target || e.srcElement; - // IE and Edge do not give the element, so fetch it - // if necessary - if ((window.SVGElementInstance) && (this._lastTarget instanceof SVGElementInstance)) { - this._lastTarget = this._lastTarget.correspondingUseElement; - } - addClass(this._lastTarget, 'leaflet-drag-target'); - } - - this._newPos = this._startPos.add(offset); - this._moving = true; - - cancelAnimFrame(this._animRequest); - this._lastEvent = e; - this._animRequest = requestAnimFrame(this._updatePosition, this, true); - }, - - _updatePosition: function () { - var e = {originalEvent: this._lastEvent}; - - // @event predrag: Event - // Fired continuously during dragging *before* each corresponding - // update of the element's position. - this.fire('predrag', e); - setPosition(this._element, this._newPos); - - // @event drag: Event - // Fired continuously during dragging. - this.fire('drag', e); - }, - - _onUp: function (e) { - // Ignore simulated events, since we handle both touch and - // mouse explicitly; otherwise we risk getting duplicates of - // touch events, see #4315. - // Also ignore the event if disabled; this happens in IE11 - // under some circumstances, see #3666. - if (e._simulated || !this._enabled) { return; } - this.finishDrag(); - }, - - finishDrag: function () { - removeClass(document.body, 'leaflet-dragging'); - - if (this._lastTarget) { - removeClass(this._lastTarget, 'leaflet-drag-target'); - this._lastTarget = null; - } - - for (var i in MOVE) { - off(document, MOVE[i], this._onMove, this); - off(document, END[i], this._onUp, this); - } - - enableImageDrag(); - enableTextSelection(); - - if (this._moved && this._moving) { - // ensure drag is not fired after dragend - cancelAnimFrame(this._animRequest); - - // @event dragend: DragEndEvent - // Fired when the drag ends. - this.fire('dragend', { - distance: this._newPos.distanceTo(this._startPos) - }); - } - - this._moving = false; - Draggable._dragging = false; - } - -}); - -/* - * @namespace LineUtil - * - * Various utility functions for polyline points processing, used by Leaflet internally to make polylines lightning-fast. - */ - -// Simplify polyline with vertex reduction and Douglas-Peucker simplification. -// Improves rendering performance dramatically by lessening the number of points to draw. - -// @function simplify(points: Point[], tolerance: Number): Point[] -// Dramatically reduces the number of points in a polyline while retaining -// its shape and returns a new array of simplified points, using the -// [Douglas-Peucker algorithm](http://en.wikipedia.org/wiki/Douglas-Peucker_algorithm). -// Used for a huge performance boost when processing/displaying Leaflet polylines for -// each zoom level and also reducing visual noise. tolerance affects the amount of -// simplification (lesser value means higher quality but slower and with more points). -// Also released as a separated micro-library [Simplify.js](http://mourner.github.com/simplify-js/). -function simplify(points, tolerance) { - if (!tolerance || !points.length) { - return points.slice(); - } - - var sqTolerance = tolerance * tolerance; - - // stage 1: vertex reduction - points = _reducePoints(points, sqTolerance); - - // stage 2: Douglas-Peucker simplification - points = _simplifyDP(points, sqTolerance); - - return points; -} - -// @function pointToSegmentDistance(p: Point, p1: Point, p2: Point): Number -// Returns the distance between point `p` and segment `p1` to `p2`. -function pointToSegmentDistance(p, p1, p2) { - return Math.sqrt(_sqClosestPointOnSegment(p, p1, p2, true)); -} - -// @function closestPointOnSegment(p: Point, p1: Point, p2: Point): Number -// Returns the closest point from a point `p` on a segment `p1` to `p2`. -function closestPointOnSegment(p, p1, p2) { - return _sqClosestPointOnSegment(p, p1, p2); -} - -// Douglas-Peucker simplification, see http://en.wikipedia.org/wiki/Douglas-Peucker_algorithm -function _simplifyDP(points, sqTolerance) { - - var len = points.length, - ArrayConstructor = typeof Uint8Array !== undefined + '' ? Uint8Array : Array, - markers = new ArrayConstructor(len); - - markers[0] = markers[len - 1] = 1; - - _simplifyDPStep(points, markers, sqTolerance, 0, len - 1); - - var i, - newPoints = []; - - for (i = 0; i < len; i++) { - if (markers[i]) { - newPoints.push(points[i]); - } - } - - return newPoints; -} - -function _simplifyDPStep(points, markers, sqTolerance, first, last) { - - var maxSqDist = 0, - index, i, sqDist; - - for (i = first + 1; i <= last - 1; i++) { - sqDist = _sqClosestPointOnSegment(points[i], points[first], points[last], true); - - if (sqDist > maxSqDist) { - index = i; - maxSqDist = sqDist; - } - } - - if (maxSqDist > sqTolerance) { - markers[index] = 1; - - _simplifyDPStep(points, markers, sqTolerance, first, index); - _simplifyDPStep(points, markers, sqTolerance, index, last); - } -} - -// reduce points that are too close to each other to a single point -function _reducePoints(points, sqTolerance) { - var reducedPoints = [points[0]]; - - for (var i = 1, prev = 0, len = points.length; i < len; i++) { - if (_sqDist(points[i], points[prev]) > sqTolerance) { - reducedPoints.push(points[i]); - prev = i; - } - } - if (prev < len - 1) { - reducedPoints.push(points[len - 1]); - } - return reducedPoints; -} - -var _lastCode; - -// @function clipSegment(a: Point, b: Point, bounds: Bounds, useLastCode?: Boolean, round?: Boolean): Point[]|Boolean -// Clips the segment a to b by rectangular bounds with the -// [Cohen-Sutherland algorithm](https://en.wikipedia.org/wiki/Cohen%E2%80%93Sutherland_algorithm) -// (modifying the segment points directly!). Used by Leaflet to only show polyline -// points that are on the screen or near, increasing performance. -function clipSegment(a, b, bounds, useLastCode, round) { - var codeA = useLastCode ? _lastCode : _getBitCode(a, bounds), - codeB = _getBitCode(b, bounds), - - codeOut, p, newCode; - - // save 2nd code to avoid calculating it on the next segment - _lastCode = codeB; - - while (true) { - // if a,b is inside the clip window (trivial accept) - if (!(codeA | codeB)) { - return [a, b]; - } - - // if a,b is outside the clip window (trivial reject) - if (codeA & codeB) { - return false; - } - - // other cases - codeOut = codeA || codeB; - p = _getEdgeIntersection(a, b, codeOut, bounds, round); - newCode = _getBitCode(p, bounds); - - if (codeOut === codeA) { - a = p; - codeA = newCode; - } else { - b = p; - codeB = newCode; - } - } -} - -function _getEdgeIntersection(a, b, code, bounds, round) { - var dx = b.x - a.x, - dy = b.y - a.y, - min = bounds.min, - max = bounds.max, - x, y; - - if (code & 8) { // top - x = a.x + dx * (max.y - a.y) / dy; - y = max.y; - - } else if (code & 4) { // bottom - x = a.x + dx * (min.y - a.y) / dy; - y = min.y; - - } else if (code & 2) { // right - x = max.x; - y = a.y + dy * (max.x - a.x) / dx; - - } else if (code & 1) { // left - x = min.x; - y = a.y + dy * (min.x - a.x) / dx; - } - - return new Point(x, y, round); -} - -function _getBitCode(p, bounds) { - var code = 0; - - if (p.x < bounds.min.x) { // left - code |= 1; - } else if (p.x > bounds.max.x) { // right - code |= 2; - } - - if (p.y < bounds.min.y) { // bottom - code |= 4; - } else if (p.y > bounds.max.y) { // top - code |= 8; - } - - return code; -} - -// square distance (to avoid unnecessary Math.sqrt calls) -function _sqDist(p1, p2) { - var dx = p2.x - p1.x, - dy = p2.y - p1.y; - return dx * dx + dy * dy; -} - -// return closest point on segment or distance to that point -function _sqClosestPointOnSegment(p, p1, p2, sqDist) { - var x = p1.x, - y = p1.y, - dx = p2.x - x, - dy = p2.y - y, - dot = dx * dx + dy * dy, - t; - - if (dot > 0) { - t = ((p.x - x) * dx + (p.y - y) * dy) / dot; - - if (t > 1) { - x = p2.x; - y = p2.y; - } else if (t > 0) { - x += dx * t; - y += dy * t; - } - } - - dx = p.x - x; - dy = p.y - y; - - return sqDist ? dx * dx + dy * dy : new Point(x, y); -} - - -// @function isFlat(latlngs: LatLng[]): Boolean -// Returns true if `latlngs` is a flat array, false is nested. -function isFlat(latlngs) { - return !isArray(latlngs[0]) || (typeof latlngs[0][0] !== 'object' && typeof latlngs[0][0] !== 'undefined'); -} - -function _flat(latlngs) { - console.warn('Deprecated use of _flat, please use L.LineUtil.isFlat instead.'); - return isFlat(latlngs); -} - - -var LineUtil = (Object.freeze || Object)({ - simplify: simplify, - pointToSegmentDistance: pointToSegmentDistance, - closestPointOnSegment: closestPointOnSegment, - clipSegment: clipSegment, - _getEdgeIntersection: _getEdgeIntersection, - _getBitCode: _getBitCode, - _sqClosestPointOnSegment: _sqClosestPointOnSegment, - isFlat: isFlat, - _flat: _flat -}); - -/* - * @namespace PolyUtil - * Various utility functions for polygon geometries. - */ - -/* @function clipPolygon(points: Point[], bounds: Bounds, round?: Boolean): Point[] - * Clips the polygon geometry defined by the given `points` by the given bounds (using the [Sutherland-Hodgman algorithm](https://en.wikipedia.org/wiki/Sutherland%E2%80%93Hodgman_algorithm)). - * Used by Leaflet to only show polygon points that are on the screen or near, increasing - * performance. Note that polygon points needs different algorithm for clipping - * than polyline, so there's a separate method for it. - */ -function clipPolygon(points, bounds, round) { - var clippedPoints, - edges = [1, 4, 2, 8], - i, j, k, - a, b, - len, edge, p; - - for (i = 0, len = points.length; i < len; i++) { - points[i]._code = _getBitCode(points[i], bounds); - } - - // for each edge (left, bottom, right, top) - for (k = 0; k < 4; k++) { - edge = edges[k]; - clippedPoints = []; - - for (i = 0, len = points.length, j = len - 1; i < len; j = i++) { - a = points[i]; - b = points[j]; - - // if a is inside the clip window - if (!(a._code & edge)) { - // if b is outside the clip window (a->b goes out of screen) - if (b._code & edge) { - p = _getEdgeIntersection(b, a, edge, bounds, round); - p._code = _getBitCode(p, bounds); - clippedPoints.push(p); - } - clippedPoints.push(a); - - // else if b is inside the clip window (a->b enters the screen) - } else if (!(b._code & edge)) { - p = _getEdgeIntersection(b, a, edge, bounds, round); - p._code = _getBitCode(p, bounds); - clippedPoints.push(p); - } - } - points = clippedPoints; - } - - return points; -} - - -var PolyUtil = (Object.freeze || Object)({ - clipPolygon: clipPolygon -}); - -/* - * @namespace Projection - * @section - * Leaflet comes with a set of already defined Projections out of the box: - * - * @projection L.Projection.LonLat - * - * Equirectangular, or Plate Carree projection — the most simple projection, - * mostly used by GIS enthusiasts. Directly maps `x` as longitude, and `y` as - * latitude. Also suitable for flat worlds, e.g. game maps. Used by the - * `EPSG:4326` and `Simple` CRS. - */ - -var LonLat = { - project: function (latlng) { - return new Point(latlng.lng, latlng.lat); - }, - - unproject: function (point) { - return new LatLng(point.y, point.x); - }, - - bounds: new Bounds([-180, -90], [180, 90]) -}; - -/* - * @namespace Projection - * @projection L.Projection.Mercator - * - * Elliptical Mercator projection — more complex than Spherical Mercator. Takes into account that Earth is a geoid, not a perfect sphere. Used by the EPSG:3395 CRS. - */ - -var Mercator = { - R: 6378137, - R_MINOR: 6356752.314245179, - - bounds: new Bounds([-20037508.34279, -15496570.73972], [20037508.34279, 18764656.23138]), - - project: function (latlng) { - var d = Math.PI / 180, - r = this.R, - y = latlng.lat * d, - tmp = this.R_MINOR / r, - e = Math.sqrt(1 - tmp * tmp), - con = e * Math.sin(y); - - var ts = Math.tan(Math.PI / 4 - y / 2) / Math.pow((1 - con) / (1 + con), e / 2); - y = -r * Math.log(Math.max(ts, 1E-10)); - - return new Point(latlng.lng * d * r, y); - }, - - unproject: function (point) { - var d = 180 / Math.PI, - r = this.R, - tmp = this.R_MINOR / r, - e = Math.sqrt(1 - tmp * tmp), - ts = Math.exp(-point.y / r), - phi = Math.PI / 2 - 2 * Math.atan(ts); - - for (var i = 0, dphi = 0.1, con; i < 15 && Math.abs(dphi) > 1e-7; i++) { - con = e * Math.sin(phi); - con = Math.pow((1 - con) / (1 + con), e / 2); - dphi = Math.PI / 2 - 2 * Math.atan(ts * con) - phi; - phi += dphi; - } - - return new LatLng(phi * d, point.x * d / r); - } -}; - -/* - * @class Projection - - * An object with methods for projecting geographical coordinates of the world onto - * a flat surface (and back). See [Map projection](http://en.wikipedia.org/wiki/Map_projection). - - * @property bounds: Bounds - * The bounds (specified in CRS units) where the projection is valid - - * @method project(latlng: LatLng): Point - * Projects geographical coordinates into a 2D point. - * Only accepts actual `L.LatLng` instances, not arrays. - - * @method unproject(point: Point): LatLng - * The inverse of `project`. Projects a 2D point into a geographical location. - * Only accepts actual `L.Point` instances, not arrays. - - * Note that the projection instances do not inherit from Leafet's `Class` object, - * and can't be instantiated. Also, new classes can't inherit from them, - * and methods can't be added to them with the `include` function. - - */ - - - - -var index = (Object.freeze || Object)({ - LonLat: LonLat, - Mercator: Mercator, - SphericalMercator: SphericalMercator -}); - -/* - * @namespace CRS - * @crs L.CRS.EPSG3395 - * - * Rarely used by some commercial tile providers. Uses Elliptical Mercator projection. - */ -var EPSG3395 = extend({}, Earth, { - code: 'EPSG:3395', - projection: Mercator, - - transformation: (function () { - var scale = 0.5 / (Math.PI * Mercator.R); - return toTransformation(scale, 0.5, -scale, 0.5); - }()) -}); - -/* - * @namespace CRS - * @crs L.CRS.EPSG4326 - * - * A common CRS among GIS enthusiasts. Uses simple Equirectangular projection. - * - * Leaflet 1.0.x complies with the [TMS coordinate scheme for EPSG:4326](https://wiki.osgeo.org/wiki/Tile_Map_Service_Specification#global-geodetic), - * which is a breaking change from 0.7.x behaviour. If you are using a `TileLayer` - * with this CRS, ensure that there are two 256x256 pixel tiles covering the - * whole earth at zoom level zero, and that the tile coordinate origin is (-180,+90), - * or (-180,-90) for `TileLayer`s with [the `tms` option](#tilelayer-tms) set. - */ - -var EPSG4326 = extend({}, Earth, { - code: 'EPSG:4326', - projection: LonLat, - transformation: toTransformation(1 / 180, 1, -1 / 180, 0.5) -}); - -/* - * @namespace CRS - * @crs L.CRS.Simple - * - * A simple CRS that maps longitude and latitude into `x` and `y` directly. - * May be used for maps of flat surfaces (e.g. game maps). Note that the `y` - * axis should still be inverted (going from bottom to top). `distance()` returns - * simple euclidean distance. - */ - -var Simple = extend({}, CRS, { - projection: LonLat, - transformation: toTransformation(1, 0, -1, 0), - - scale: function (zoom) { - return Math.pow(2, zoom); - }, - - zoom: function (scale) { - return Math.log(scale) / Math.LN2; - }, - - distance: function (latlng1, latlng2) { - var dx = latlng2.lng - latlng1.lng, - dy = latlng2.lat - latlng1.lat; - - return Math.sqrt(dx * dx + dy * dy); - }, - - infinite: true -}); - -CRS.Earth = Earth; -CRS.EPSG3395 = EPSG3395; -CRS.EPSG3857 = EPSG3857; -CRS.EPSG900913 = EPSG900913; -CRS.EPSG4326 = EPSG4326; -CRS.Simple = Simple; - -/* - * @class Layer - * @inherits Evented - * @aka L.Layer - * @aka ILayer - * - * A set of methods from the Layer base class that all Leaflet layers use. - * Inherits all methods, options and events from `L.Evented`. - * - * @example - * - * ```js - * var layer = L.Marker(latlng).addTo(map); - * layer.addTo(map); - * layer.remove(); - * ``` - * - * @event add: Event - * Fired after the layer is added to a map - * - * @event remove: Event - * Fired after the layer is removed from a map - */ - - -var Layer = Evented.extend({ - - // Classes extending `L.Layer` will inherit the following options: - options: { - // @option pane: String = 'overlayPane' - // By default the layer will be added to the map's [overlay pane](#map-overlaypane). Overriding this option will cause the layer to be placed on another pane by default. - pane: 'overlayPane', - - // @option attribution: String = null - // String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers. - attribution: null, - - bubblingMouseEvents: true - }, - - /* @section - * Classes extending `L.Layer` will inherit the following methods: - * - * @method addTo(map: Map|LayerGroup): this - * Adds the layer to the given map or layer group. - */ - addTo: function (map) { - map.addLayer(this); - return this; - }, - - // @method remove: this - // Removes the layer from the map it is currently active on. - remove: function () { - return this.removeFrom(this._map || this._mapToAdd); - }, - - // @method removeFrom(map: Map): this - // Removes the layer from the given map - removeFrom: function (obj) { - if (obj) { - obj.removeLayer(this); - } - return this; - }, - - // @method getPane(name? : String): HTMLElement - // Returns the `HTMLElement` representing the named pane on the map. If `name` is omitted, returns the pane for this layer. - getPane: function (name) { - return this._map.getPane(name ? (this.options[name] || name) : this.options.pane); - }, - - addInteractiveTarget: function (targetEl) { - this._map._targets[stamp(targetEl)] = this; - return this; - }, - - removeInteractiveTarget: function (targetEl) { - delete this._map._targets[stamp(targetEl)]; - return this; - }, - - // @method getAttribution: String - // Used by the `attribution control`, returns the [attribution option](#gridlayer-attribution). - getAttribution: function () { - return this.options.attribution; - }, - - _layerAdd: function (e) { - var map = e.target; - - // check in case layer gets added and then removed before the map is ready - if (!map.hasLayer(this)) { return; } - - this._map = map; - this._zoomAnimated = map._zoomAnimated; - - if (this.getEvents) { - var events = this.getEvents(); - map.on(events, this); - this.once('remove', function () { - map.off(events, this); - }, this); - } - - this.onAdd(map); - - if (this.getAttribution && map.attributionControl) { - map.attributionControl.addAttribution(this.getAttribution()); - } - - this.fire('add'); - map.fire('layeradd', {layer: this}); - } -}); - -/* @section Extension methods - * @uninheritable - * - * Every layer should extend from `L.Layer` and (re-)implement the following methods. - * - * @method onAdd(map: Map): this - * Should contain code that creates DOM elements for the layer, adds them to `map panes` where they should belong and puts listeners on relevant map events. Called on [`map.addLayer(layer)`](#map-addlayer). - * - * @method onRemove(map: Map): this - * Should contain all clean up code that removes the layer's elements from the DOM and removes listeners previously added in [`onAdd`](#layer-onadd). Called on [`map.removeLayer(layer)`](#map-removelayer). - * - * @method getEvents(): Object - * This optional method should return an object like `{ viewreset: this._reset }` for [`addEventListener`](#evented-addeventlistener). The event handlers in this object will be automatically added and removed from the map with your layer. - * - * @method getAttribution(): String - * This optional method should return a string containing HTML to be shown on the `Attribution control` whenever the layer is visible. - * - * @method beforeAdd(map: Map): this - * Optional method. Called on [`map.addLayer(layer)`](#map-addlayer), before the layer is added to the map, before events are initialized, without waiting until the map is in a usable state. Use for early initialization only. - */ - - -/* @namespace Map - * @section Layer events - * - * @event layeradd: LayerEvent - * Fired when a new layer is added to the map. - * - * @event layerremove: LayerEvent - * Fired when some layer is removed from the map - * - * @section Methods for Layers and Controls - */ -Map.include({ - // @method addLayer(layer: Layer): this - // Adds the given layer to the map - addLayer: function (layer) { - if (!layer._layerAdd) { - throw new Error('The provided object is not a Layer.'); - } - - var id = stamp(layer); - if (this._layers[id]) { return this; } - this._layers[id] = layer; - - layer._mapToAdd = this; - - if (layer.beforeAdd) { - layer.beforeAdd(this); - } - - this.whenReady(layer._layerAdd, layer); - - return this; - }, - - // @method removeLayer(layer: Layer): this - // Removes the given layer from the map. - removeLayer: function (layer) { - var id = stamp(layer); - - if (!this._layers[id]) { return this; } - - if (this._loaded) { - layer.onRemove(this); - } - - if (layer.getAttribution && this.attributionControl) { - this.attributionControl.removeAttribution(layer.getAttribution()); - } - - delete this._layers[id]; - - if (this._loaded) { - this.fire('layerremove', {layer: layer}); - layer.fire('remove'); - } - - layer._map = layer._mapToAdd = null; - - return this; - }, - - // @method hasLayer(layer: Layer): Boolean - // Returns `true` if the given layer is currently added to the map - hasLayer: function (layer) { - return !!layer && (stamp(layer) in this._layers); - }, - - /* @method eachLayer(fn: Function, context?: Object): this - * Iterates over the layers of the map, optionally specifying context of the iterator function. - * ``` - * map.eachLayer(function(layer){ - * layer.bindPopup('Hello'); - * }); - * ``` - */ - eachLayer: function (method, context) { - for (var i in this._layers) { - method.call(context, this._layers[i]); - } - return this; - }, - - _addLayers: function (layers) { - layers = layers ? (isArray(layers) ? layers : [layers]) : []; - - for (var i = 0, len = layers.length; i < len; i++) { - this.addLayer(layers[i]); - } - }, - - _addZoomLimit: function (layer) { - if (isNaN(layer.options.maxZoom) || !isNaN(layer.options.minZoom)) { - this._zoomBoundLayers[stamp(layer)] = layer; - this._updateZoomLevels(); - } - }, - - _removeZoomLimit: function (layer) { - var id = stamp(layer); - - if (this._zoomBoundLayers[id]) { - delete this._zoomBoundLayers[id]; - this._updateZoomLevels(); - } - }, - - _updateZoomLevels: function () { - var minZoom = Infinity, - maxZoom = -Infinity, - oldZoomSpan = this._getZoomSpan(); - - for (var i in this._zoomBoundLayers) { - var options = this._zoomBoundLayers[i].options; - - minZoom = options.minZoom === undefined ? minZoom : Math.min(minZoom, options.minZoom); - maxZoom = options.maxZoom === undefined ? maxZoom : Math.max(maxZoom, options.maxZoom); - } - - this._layersMaxZoom = maxZoom === -Infinity ? undefined : maxZoom; - this._layersMinZoom = minZoom === Infinity ? undefined : minZoom; - - // @section Map state change events - // @event zoomlevelschange: Event - // Fired when the number of zoomlevels on the map is changed due - // to adding or removing a layer. - if (oldZoomSpan !== this._getZoomSpan()) { - this.fire('zoomlevelschange'); - } - - if (this.options.maxZoom === undefined && this._layersMaxZoom && this.getZoom() > this._layersMaxZoom) { - this.setZoom(this._layersMaxZoom); - } - if (this.options.minZoom === undefined && this._layersMinZoom && this.getZoom() < this._layersMinZoom) { - this.setZoom(this._layersMinZoom); - } - } -}); - -/* - * @class LayerGroup - * @aka L.LayerGroup - * @inherits Layer - * - * Used to group several layers and handle them as one. If you add it to the map, - * any layers added or removed from the group will be added/removed on the map as - * well. Extends `Layer`. - * - * @example - * - * ```js - * L.layerGroup([marker1, marker2]) - * .addLayer(polyline) - * .addTo(map); - * ``` - */ - -var LayerGroup = Layer.extend({ - - initialize: function (layers, options) { - setOptions(this, options); - - this._layers = {}; - - var i, len; - - if (layers) { - for (i = 0, len = layers.length; i < len; i++) { - this.addLayer(layers[i]); - } - } - }, - - // @method addLayer(layer: Layer): this - // Adds the given layer to the group. - addLayer: function (layer) { - var id = this.getLayerId(layer); - - this._layers[id] = layer; - - if (this._map) { - this._map.addLayer(layer); - } - - return this; - }, - - // @method removeLayer(layer: Layer): this - // Removes the given layer from the group. - // @alternative - // @method removeLayer(id: Number): this - // Removes the layer with the given internal ID from the group. - removeLayer: function (layer) { - var id = layer in this._layers ? layer : this.getLayerId(layer); - - if (this._map && this._layers[id]) { - this._map.removeLayer(this._layers[id]); - } - - delete this._layers[id]; - - return this; - }, - - // @method hasLayer(layer: Layer): Boolean - // Returns `true` if the given layer is currently added to the group. - // @alternative - // @method hasLayer(id: Number): Boolean - // Returns `true` if the given internal ID is currently added to the group. - hasLayer: function (layer) { - return !!layer && (layer in this._layers || this.getLayerId(layer) in this._layers); - }, - - // @method clearLayers(): this - // Removes all the layers from the group. - clearLayers: function () { - return this.eachLayer(this.removeLayer, this); - }, - - // @method invoke(methodName: String, …): this - // Calls `methodName` on every layer contained in this group, passing any - // additional parameters. Has no effect if the layers contained do not - // implement `methodName`. - invoke: function (methodName) { - var args = Array.prototype.slice.call(arguments, 1), - i, layer; - - for (i in this._layers) { - layer = this._layers[i]; - - if (layer[methodName]) { - layer[methodName].apply(layer, args); - } - } - - return this; - }, - - onAdd: function (map) { - this.eachLayer(map.addLayer, map); - }, - - onRemove: function (map) { - this.eachLayer(map.removeLayer, map); - }, - - // @method eachLayer(fn: Function, context?: Object): this - // Iterates over the layers of the group, optionally specifying context of the iterator function. - // ```js - // group.eachLayer(function (layer) { - // layer.bindPopup('Hello'); - // }); - // ``` - eachLayer: function (method, context) { - for (var i in this._layers) { - method.call(context, this._layers[i]); - } - return this; - }, - - // @method getLayer(id: Number): Layer - // Returns the layer with the given internal ID. - getLayer: function (id) { - return this._layers[id]; - }, - - // @method getLayers(): Layer[] - // Returns an array of all the layers added to the group. - getLayers: function () { - var layers = []; - this.eachLayer(layers.push, layers); - return layers; - }, - - // @method setZIndex(zIndex: Number): this - // Calls `setZIndex` on every layer contained in this group, passing the z-index. - setZIndex: function (zIndex) { - return this.invoke('setZIndex', zIndex); - }, - - // @method getLayerId(layer: Layer): Number - // Returns the internal ID for a layer - getLayerId: function (layer) { - return stamp(layer); - } -}); - - -// @factory L.layerGroup(layers?: Layer[], options?: Object) -// Create a layer group, optionally given an initial set of layers and an `options` object. -var layerGroup = function (layers, options) { - return new LayerGroup(layers, options); -}; - -/* - * @class FeatureGroup - * @aka L.FeatureGroup - * @inherits LayerGroup - * - * Extended `LayerGroup` that makes it easier to do the same thing to all its member layers: - * * [`bindPopup`](#layer-bindpopup) binds a popup to all of the layers at once (likewise with [`bindTooltip`](#layer-bindtooltip)) - * * Events are propagated to the `FeatureGroup`, so if the group has an event - * handler, it will handle events from any of the layers. This includes mouse events - * and custom events. - * * Has `layeradd` and `layerremove` events - * - * @example - * - * ```js - * L.featureGroup([marker1, marker2, polyline]) - * .bindPopup('Hello world!') - * .on('click', function() { alert('Clicked on a member of the group!'); }) - * .addTo(map); - * ``` - */ - -var FeatureGroup = LayerGroup.extend({ - - addLayer: function (layer) { - if (this.hasLayer(layer)) { - return this; - } - - layer.addEventParent(this); - - LayerGroup.prototype.addLayer.call(this, layer); - - // @event layeradd: LayerEvent - // Fired when a layer is added to this `FeatureGroup` - return this.fire('layeradd', {layer: layer}); - }, - - removeLayer: function (layer) { - if (!this.hasLayer(layer)) { - return this; - } - if (layer in this._layers) { - layer = this._layers[layer]; - } - - layer.removeEventParent(this); - - LayerGroup.prototype.removeLayer.call(this, layer); - - // @event layerremove: LayerEvent - // Fired when a layer is removed from this `FeatureGroup` - return this.fire('layerremove', {layer: layer}); - }, - - // @method setStyle(style: Path options): this - // Sets the given path options to each layer of the group that has a `setStyle` method. - setStyle: function (style) { - return this.invoke('setStyle', style); - }, - - // @method bringToFront(): this - // Brings the layer group to the top of all other layers - bringToFront: function () { - return this.invoke('bringToFront'); - }, - - // @method bringToBack(): this - // Brings the layer group to the back of all other layers - bringToBack: function () { - return this.invoke('bringToBack'); - }, - - // @method getBounds(): LatLngBounds - // Returns the LatLngBounds of the Feature Group (created from bounds and coordinates of its children). - getBounds: function () { - var bounds = new LatLngBounds(); - - for (var id in this._layers) { - var layer = this._layers[id]; - bounds.extend(layer.getBounds ? layer.getBounds() : layer.getLatLng()); - } - return bounds; - } -}); - -// @factory L.featureGroup(layers: Layer[]) -// Create a feature group, optionally given an initial set of layers. -var featureGroup = function (layers) { - return new FeatureGroup(layers); -}; - -/* - * @class Icon - * @aka L.Icon - * - * Represents an icon to provide when creating a marker. - * - * @example - * - * ```js - * var myIcon = L.icon({ - * iconUrl: 'my-icon.png', - * iconRetinaUrl: 'my-icon@2x.png', - * iconSize: [38, 95], - * iconAnchor: [22, 94], - * popupAnchor: [-3, -76], - * shadowUrl: 'my-icon-shadow.png', - * shadowRetinaUrl: 'my-icon-shadow@2x.png', - * shadowSize: [68, 95], - * shadowAnchor: [22, 94] - * }); - * - * L.marker([50.505, 30.57], {icon: myIcon}).addTo(map); - * ``` - * - * `L.Icon.Default` extends `L.Icon` and is the blue icon Leaflet uses for markers by default. - * - */ - -var Icon = Class.extend({ - - /* @section - * @aka Icon options - * - * @option iconUrl: String = null - * **(required)** The URL to the icon image (absolute or relative to your script path). - * - * @option iconRetinaUrl: String = null - * The URL to a retina sized version of the icon image (absolute or relative to your - * script path). Used for Retina screen devices. - * - * @option iconSize: Point = null - * Size of the icon image in pixels. - * - * @option iconAnchor: Point = null - * The coordinates of the "tip" of the icon (relative to its top left corner). The icon - * will be aligned so that this point is at the marker's geographical location. Centered - * by default if size is specified, also can be set in CSS with negative margins. - * - * @option popupAnchor: Point = [0, 0] - * The coordinates of the point from which popups will "open", relative to the icon anchor. - * - * @option tooltipAnchor: Point = [0, 0] - * The coordinates of the point from which tooltips will "open", relative to the icon anchor. - * - * @option shadowUrl: String = null - * The URL to the icon shadow image. If not specified, no shadow image will be created. - * - * @option shadowRetinaUrl: String = null - * - * @option shadowSize: Point = null - * Size of the shadow image in pixels. - * - * @option shadowAnchor: Point = null - * The coordinates of the "tip" of the shadow (relative to its top left corner) (the same - * as iconAnchor if not specified). - * - * @option className: String = '' - * A custom class name to assign to both icon and shadow images. Empty by default. - */ - - options: { - popupAnchor: [0, 0], - tooltipAnchor: [0, 0] - }, - - initialize: function (options) { - setOptions(this, options); - }, - - // @method createIcon(oldIcon?: HTMLElement): HTMLElement - // Called internally when the icon has to be shown, returns a `` HTML element - // styled according to the options. - createIcon: function (oldIcon) { - return this._createIcon('icon', oldIcon); - }, - - // @method createShadow(oldIcon?: HTMLElement): HTMLElement - // As `createIcon`, but for the shadow beneath it. - createShadow: function (oldIcon) { - return this._createIcon('shadow', oldIcon); - }, - - _createIcon: function (name, oldIcon) { - var src = this._getIconUrl(name); - - if (!src) { - if (name === 'icon') { - throw new Error('iconUrl not set in Icon options (see the docs).'); - } - return null; - } - - var img = this._createImg(src, oldIcon && oldIcon.tagName === 'IMG' ? oldIcon : null); - this._setIconStyles(img, name); - - return img; - }, - - _setIconStyles: function (img, name) { - var options = this.options; - var sizeOption = options[name + 'Size']; - - if (typeof sizeOption === 'number') { - sizeOption = [sizeOption, sizeOption]; - } - - var size = toPoint(sizeOption), - anchor = toPoint(name === 'shadow' && options.shadowAnchor || options.iconAnchor || - size && size.divideBy(2, true)); - - img.className = 'leaflet-marker-' + name + ' ' + (options.className || ''); - - if (anchor) { - img.style.marginLeft = (-anchor.x) + 'px'; - img.style.marginTop = (-anchor.y) + 'px'; - } - - if (size) { - img.style.width = size.x + 'px'; - img.style.height = size.y + 'px'; - } - }, - - _createImg: function (src, el) { - el = el || document.createElement('img'); - el.src = src; - return el; - }, - - _getIconUrl: function (name) { - return retina && this.options[name + 'RetinaUrl'] || this.options[name + 'Url']; - } -}); - - -// @factory L.icon(options: Icon options) -// Creates an icon instance with the given options. -function icon(options) { - return new Icon(options); -} - -/* - * @miniclass Icon.Default (Icon) - * @aka L.Icon.Default - * @section - * - * A trivial subclass of `Icon`, represents the icon to use in `Marker`s when - * no icon is specified. Points to the blue marker image distributed with Leaflet - * releases. - * - * In order to customize the default icon, just change the properties of `L.Icon.Default.prototype.options` - * (which is a set of `Icon options`). - * - * If you want to _completely_ replace the default icon, override the - * `L.Marker.prototype.options.icon` with your own icon instead. - */ - -var IconDefault = Icon.extend({ - - options: { - iconUrl: 'marker-icon.png', - iconRetinaUrl: 'marker-icon-2x.png', - shadowUrl: 'marker-shadow.png', - iconSize: [25, 41], - iconAnchor: [12, 41], - popupAnchor: [1, -34], - tooltipAnchor: [16, -28], - shadowSize: [41, 41] - }, - - _getIconUrl: function (name) { - if (!IconDefault.imagePath) { // Deprecated, backwards-compatibility only - IconDefault.imagePath = this._detectIconPath(); - } - - // @option imagePath: String - // `Icon.Default` will try to auto-detect the location of the - // blue icon images. If you are placing these images in a non-standard - // way, set this option to point to the right path. - return (this.options.imagePath || IconDefault.imagePath) + Icon.prototype._getIconUrl.call(this, name); - }, - - _detectIconPath: function () { - var el = create$1('div', 'leaflet-default-icon-path', document.body); - var path = getStyle(el, 'background-image') || - getStyle(el, 'backgroundImage'); // IE8 - - document.body.removeChild(el); - - if (path === null || path.indexOf('url') !== 0) { - path = ''; - } else { - path = path.replace(/^url\(["']?/, '').replace(/marker-icon\.png["']?\)$/, ''); - } - - return path; - } -}); - -/* - * L.Handler.MarkerDrag is used internally by L.Marker to make the markers draggable. - */ - - -/* @namespace Marker - * @section Interaction handlers - * - * Interaction handlers are properties of a marker instance that allow you to control interaction behavior in runtime, enabling or disabling certain features such as dragging (see `Handler` methods). Example: - * - * ```js - * marker.dragging.disable(); - * ``` - * - * @property dragging: Handler - * Marker dragging handler (by both mouse and touch). Only valid when the marker is on the map (Otherwise set [`marker.options.draggable`](#marker-draggable)). - */ - -var MarkerDrag = Handler.extend({ - initialize: function (marker) { - this._marker = marker; - }, - - addHooks: function () { - var icon = this._marker._icon; - - if (!this._draggable) { - this._draggable = new Draggable(icon, icon, true); - } - - this._draggable.on({ - dragstart: this._onDragStart, - predrag: this._onPreDrag, - drag: this._onDrag, - dragend: this._onDragEnd - }, this).enable(); - - addClass(icon, 'leaflet-marker-draggable'); - }, - - removeHooks: function () { - this._draggable.off({ - dragstart: this._onDragStart, - predrag: this._onPreDrag, - drag: this._onDrag, - dragend: this._onDragEnd - }, this).disable(); - - if (this._marker._icon) { - removeClass(this._marker._icon, 'leaflet-marker-draggable'); - } - }, - - moved: function () { - return this._draggable && this._draggable._moved; - }, - - _adjustPan: function (e) { - var marker = this._marker, - map = marker._map, - speed = this._marker.options.autoPanSpeed, - padding = this._marker.options.autoPanPadding, - iconPos = getPosition(marker._icon), - bounds = map.getPixelBounds(), - origin = map.getPixelOrigin(); - - var panBounds = toBounds( - bounds.min._subtract(origin).add(padding), - bounds.max._subtract(origin).subtract(padding) - ); - - if (!panBounds.contains(iconPos)) { - // Compute incremental movement - var movement = toPoint( - (Math.max(panBounds.max.x, iconPos.x) - panBounds.max.x) / (bounds.max.x - panBounds.max.x) - - (Math.min(panBounds.min.x, iconPos.x) - panBounds.min.x) / (bounds.min.x - panBounds.min.x), - - (Math.max(panBounds.max.y, iconPos.y) - panBounds.max.y) / (bounds.max.y - panBounds.max.y) - - (Math.min(panBounds.min.y, iconPos.y) - panBounds.min.y) / (bounds.min.y - panBounds.min.y) - ).multiplyBy(speed); - - map.panBy(movement, {animate: false}); - - this._draggable._newPos._add(movement); - this._draggable._startPos._add(movement); - - setPosition(marker._icon, this._draggable._newPos); - this._onDrag(e); - - this._panRequest = requestAnimFrame(this._adjustPan.bind(this, e)); - } - }, - - _onDragStart: function () { - // @section Dragging events - // @event dragstart: Event - // Fired when the user starts dragging the marker. - - // @event movestart: Event - // Fired when the marker starts moving (because of dragging). - - this._oldLatLng = this._marker.getLatLng(); - this._marker - .closePopup() - .fire('movestart') - .fire('dragstart'); - }, - - _onPreDrag: function (e) { - if (this._marker.options.autoPan) { - cancelAnimFrame(this._panRequest); - this._panRequest = requestAnimFrame(this._adjustPan.bind(this, e)); - } - }, - - _onDrag: function (e) { - var marker = this._marker, - shadow = marker._shadow, - iconPos = getPosition(marker._icon), - latlng = marker._map.layerPointToLatLng(iconPos); - - // update shadow position - if (shadow) { - setPosition(shadow, iconPos); - } - - marker._latlng = latlng; - e.latlng = latlng; - e.oldLatLng = this._oldLatLng; - - // @event drag: Event - // Fired repeatedly while the user drags the marker. - marker - .fire('move', e) - .fire('drag', e); - }, - - _onDragEnd: function (e) { - // @event dragend: DragEndEvent - // Fired when the user stops dragging the marker. - - cancelAnimFrame(this._panRequest); - - // @event moveend: Event - // Fired when the marker stops moving (because of dragging). - delete this._oldLatLng; - this._marker - .fire('moveend') - .fire('dragend', e); - } -}); - -/* - * @class Marker - * @inherits Interactive layer - * @aka L.Marker - * L.Marker is used to display clickable/draggable icons on the map. Extends `Layer`. - * - * @example - * - * ```js - * L.marker([50.5, 30.5]).addTo(map); - * ``` - */ - -var Marker = Layer.extend({ - - // @section - // @aka Marker options - options: { - // @option icon: Icon = * - // Icon instance to use for rendering the marker. - // See [Icon documentation](#L.Icon) for details on how to customize the marker icon. - // If not specified, a common instance of `L.Icon.Default` is used. - icon: new IconDefault(), - - // Option inherited from "Interactive layer" abstract class - interactive: true, - - // @option keyboard: Boolean = true - // Whether the marker can be tabbed to with a keyboard and clicked by pressing enter. - keyboard: true, - - // @option title: String = '' - // Text for the browser tooltip that appear on marker hover (no tooltip by default). - title: '', - - // @option alt: String = '' - // Text for the `alt` attribute of the icon image (useful for accessibility). - alt: '', - - // @option zIndexOffset: Number = 0 - // By default, marker images zIndex is set automatically based on its latitude. Use this option if you want to put the marker on top of all others (or below), specifying a high value like `1000` (or high negative value, respectively). - zIndexOffset: 0, - - // @option opacity: Number = 1.0 - // The opacity of the marker. - opacity: 1, - - // @option riseOnHover: Boolean = false - // If `true`, the marker will get on top of others when you hover the mouse over it. - riseOnHover: false, - - // @option riseOffset: Number = 250 - // The z-index offset used for the `riseOnHover` feature. - riseOffset: 250, - - // @option pane: String = 'markerPane' - // `Map pane` where the markers icon will be added. - pane: 'markerPane', - - // @option bubblingMouseEvents: Boolean = false - // When `true`, a mouse event on this marker will trigger the same event on the map - // (unless [`L.DomEvent.stopPropagation`](#domevent-stoppropagation) is used). - bubblingMouseEvents: false, - - // @section Draggable marker options - // @option draggable: Boolean = false - // Whether the marker is draggable with mouse/touch or not. - draggable: false, - - // @option autoPan: Boolean = false - // Whether to pan the map when dragging this marker near its edge or not. - autoPan: false, - - // @option autoPanPadding: Point = Point(50, 50) - // Distance (in pixels to the left/right and to the top/bottom) of the - // map edge to start panning the map. - autoPanPadding: [50, 50], - - // @option autoPanSpeed: Number = 10 - // Number of pixels the map should pan by. - autoPanSpeed: 10 - }, - - /* @section - * - * In addition to [shared layer methods](#Layer) like `addTo()` and `remove()` and [popup methods](#Popup) like bindPopup() you can also use the following methods: - */ - - initialize: function (latlng, options) { - setOptions(this, options); - this._latlng = toLatLng(latlng); - }, - - onAdd: function (map) { - this._zoomAnimated = this._zoomAnimated && map.options.markerZoomAnimation; - - if (this._zoomAnimated) { - map.on('zoomanim', this._animateZoom, this); - } - - this._initIcon(); - this.update(); - }, - - onRemove: function (map) { - if (this.dragging && this.dragging.enabled()) { - this.options.draggable = true; - this.dragging.removeHooks(); - } - delete this.dragging; - - if (this._zoomAnimated) { - map.off('zoomanim', this._animateZoom, this); - } - - this._removeIcon(); - this._removeShadow(); - }, - - getEvents: function () { - return { - zoom: this.update, - viewreset: this.update - }; - }, - - // @method getLatLng: LatLng - // Returns the current geographical position of the marker. - getLatLng: function () { - return this._latlng; - }, - - // @method setLatLng(latlng: LatLng): this - // Changes the marker position to the given point. - setLatLng: function (latlng) { - var oldLatLng = this._latlng; - this._latlng = toLatLng(latlng); - this.update(); - - // @event move: Event - // Fired when the marker is moved via [`setLatLng`](#marker-setlatlng) or by [dragging](#marker-dragging). Old and new coordinates are included in event arguments as `oldLatLng`, `latlng`. - return this.fire('move', {oldLatLng: oldLatLng, latlng: this._latlng}); - }, - - // @method setZIndexOffset(offset: Number): this - // Changes the [zIndex offset](#marker-zindexoffset) of the marker. - setZIndexOffset: function (offset) { - this.options.zIndexOffset = offset; - return this.update(); - }, - - // @method setIcon(icon: Icon): this - // Changes the marker icon. - setIcon: function (icon) { - - this.options.icon = icon; - - if (this._map) { - this._initIcon(); - this.update(); - } - - if (this._popup) { - this.bindPopup(this._popup, this._popup.options); - } - - return this; - }, - - getElement: function () { - return this._icon; - }, - - update: function () { - - if (this._icon && this._map) { - var pos = this._map.latLngToLayerPoint(this._latlng).round(); - this._setPos(pos); - } - - return this; - }, - - _initIcon: function () { - var options = this.options, - classToAdd = 'leaflet-zoom-' + (this._zoomAnimated ? 'animated' : 'hide'); - - var icon = options.icon.createIcon(this._icon), - addIcon = false; - - // if we're not reusing the icon, remove the old one and init new one - if (icon !== this._icon) { - if (this._icon) { - this._removeIcon(); - } - addIcon = true; - - if (options.title) { - icon.title = options.title; - } - - if (icon.tagName === 'IMG') { - icon.alt = options.alt || ''; - } - } - - addClass(icon, classToAdd); - - if (options.keyboard) { - icon.tabIndex = '0'; - } - - this._icon = icon; - - if (options.riseOnHover) { - this.on({ - mouseover: this._bringToFront, - mouseout: this._resetZIndex - }); - } - - var newShadow = options.icon.createShadow(this._shadow), - addShadow = false; - - if (newShadow !== this._shadow) { - this._removeShadow(); - addShadow = true; - } - - if (newShadow) { - addClass(newShadow, classToAdd); - newShadow.alt = ''; - } - this._shadow = newShadow; - - - if (options.opacity < 1) { - this._updateOpacity(); - } - - - if (addIcon) { - this.getPane().appendChild(this._icon); - } - this._initInteraction(); - if (newShadow && addShadow) { - this.getPane('shadowPane').appendChild(this._shadow); - } - }, - - _removeIcon: function () { - if (this.options.riseOnHover) { - this.off({ - mouseover: this._bringToFront, - mouseout: this._resetZIndex - }); - } - - remove(this._icon); - this.removeInteractiveTarget(this._icon); - - this._icon = null; - }, - - _removeShadow: function () { - if (this._shadow) { - remove(this._shadow); - } - this._shadow = null; - }, - - _setPos: function (pos) { - setPosition(this._icon, pos); - - if (this._shadow) { - setPosition(this._shadow, pos); - } - - this._zIndex = pos.y + this.options.zIndexOffset; - - this._resetZIndex(); - }, - - _updateZIndex: function (offset) { - this._icon.style.zIndex = this._zIndex + offset; - }, - - _animateZoom: function (opt) { - var pos = this._map._latLngToNewLayerPoint(this._latlng, opt.zoom, opt.center).round(); - - this._setPos(pos); - }, - - _initInteraction: function () { - - if (!this.options.interactive) { return; } - - addClass(this._icon, 'leaflet-interactive'); - - this.addInteractiveTarget(this._icon); - - if (MarkerDrag) { - var draggable = this.options.draggable; - if (this.dragging) { - draggable = this.dragging.enabled(); - this.dragging.disable(); - } - - this.dragging = new MarkerDrag(this); - - if (draggable) { - this.dragging.enable(); - } - } - }, - - // @method setOpacity(opacity: Number): this - // Changes the opacity of the marker. - setOpacity: function (opacity) { - this.options.opacity = opacity; - if (this._map) { - this._updateOpacity(); - } - - return this; - }, - - _updateOpacity: function () { - var opacity = this.options.opacity; - - setOpacity(this._icon, opacity); - - if (this._shadow) { - setOpacity(this._shadow, opacity); - } - }, - - _bringToFront: function () { - this._updateZIndex(this.options.riseOffset); - }, - - _resetZIndex: function () { - this._updateZIndex(0); - }, - - _getPopupAnchor: function () { - return this.options.icon.options.popupAnchor; - }, - - _getTooltipAnchor: function () { - return this.options.icon.options.tooltipAnchor; - } -}); - - -// factory L.marker(latlng: LatLng, options? : Marker options) - -// @factory L.marker(latlng: LatLng, options? : Marker options) -// Instantiates a Marker object given a geographical point and optionally an options object. -function marker(latlng, options) { - return new Marker(latlng, options); -} - -/* - * @class Path - * @aka L.Path - * @inherits Interactive layer - * - * An abstract class that contains options and constants shared between vector - * overlays (Polygon, Polyline, Circle). Do not use it directly. Extends `Layer`. - */ - -var Path = Layer.extend({ - - // @section - // @aka Path options - options: { - // @option stroke: Boolean = true - // Whether to draw stroke along the path. Set it to `false` to disable borders on polygons or circles. - stroke: true, - - // @option color: String = '#3388ff' - // Stroke color - color: '#3388ff', - - // @option weight: Number = 3 - // Stroke width in pixels - weight: 3, - - // @option opacity: Number = 1.0 - // Stroke opacity - opacity: 1, - - // @option lineCap: String= 'round' - // A string that defines [shape to be used at the end](https://developer.mozilla.org/docs/Web/SVG/Attribute/stroke-linecap) of the stroke. - lineCap: 'round', - - // @option lineJoin: String = 'round' - // A string that defines [shape to be used at the corners](https://developer.mozilla.org/docs/Web/SVG/Attribute/stroke-linejoin) of the stroke. - lineJoin: 'round', - - // @option dashArray: String = null - // A string that defines the stroke [dash pattern](https://developer.mozilla.org/docs/Web/SVG/Attribute/stroke-dasharray). Doesn't work on `Canvas`-powered layers in [some old browsers](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/setLineDash#Browser_compatibility). - dashArray: null, - - // @option dashOffset: String = null - // A string that defines the [distance into the dash pattern to start the dash](https://developer.mozilla.org/docs/Web/SVG/Attribute/stroke-dashoffset). Doesn't work on `Canvas`-powered layers in [some old browsers](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/setLineDash#Browser_compatibility). - dashOffset: null, - - // @option fill: Boolean = depends - // Whether to fill the path with color. Set it to `false` to disable filling on polygons or circles. - fill: false, - - // @option fillColor: String = * - // Fill color. Defaults to the value of the [`color`](#path-color) option - fillColor: null, - - // @option fillOpacity: Number = 0.2 - // Fill opacity. - fillOpacity: 0.2, - - // @option fillRule: String = 'evenodd' - // A string that defines [how the inside of a shape](https://developer.mozilla.org/docs/Web/SVG/Attribute/fill-rule) is determined. - fillRule: 'evenodd', - - // className: '', - - // Option inherited from "Interactive layer" abstract class - interactive: true, - - // @option bubblingMouseEvents: Boolean = true - // When `true`, a mouse event on this path will trigger the same event on the map - // (unless [`L.DomEvent.stopPropagation`](#domevent-stoppropagation) is used). - bubblingMouseEvents: true - }, - - beforeAdd: function (map) { - // Renderer is set here because we need to call renderer.getEvents - // before this.getEvents. - this._renderer = map.getRenderer(this); - }, - - onAdd: function () { - this._renderer._initPath(this); - this._reset(); - this._renderer._addPath(this); - }, - - onRemove: function () { - this._renderer._removePath(this); - }, - - // @method redraw(): this - // Redraws the layer. Sometimes useful after you changed the coordinates that the path uses. - redraw: function () { - if (this._map) { - this._renderer._updatePath(this); - } - return this; - }, - - // @method setStyle(style: Path options): this - // Changes the appearance of a Path based on the options in the `Path options` object. - setStyle: function (style) { - setOptions(this, style); - if (this._renderer) { - this._renderer._updateStyle(this); - } - return this; - }, - - // @method bringToFront(): this - // Brings the layer to the top of all path layers. - bringToFront: function () { - if (this._renderer) { - this._renderer._bringToFront(this); - } - return this; - }, - - // @method bringToBack(): this - // Brings the layer to the bottom of all path layers. - bringToBack: function () { - if (this._renderer) { - this._renderer._bringToBack(this); - } - return this; - }, - - getElement: function () { - return this._path; - }, - - _reset: function () { - // defined in child classes - this._project(); - this._update(); - }, - - _clickTolerance: function () { - // used when doing hit detection for Canvas layers - return (this.options.stroke ? this.options.weight / 2 : 0) + this._renderer.options.tolerance; - } -}); - -/* - * @class CircleMarker - * @aka L.CircleMarker - * @inherits Path - * - * A circle of a fixed size with radius specified in pixels. Extends `Path`. - */ - -var CircleMarker = Path.extend({ - - // @section - // @aka CircleMarker options - options: { - fill: true, - - // @option radius: Number = 10 - // Radius of the circle marker, in pixels - radius: 10 - }, - - initialize: function (latlng, options) { - setOptions(this, options); - this._latlng = toLatLng(latlng); - this._radius = this.options.radius; - }, - - // @method setLatLng(latLng: LatLng): this - // Sets the position of a circle marker to a new location. - setLatLng: function (latlng) { - this._latlng = toLatLng(latlng); - this.redraw(); - return this.fire('move', {latlng: this._latlng}); - }, - - // @method getLatLng(): LatLng - // Returns the current geographical position of the circle marker - getLatLng: function () { - return this._latlng; - }, - - // @method setRadius(radius: Number): this - // Sets the radius of a circle marker. Units are in pixels. - setRadius: function (radius) { - this.options.radius = this._radius = radius; - return this.redraw(); - }, - - // @method getRadius(): Number - // Returns the current radius of the circle - getRadius: function () { - return this._radius; - }, - - setStyle : function (options) { - var radius = options && options.radius || this._radius; - Path.prototype.setStyle.call(this, options); - this.setRadius(radius); - return this; - }, - - _project: function () { - this._point = this._map.latLngToLayerPoint(this._latlng); - this._updateBounds(); - }, - - _updateBounds: function () { - var r = this._radius, - r2 = this._radiusY || r, - w = this._clickTolerance(), - p = [r + w, r2 + w]; - this._pxBounds = new Bounds(this._point.subtract(p), this._point.add(p)); - }, - - _update: function () { - if (this._map) { - this._updatePath(); - } - }, - - _updatePath: function () { - this._renderer._updateCircle(this); - }, - - _empty: function () { - return this._radius && !this._renderer._bounds.intersects(this._pxBounds); - }, - - // Needed by the `Canvas` renderer for interactivity - _containsPoint: function (p) { - return p.distanceTo(this._point) <= this._radius + this._clickTolerance(); - } -}); - - -// @factory L.circleMarker(latlng: LatLng, options?: CircleMarker options) -// Instantiates a circle marker object given a geographical point, and an optional options object. -function circleMarker(latlng, options) { - return new CircleMarker(latlng, options); -} - -/* - * @class Circle - * @aka L.Circle - * @inherits CircleMarker - * - * A class for drawing circle overlays on a map. Extends `CircleMarker`. - * - * It's an approximation and starts to diverge from a real circle closer to poles (due to projection distortion). - * - * @example - * - * ```js - * L.circle([50.5, 30.5], {radius: 200}).addTo(map); - * ``` - */ - -var Circle = CircleMarker.extend({ - - initialize: function (latlng, options, legacyOptions) { - if (typeof options === 'number') { - // Backwards compatibility with 0.7.x factory (latlng, radius, options?) - options = extend({}, legacyOptions, {radius: options}); - } - setOptions(this, options); - this._latlng = toLatLng(latlng); - - if (isNaN(this.options.radius)) { throw new Error('Circle radius cannot be NaN'); } - - // @section - // @aka Circle options - // @option radius: Number; Radius of the circle, in meters. - this._mRadius = this.options.radius; - }, - - // @method setRadius(radius: Number): this - // Sets the radius of a circle. Units are in meters. - setRadius: function (radius) { - this._mRadius = radius; - return this.redraw(); - }, - - // @method getRadius(): Number - // Returns the current radius of a circle. Units are in meters. - getRadius: function () { - return this._mRadius; - }, - - // @method getBounds(): LatLngBounds - // Returns the `LatLngBounds` of the path. - getBounds: function () { - var half = [this._radius, this._radiusY || this._radius]; - - return new LatLngBounds( - this._map.layerPointToLatLng(this._point.subtract(half)), - this._map.layerPointToLatLng(this._point.add(half))); - }, - - setStyle: Path.prototype.setStyle, - - _project: function () { - - var lng = this._latlng.lng, - lat = this._latlng.lat, - map = this._map, - crs = map.options.crs; - - if (crs.distance === Earth.distance) { - var d = Math.PI / 180, - latR = (this._mRadius / Earth.R) / d, - top = map.project([lat + latR, lng]), - bottom = map.project([lat - latR, lng]), - p = top.add(bottom).divideBy(2), - lat2 = map.unproject(p).lat, - lngR = Math.acos((Math.cos(latR * d) - Math.sin(lat * d) * Math.sin(lat2 * d)) / - (Math.cos(lat * d) * Math.cos(lat2 * d))) / d; - - if (isNaN(lngR) || lngR === 0) { - lngR = latR / Math.cos(Math.PI / 180 * lat); // Fallback for edge case, #2425 - } - - this._point = p.subtract(map.getPixelOrigin()); - this._radius = isNaN(lngR) ? 0 : p.x - map.project([lat2, lng - lngR]).x; - this._radiusY = p.y - top.y; - - } else { - var latlng2 = crs.unproject(crs.project(this._latlng).subtract([this._mRadius, 0])); - - this._point = map.latLngToLayerPoint(this._latlng); - this._radius = this._point.x - map.latLngToLayerPoint(latlng2).x; - } - - this._updateBounds(); - } -}); - -// @factory L.circle(latlng: LatLng, options?: Circle options) -// Instantiates a circle object given a geographical point, and an options object -// which contains the circle radius. -// @alternative -// @factory L.circle(latlng: LatLng, radius: Number, options?: Circle options) -// Obsolete way of instantiating a circle, for compatibility with 0.7.x code. -// Do not use in new applications or plugins. -function circle(latlng, options, legacyOptions) { - return new Circle(latlng, options, legacyOptions); -} - -/* - * @class Polyline - * @aka L.Polyline - * @inherits Path - * - * A class for drawing polyline overlays on a map. Extends `Path`. - * - * @example - * - * ```js - * // create a red polyline from an array of LatLng points - * var latlngs = [ - * [45.51, -122.68], - * [37.77, -122.43], - * [34.04, -118.2] - * ]; - * - * var polyline = L.polyline(latlngs, {color: 'red'}).addTo(map); - * - * // zoom the map to the polyline - * map.fitBounds(polyline.getBounds()); - * ``` - * - * You can also pass a multi-dimensional array to represent a `MultiPolyline` shape: - * - * ```js - * // create a red polyline from an array of arrays of LatLng points - * var latlngs = [ - * [[45.51, -122.68], - * [37.77, -122.43], - * [34.04, -118.2]], - * [[40.78, -73.91], - * [41.83, -87.62], - * [32.76, -96.72]] - * ]; - * ``` - */ - - -var Polyline = Path.extend({ - - // @section - // @aka Polyline options - options: { - // @option smoothFactor: Number = 1.0 - // How much to simplify the polyline on each zoom level. More means - // better performance and smoother look, and less means more accurate representation. - smoothFactor: 1.0, - - // @option noClip: Boolean = false - // Disable polyline clipping. - noClip: false - }, - - initialize: function (latlngs, options) { - setOptions(this, options); - this._setLatLngs(latlngs); - }, - - // @method getLatLngs(): LatLng[] - // Returns an array of the points in the path, or nested arrays of points in case of multi-polyline. - getLatLngs: function () { - return this._latlngs; - }, - - // @method setLatLngs(latlngs: LatLng[]): this - // Replaces all the points in the polyline with the given array of geographical points. - setLatLngs: function (latlngs) { - this._setLatLngs(latlngs); - return this.redraw(); - }, - - // @method isEmpty(): Boolean - // Returns `true` if the Polyline has no LatLngs. - isEmpty: function () { - return !this._latlngs.length; - }, - - // @method closestLayerPoint(p: Point): Point - // Returns the point closest to `p` on the Polyline. - closestLayerPoint: function (p) { - var minDistance = Infinity, - minPoint = null, - closest = _sqClosestPointOnSegment, - p1, p2; - - for (var j = 0, jLen = this._parts.length; j < jLen; j++) { - var points = this._parts[j]; - - for (var i = 1, len = points.length; i < len; i++) { - p1 = points[i - 1]; - p2 = points[i]; - - var sqDist = closest(p, p1, p2, true); - - if (sqDist < minDistance) { - minDistance = sqDist; - minPoint = closest(p, p1, p2); - } - } - } - if (minPoint) { - minPoint.distance = Math.sqrt(minDistance); - } - return minPoint; - }, - - // @method getCenter(): LatLng - // Returns the center ([centroid](http://en.wikipedia.org/wiki/Centroid)) of the polyline. - getCenter: function () { - // throws error when not yet added to map as this center calculation requires projected coordinates - if (!this._map) { - throw new Error('Must add layer to map before using getCenter()'); - } - - var i, halfDist, segDist, dist, p1, p2, ratio, - points = this._rings[0], - len = points.length; - - if (!len) { return null; } - - // polyline centroid algorithm; only uses the first ring if there are multiple - - for (i = 0, halfDist = 0; i < len - 1; i++) { - halfDist += points[i].distanceTo(points[i + 1]) / 2; - } - - // The line is so small in the current view that all points are on the same pixel. - if (halfDist === 0) { - return this._map.layerPointToLatLng(points[0]); - } - - for (i = 0, dist = 0; i < len - 1; i++) { - p1 = points[i]; - p2 = points[i + 1]; - segDist = p1.distanceTo(p2); - dist += segDist; - - if (dist > halfDist) { - ratio = (dist - halfDist) / segDist; - return this._map.layerPointToLatLng([ - p2.x - ratio * (p2.x - p1.x), - p2.y - ratio * (p2.y - p1.y) - ]); - } - } - }, - - // @method getBounds(): LatLngBounds - // Returns the `LatLngBounds` of the path. - getBounds: function () { - return this._bounds; - }, - - // @method addLatLng(latlng: LatLng, latlngs? LatLng[]): this - // Adds a given point to the polyline. By default, adds to the first ring of - // the polyline in case of a multi-polyline, but can be overridden by passing - // a specific ring as a LatLng array (that you can earlier access with [`getLatLngs`](#polyline-getlatlngs)). - addLatLng: function (latlng, latlngs) { - latlngs = latlngs || this._defaultShape(); - latlng = toLatLng(latlng); - latlngs.push(latlng); - this._bounds.extend(latlng); - return this.redraw(); - }, - - _setLatLngs: function (latlngs) { - this._bounds = new LatLngBounds(); - this._latlngs = this._convertLatLngs(latlngs); - }, - - _defaultShape: function () { - return isFlat(this._latlngs) ? this._latlngs : this._latlngs[0]; - }, - - // recursively convert latlngs input into actual LatLng instances; calculate bounds along the way - _convertLatLngs: function (latlngs) { - var result = [], - flat = isFlat(latlngs); - - for (var i = 0, len = latlngs.length; i < len; i++) { - if (flat) { - result[i] = toLatLng(latlngs[i]); - this._bounds.extend(result[i]); - } else { - result[i] = this._convertLatLngs(latlngs[i]); - } - } - - return result; - }, - - _project: function () { - var pxBounds = new Bounds(); - this._rings = []; - this._projectLatlngs(this._latlngs, this._rings, pxBounds); - - var w = this._clickTolerance(), - p = new Point(w, w); - - if (this._bounds.isValid() && pxBounds.isValid()) { - pxBounds.min._subtract(p); - pxBounds.max._add(p); - this._pxBounds = pxBounds; - } - }, - - // recursively turns latlngs into a set of rings with projected coordinates - _projectLatlngs: function (latlngs, result, projectedBounds) { - var flat = latlngs[0] instanceof LatLng, - len = latlngs.length, - i, ring; - - if (flat) { - ring = []; - for (i = 0; i < len; i++) { - ring[i] = this._map.latLngToLayerPoint(latlngs[i]); - projectedBounds.extend(ring[i]); - } - result.push(ring); - } else { - for (i = 0; i < len; i++) { - this._projectLatlngs(latlngs[i], result, projectedBounds); - } - } - }, - - // clip polyline by renderer bounds so that we have less to render for performance - _clipPoints: function () { - var bounds = this._renderer._bounds; - - this._parts = []; - if (!this._pxBounds || !this._pxBounds.intersects(bounds)) { - return; - } - - if (this.options.noClip) { - this._parts = this._rings; - return; - } - - var parts = this._parts, - i, j, k, len, len2, segment, points; - - for (i = 0, k = 0, len = this._rings.length; i < len; i++) { - points = this._rings[i]; - - for (j = 0, len2 = points.length; j < len2 - 1; j++) { - segment = clipSegment(points[j], points[j + 1], bounds, j, true); - - if (!segment) { continue; } - - parts[k] = parts[k] || []; - parts[k].push(segment[0]); - - // if segment goes out of screen, or it's the last one, it's the end of the line part - if ((segment[1] !== points[j + 1]) || (j === len2 - 2)) { - parts[k].push(segment[1]); - k++; - } - } - } - }, - - // simplify each clipped part of the polyline for performance - _simplifyPoints: function () { - var parts = this._parts, - tolerance = this.options.smoothFactor; - - for (var i = 0, len = parts.length; i < len; i++) { - parts[i] = simplify(parts[i], tolerance); - } - }, - - _update: function () { - if (!this._map) { return; } - - this._clipPoints(); - this._simplifyPoints(); - this._updatePath(); - }, - - _updatePath: function () { - this._renderer._updatePoly(this); - }, - - // Needed by the `Canvas` renderer for interactivity - _containsPoint: function (p, closed) { - var i, j, k, len, len2, part, - w = this._clickTolerance(); - - if (!this._pxBounds || !this._pxBounds.contains(p)) { return false; } - - // hit detection for polylines - for (i = 0, len = this._parts.length; i < len; i++) { - part = this._parts[i]; - - for (j = 0, len2 = part.length, k = len2 - 1; j < len2; k = j++) { - if (!closed && (j === 0)) { continue; } - - if (pointToSegmentDistance(p, part[k], part[j]) <= w) { - return true; - } - } - } - return false; - } -}); - -// @factory L.polyline(latlngs: LatLng[], options?: Polyline options) -// Instantiates a polyline object given an array of geographical points and -// optionally an options object. You can create a `Polyline` object with -// multiple separate lines (`MultiPolyline`) by passing an array of arrays -// of geographic points. -function polyline(latlngs, options) { - return new Polyline(latlngs, options); -} - -// Retrocompat. Allow plugins to support Leaflet versions before and after 1.1. -Polyline._flat = _flat; - -/* - * @class Polygon - * @aka L.Polygon - * @inherits Polyline - * - * A class for drawing polygon overlays on a map. Extends `Polyline`. - * - * Note that points you pass when creating a polygon shouldn't have an additional last point equal to the first one — it's better to filter out such points. - * - * - * @example - * - * ```js - * // create a red polygon from an array of LatLng points - * var latlngs = [[37, -109.05],[41, -109.03],[41, -102.05],[37, -102.04]]; - * - * var polygon = L.polygon(latlngs, {color: 'red'}).addTo(map); - * - * // zoom the map to the polygon - * map.fitBounds(polygon.getBounds()); - * ``` - * - * You can also pass an array of arrays of latlngs, with the first array representing the outer shape and the other arrays representing holes in the outer shape: - * - * ```js - * var latlngs = [ - * [[37, -109.05],[41, -109.03],[41, -102.05],[37, -102.04]], // outer ring - * [[37.29, -108.58],[40.71, -108.58],[40.71, -102.50],[37.29, -102.50]] // hole - * ]; - * ``` - * - * Additionally, you can pass a multi-dimensional array to represent a MultiPolygon shape. - * - * ```js - * var latlngs = [ - * [ // first polygon - * [[37, -109.05],[41, -109.03],[41, -102.05],[37, -102.04]], // outer ring - * [[37.29, -108.58],[40.71, -108.58],[40.71, -102.50],[37.29, -102.50]] // hole - * ], - * [ // second polygon - * [[41, -111.03],[45, -111.04],[45, -104.05],[41, -104.05]] - * ] - * ]; - * ``` - */ - -var Polygon = Polyline.extend({ - - options: { - fill: true - }, - - isEmpty: function () { - return !this._latlngs.length || !this._latlngs[0].length; - }, - - getCenter: function () { - // throws error when not yet added to map as this center calculation requires projected coordinates - if (!this._map) { - throw new Error('Must add layer to map before using getCenter()'); - } - - var i, j, p1, p2, f, area, x, y, center, - points = this._rings[0], - len = points.length; - - if (!len) { return null; } - - // polygon centroid algorithm; only uses the first ring if there are multiple - - area = x = y = 0; - - for (i = 0, j = len - 1; i < len; j = i++) { - p1 = points[i]; - p2 = points[j]; - - f = p1.y * p2.x - p2.y * p1.x; - x += (p1.x + p2.x) * f; - y += (p1.y + p2.y) * f; - area += f * 3; - } - - if (area === 0) { - // Polygon is so small that all points are on same pixel. - center = points[0]; - } else { - center = [x / area, y / area]; - } - return this._map.layerPointToLatLng(center); - }, - - _convertLatLngs: function (latlngs) { - var result = Polyline.prototype._convertLatLngs.call(this, latlngs), - len = result.length; - - // remove last point if it equals first one - if (len >= 2 && result[0] instanceof LatLng && result[0].equals(result[len - 1])) { - result.pop(); - } - return result; - }, - - _setLatLngs: function (latlngs) { - Polyline.prototype._setLatLngs.call(this, latlngs); - if (isFlat(this._latlngs)) { - this._latlngs = [this._latlngs]; - } - }, - - _defaultShape: function () { - return isFlat(this._latlngs[0]) ? this._latlngs[0] : this._latlngs[0][0]; - }, - - _clipPoints: function () { - // polygons need a different clipping algorithm so we redefine that - - var bounds = this._renderer._bounds, - w = this.options.weight, - p = new Point(w, w); - - // increase clip padding by stroke width to avoid stroke on clip edges - bounds = new Bounds(bounds.min.subtract(p), bounds.max.add(p)); - - this._parts = []; - if (!this._pxBounds || !this._pxBounds.intersects(bounds)) { - return; - } - - if (this.options.noClip) { - this._parts = this._rings; - return; - } - - for (var i = 0, len = this._rings.length, clipped; i < len; i++) { - clipped = clipPolygon(this._rings[i], bounds, true); - if (clipped.length) { - this._parts.push(clipped); - } - } - }, - - _updatePath: function () { - this._renderer._updatePoly(this, true); - }, - - // Needed by the `Canvas` renderer for interactivity - _containsPoint: function (p) { - var inside = false, - part, p1, p2, i, j, k, len, len2; - - if (!this._pxBounds || !this._pxBounds.contains(p)) { return false; } - - // ray casting algorithm for detecting if point is in polygon - for (i = 0, len = this._parts.length; i < len; i++) { - part = this._parts[i]; - - for (j = 0, len2 = part.length, k = len2 - 1; j < len2; k = j++) { - p1 = part[j]; - p2 = part[k]; - - if (((p1.y > p.y) !== (p2.y > p.y)) && (p.x < (p2.x - p1.x) * (p.y - p1.y) / (p2.y - p1.y) + p1.x)) { - inside = !inside; - } - } - } - - // also check if it's on polygon stroke - return inside || Polyline.prototype._containsPoint.call(this, p, true); - } - -}); - - -// @factory L.polygon(latlngs: LatLng[], options?: Polyline options) -function polygon(latlngs, options) { - return new Polygon(latlngs, options); -} - -/* - * @class GeoJSON - * @aka L.GeoJSON - * @inherits FeatureGroup - * - * Represents a GeoJSON object or an array of GeoJSON objects. Allows you to parse - * GeoJSON data and display it on the map. Extends `FeatureGroup`. - * - * @example - * - * ```js - * L.geoJSON(data, { - * style: function (feature) { - * return {color: feature.properties.color}; - * } - * }).bindPopup(function (layer) { - * return layer.feature.properties.description; - * }).addTo(map); - * ``` - */ - -var GeoJSON = FeatureGroup.extend({ - - /* @section - * @aka GeoJSON options - * - * @option pointToLayer: Function = * - * A `Function` defining how GeoJSON points spawn Leaflet layers. It is internally - * called when data is added, passing the GeoJSON point feature and its `LatLng`. - * The default is to spawn a default `Marker`: - * ```js - * function(geoJsonPoint, latlng) { - * return L.marker(latlng); - * } - * ``` - * - * @option style: Function = * - * A `Function` defining the `Path options` for styling GeoJSON lines and polygons, - * called internally when data is added. - * The default value is to not override any defaults: - * ```js - * function (geoJsonFeature) { - * return {} - * } - * ``` - * - * @option onEachFeature: Function = * - * A `Function` that will be called once for each created `Feature`, after it has - * been created and styled. Useful for attaching events and popups to features. - * The default is to do nothing with the newly created layers: - * ```js - * function (feature, layer) {} - * ``` - * - * @option filter: Function = * - * A `Function` that will be used to decide whether to include a feature or not. - * The default is to include all features: - * ```js - * function (geoJsonFeature) { - * return true; - * } - * ``` - * Note: dynamically changing the `filter` option will have effect only on newly - * added data. It will _not_ re-evaluate already included features. - * - * @option coordsToLatLng: Function = * - * A `Function` that will be used for converting GeoJSON coordinates to `LatLng`s. - * The default is the `coordsToLatLng` static method. - */ - - initialize: function (geojson, options) { - setOptions(this, options); - - this._layers = {}; - - if (geojson) { - this.addData(geojson); - } - }, - - // @method addData( data ): this - // Adds a GeoJSON object to the layer. - addData: function (geojson) { - var features = isArray(geojson) ? geojson : geojson.features, - i, len, feature; - - if (features) { - for (i = 0, len = features.length; i < len; i++) { - // only add this if geometry or geometries are set and not null - feature = features[i]; - if (feature.geometries || feature.geometry || feature.features || feature.coordinates) { - this.addData(feature); - } - } - return this; - } - - var options = this.options; - - if (options.filter && !options.filter(geojson)) { return this; } - - var layer = geometryToLayer(geojson, options); - if (!layer) { - return this; - } - layer.feature = asFeature(geojson); - - layer.defaultOptions = layer.options; - this.resetStyle(layer); - - if (options.onEachFeature) { - options.onEachFeature(geojson, layer); - } - - return this.addLayer(layer); - }, - - // @method resetStyle( layer ): this - // Resets the given vector layer's style to the original GeoJSON style, useful for resetting style after hover events. - resetStyle: function (layer) { - // reset any custom styles - layer.options = extend({}, layer.defaultOptions); - this._setLayerStyle(layer, this.options.style); - return this; - }, - - // @method setStyle( style ): this - // Changes styles of GeoJSON vector layers with the given style function. - setStyle: function (style) { - return this.eachLayer(function (layer) { - this._setLayerStyle(layer, style); - }, this); - }, - - _setLayerStyle: function (layer, style) { - if (typeof style === 'function') { - style = style(layer.feature); - } - if (layer.setStyle) { - layer.setStyle(style); - } - } -}); - -// @section -// There are several static functions which can be called without instantiating L.GeoJSON: - -// @function geometryToLayer(featureData: Object, options?: GeoJSON options): Layer -// Creates a `Layer` from a given GeoJSON feature. Can use a custom -// [`pointToLayer`](#geojson-pointtolayer) and/or [`coordsToLatLng`](#geojson-coordstolatlng) -// functions if provided as options. -function geometryToLayer(geojson, options) { - - var geometry = geojson.type === 'Feature' ? geojson.geometry : geojson, - coords = geometry ? geometry.coordinates : null, - layers = [], - pointToLayer = options && options.pointToLayer, - _coordsToLatLng = options && options.coordsToLatLng || coordsToLatLng, - latlng, latlngs, i, len; - - if (!coords && !geometry) { - return null; - } - - switch (geometry.type) { - case 'Point': - latlng = _coordsToLatLng(coords); - return pointToLayer ? pointToLayer(geojson, latlng) : new Marker(latlng); - - case 'MultiPoint': - for (i = 0, len = coords.length; i < len; i++) { - latlng = _coordsToLatLng(coords[i]); - layers.push(pointToLayer ? pointToLayer(geojson, latlng) : new Marker(latlng)); - } - return new FeatureGroup(layers); - - case 'LineString': - case 'MultiLineString': - latlngs = coordsToLatLngs(coords, geometry.type === 'LineString' ? 0 : 1, _coordsToLatLng); - return new Polyline(latlngs, options); - - case 'Polygon': - case 'MultiPolygon': - latlngs = coordsToLatLngs(coords, geometry.type === 'Polygon' ? 1 : 2, _coordsToLatLng); - return new Polygon(latlngs, options); - - case 'GeometryCollection': - for (i = 0, len = geometry.geometries.length; i < len; i++) { - var layer = geometryToLayer({ - geometry: geometry.geometries[i], - type: 'Feature', - properties: geojson.properties - }, options); - - if (layer) { - layers.push(layer); - } - } - return new FeatureGroup(layers); - - default: - throw new Error('Invalid GeoJSON object.'); - } -} - -// @function coordsToLatLng(coords: Array): LatLng -// Creates a `LatLng` object from an array of 2 numbers (longitude, latitude) -// or 3 numbers (longitude, latitude, altitude) used in GeoJSON for points. -function coordsToLatLng(coords) { - return new LatLng(coords[1], coords[0], coords[2]); -} - -// @function coordsToLatLngs(coords: Array, levelsDeep?: Number, coordsToLatLng?: Function): Array -// Creates a multidimensional array of `LatLng`s from a GeoJSON coordinates array. -// `levelsDeep` specifies the nesting level (0 is for an array of points, 1 for an array of arrays of points, etc., 0 by default). -// Can use a custom [`coordsToLatLng`](#geojson-coordstolatlng) function. -function coordsToLatLngs(coords, levelsDeep, _coordsToLatLng) { - var latlngs = []; - - for (var i = 0, len = coords.length, latlng; i < len; i++) { - latlng = levelsDeep ? - coordsToLatLngs(coords[i], levelsDeep - 1, _coordsToLatLng) : - (_coordsToLatLng || coordsToLatLng)(coords[i]); - - latlngs.push(latlng); - } - - return latlngs; -} - -// @function latLngToCoords(latlng: LatLng, precision?: Number): Array -// Reverse of [`coordsToLatLng`](#geojson-coordstolatlng) -function latLngToCoords(latlng, precision) { - precision = typeof precision === 'number' ? precision : 6; - return latlng.alt !== undefined ? - [formatNum(latlng.lng, precision), formatNum(latlng.lat, precision), formatNum(latlng.alt, precision)] : - [formatNum(latlng.lng, precision), formatNum(latlng.lat, precision)]; -} - -// @function latLngsToCoords(latlngs: Array, levelsDeep?: Number, closed?: Boolean): Array -// Reverse of [`coordsToLatLngs`](#geojson-coordstolatlngs) -// `closed` determines whether the first point should be appended to the end of the array to close the feature, only used when `levelsDeep` is 0. False by default. -function latLngsToCoords(latlngs, levelsDeep, closed, precision) { - var coords = []; - - for (var i = 0, len = latlngs.length; i < len; i++) { - coords.push(levelsDeep ? - latLngsToCoords(latlngs[i], levelsDeep - 1, closed, precision) : - latLngToCoords(latlngs[i], precision)); - } - - if (!levelsDeep && closed) { - coords.push(coords[0]); - } - - return coords; -} - -function getFeature(layer, newGeometry) { - return layer.feature ? - extend({}, layer.feature, {geometry: newGeometry}) : - asFeature(newGeometry); -} - -// @function asFeature(geojson: Object): Object -// Normalize GeoJSON geometries/features into GeoJSON features. -function asFeature(geojson) { - if (geojson.type === 'Feature' || geojson.type === 'FeatureCollection') { - return geojson; - } - - return { - type: 'Feature', - properties: {}, - geometry: geojson - }; -} - -var PointToGeoJSON = { - toGeoJSON: function (precision) { - return getFeature(this, { - type: 'Point', - coordinates: latLngToCoords(this.getLatLng(), precision) - }); - } -}; - -// @namespace Marker -// @method toGeoJSON(): Object -// Returns a [`GeoJSON`](http://en.wikipedia.org/wiki/GeoJSON) representation of the marker (as a GeoJSON `Point` Feature). -Marker.include(PointToGeoJSON); - -// @namespace CircleMarker -// @method toGeoJSON(): Object -// Returns a [`GeoJSON`](http://en.wikipedia.org/wiki/GeoJSON) representation of the circle marker (as a GeoJSON `Point` Feature). -Circle.include(PointToGeoJSON); -CircleMarker.include(PointToGeoJSON); - - -// @namespace Polyline -// @method toGeoJSON(): Object -// Returns a [`GeoJSON`](http://en.wikipedia.org/wiki/GeoJSON) representation of the polyline (as a GeoJSON `LineString` or `MultiLineString` Feature). -Polyline.include({ - toGeoJSON: function (precision) { - var multi = !isFlat(this._latlngs); - - var coords = latLngsToCoords(this._latlngs, multi ? 1 : 0, false, precision); - - return getFeature(this, { - type: (multi ? 'Multi' : '') + 'LineString', - coordinates: coords - }); - } -}); - -// @namespace Polygon -// @method toGeoJSON(): Object -// Returns a [`GeoJSON`](http://en.wikipedia.org/wiki/GeoJSON) representation of the polygon (as a GeoJSON `Polygon` or `MultiPolygon` Feature). -Polygon.include({ - toGeoJSON: function (precision) { - var holes = !isFlat(this._latlngs), - multi = holes && !isFlat(this._latlngs[0]); - - var coords = latLngsToCoords(this._latlngs, multi ? 2 : holes ? 1 : 0, true, precision); - - if (!holes) { - coords = [coords]; - } - - return getFeature(this, { - type: (multi ? 'Multi' : '') + 'Polygon', - coordinates: coords - }); - } -}); - - -// @namespace LayerGroup -LayerGroup.include({ - toMultiPoint: function (precision) { - var coords = []; - - this.eachLayer(function (layer) { - coords.push(layer.toGeoJSON(precision).geometry.coordinates); - }); - - return getFeature(this, { - type: 'MultiPoint', - coordinates: coords - }); - }, - - // @method toGeoJSON(): Object - // Returns a [`GeoJSON`](http://en.wikipedia.org/wiki/GeoJSON) representation of the layer group (as a GeoJSON `FeatureCollection`, `GeometryCollection`, or `MultiPoint`). - toGeoJSON: function (precision) { - - var type = this.feature && this.feature.geometry && this.feature.geometry.type; - - if (type === 'MultiPoint') { - return this.toMultiPoint(precision); - } - - var isGeometryCollection = type === 'GeometryCollection', - jsons = []; - - this.eachLayer(function (layer) { - if (layer.toGeoJSON) { - var json = layer.toGeoJSON(precision); - if (isGeometryCollection) { - jsons.push(json.geometry); - } else { - var feature = asFeature(json); - // Squash nested feature collections - if (feature.type === 'FeatureCollection') { - jsons.push.apply(jsons, feature.features); - } else { - jsons.push(feature); - } - } - } - }); - - if (isGeometryCollection) { - return getFeature(this, { - geometries: jsons, - type: 'GeometryCollection' - }); - } - - return { - type: 'FeatureCollection', - features: jsons - }; - } -}); - -// @namespace GeoJSON -// @factory L.geoJSON(geojson?: Object, options?: GeoJSON options) -// Creates a GeoJSON layer. Optionally accepts an object in -// [GeoJSON format](https://tools.ietf.org/html/rfc7946) to display on the map -// (you can alternatively add it later with `addData` method) and an `options` object. -function geoJSON(geojson, options) { - return new GeoJSON(geojson, options); -} - -// Backward compatibility. -var geoJson = geoJSON; - -/* - * @class ImageOverlay - * @aka L.ImageOverlay - * @inherits Interactive layer - * - * Used to load and display a single image over specific bounds of the map. Extends `Layer`. - * - * @example - * - * ```js - * var imageUrl = 'http://www.lib.utexas.edu/maps/historical/newark_nj_1922.jpg', - * imageBounds = [[40.712216, -74.22655], [40.773941, -74.12544]]; - * L.imageOverlay(imageUrl, imageBounds).addTo(map); - * ``` - */ - -var ImageOverlay = Layer.extend({ - - // @section - // @aka ImageOverlay options - options: { - // @option opacity: Number = 1.0 - // The opacity of the image overlay. - opacity: 1, - - // @option alt: String = '' - // Text for the `alt` attribute of the image (useful for accessibility). - alt: '', - - // @option interactive: Boolean = false - // If `true`, the image overlay will emit [mouse events](#interactive-layer) when clicked or hovered. - interactive: false, - - // @option crossOrigin: Boolean|String = false - // Whether the crossOrigin attribute will be added to the image. - // If a String is provided, the image will have its crossOrigin attribute set to the String provided. This is needed if you want to access image pixel data. - // Refer to [CORS Settings](https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes) for valid String values. - crossOrigin: false, - - // @option errorOverlayUrl: String = '' - // URL to the overlay image to show in place of the overlay that failed to load. - errorOverlayUrl: '', - - // @option zIndex: Number = 1 - // The explicit [zIndex](https://developer.mozilla.org/docs/Web/CSS/CSS_Positioning/Understanding_z_index) of the overlay layer. - zIndex: 1, - - // @option className: String = '' - // A custom class name to assign to the image. Empty by default. - className: '' - }, - - initialize: function (url, bounds, options) { // (String, LatLngBounds, Object) - this._url = url; - this._bounds = toLatLngBounds(bounds); - - setOptions(this, options); - }, - - onAdd: function () { - if (!this._image) { - this._initImage(); - - if (this.options.opacity < 1) { - this._updateOpacity(); - } - } - - if (this.options.interactive) { - addClass(this._image, 'leaflet-interactive'); - this.addInteractiveTarget(this._image); - } - - this.getPane().appendChild(this._image); - this._reset(); - }, - - onRemove: function () { - remove(this._image); - if (this.options.interactive) { - this.removeInteractiveTarget(this._image); - } - }, - - // @method setOpacity(opacity: Number): this - // Sets the opacity of the overlay. - setOpacity: function (opacity) { - this.options.opacity = opacity; - - if (this._image) { - this._updateOpacity(); - } - return this; - }, - - setStyle: function (styleOpts) { - if (styleOpts.opacity) { - this.setOpacity(styleOpts.opacity); - } - return this; - }, - - // @method bringToFront(): this - // Brings the layer to the top of all overlays. - bringToFront: function () { - if (this._map) { - toFront(this._image); - } - return this; - }, - - // @method bringToBack(): this - // Brings the layer to the bottom of all overlays. - bringToBack: function () { - if (this._map) { - toBack(this._image); - } - return this; - }, - - // @method setUrl(url: String): this - // Changes the URL of the image. - setUrl: function (url) { - this._url = url; - - if (this._image) { - this._image.src = url; - } - return this; - }, - - // @method setBounds(bounds: LatLngBounds): this - // Update the bounds that this ImageOverlay covers - setBounds: function (bounds) { - this._bounds = toLatLngBounds(bounds); - - if (this._map) { - this._reset(); - } - return this; - }, - - getEvents: function () { - var events = { - zoom: this._reset, - viewreset: this._reset - }; - - if (this._zoomAnimated) { - events.zoomanim = this._animateZoom; - } - - return events; - }, - - // @method setZIndex(value: Number): this - // Changes the [zIndex](#imageoverlay-zindex) of the image overlay. - setZIndex: function (value) { - this.options.zIndex = value; - this._updateZIndex(); - return this; - }, - - // @method getBounds(): LatLngBounds - // Get the bounds that this ImageOverlay covers - getBounds: function () { - return this._bounds; - }, - - // @method getElement(): HTMLElement - // Returns the instance of [`HTMLImageElement`](https://developer.mozilla.org/docs/Web/API/HTMLImageElement) - // used by this overlay. - getElement: function () { - return this._image; - }, - - _initImage: function () { - var wasElementSupplied = this._url.tagName === 'IMG'; - var img = this._image = wasElementSupplied ? this._url : create$1('img'); - - addClass(img, 'leaflet-image-layer'); - if (this._zoomAnimated) { addClass(img, 'leaflet-zoom-animated'); } - if (this.options.className) { addClass(img, this.options.className); } - - img.onselectstart = falseFn; - img.onmousemove = falseFn; - - // @event load: Event - // Fired when the ImageOverlay layer has loaded its image - img.onload = bind(this.fire, this, 'load'); - img.onerror = bind(this._overlayOnError, this, 'error'); - - if (this.options.crossOrigin || this.options.crossOrigin === '') { - img.crossOrigin = this.options.crossOrigin === true ? '' : this.options.crossOrigin; - } - - if (this.options.zIndex) { - this._updateZIndex(); - } - - if (wasElementSupplied) { - this._url = img.src; - return; - } - - img.src = this._url; - img.alt = this.options.alt; - }, - - _animateZoom: function (e) { - var scale = this._map.getZoomScale(e.zoom), - offset = this._map._latLngBoundsToNewLayerBounds(this._bounds, e.zoom, e.center).min; - - setTransform(this._image, offset, scale); - }, - - _reset: function () { - var image = this._image, - bounds = new Bounds( - this._map.latLngToLayerPoint(this._bounds.getNorthWest()), - this._map.latLngToLayerPoint(this._bounds.getSouthEast())), - size = bounds.getSize(); - - setPosition(image, bounds.min); - - image.style.width = size.x + 'px'; - image.style.height = size.y + 'px'; - }, - - _updateOpacity: function () { - setOpacity(this._image, this.options.opacity); - }, - - _updateZIndex: function () { - if (this._image && this.options.zIndex !== undefined && this.options.zIndex !== null) { - this._image.style.zIndex = this.options.zIndex; - } - }, - - _overlayOnError: function () { - // @event error: Event - // Fired when the ImageOverlay layer fails to load its image - this.fire('error'); - - var errorUrl = this.options.errorOverlayUrl; - if (errorUrl && this._url !== errorUrl) { - this._url = errorUrl; - this._image.src = errorUrl; - } - } -}); - -// @factory L.imageOverlay(imageUrl: String, bounds: LatLngBounds, options?: ImageOverlay options) -// Instantiates an image overlay object given the URL of the image and the -// geographical bounds it is tied to. -var imageOverlay = function (url, bounds, options) { - return new ImageOverlay(url, bounds, options); -}; - -/* - * @class VideoOverlay - * @aka L.VideoOverlay - * @inherits ImageOverlay - * - * Used to load and display a video player over specific bounds of the map. Extends `ImageOverlay`. - * - * A video overlay uses the [`