Commit 94abcb70 authored by Helen Oleynikova's avatar Helen Oleynikova

Merge branch 'master' of git://github.com/mavlink/qgroundcontrol

parents 4b34688a 4992f93d
...@@ -21,7 +21,6 @@ tmp ...@@ -21,7 +21,6 @@ tmp
debug debug
release release
/qgroundcontrol /qgroundcontrol
mavlinkgen-build-desktop
qgroundcontrol.xcodeproj/** qgroundcontrol.xcodeproj/**
doc/html doc/html
doc/doxy.log doc/doxy.log
......
...@@ -123,34 +123,6 @@ INCLUDEPATH += $$MAVLINKPATH ...@@ -123,34 +123,6 @@ INCLUDEPATH += $$MAVLINKPATH
INCLUDEPATH += $$MAVLINKPATH/common INCLUDEPATH += $$MAVLINKPATH/common
} }
#
# [DEPRECATED] MAVLink generator UI. Provides a GUI interface for generating MAVLink dialects.
# Replaced by mavgenerator.py within the MAVLink project.
#
contains(DEFINES, ENABLE_MAVGEN) {
warning("Including support for MAVLink generator GUI (manual override from command line, CAUTION: deprecated)")
} else:infile(user_config.pri, DEFINES, ENABLE_MAVGEN) {
DEFINES += ENABLE_MAVGEN # infile doesn't automatically include everything in the specified file
warning("Including support for MAVLink generator GUI (manual override from user_config.pri, CAUTION: deprecated)")
}
contains(DEFINES, ENABLE_MAVGEN) {
# Rename the macro to be consistent with other QGC feature existance macros.
DEFINES -= ENABLE_MAVGEN
DEFINES += QGC_MAVGEN_ENABLED
DEPENDPATH += \
src/apps/mavlinkgen
INCLUDEPATH += \
src/apps/mavlinkgen \
src/apps/mavlinkgen/ui \
src/apps/mavlinkgen/generator
include(src/apps/mavlinkgen/mavlinkgen.pri)
} else {
message("Skipping support for MAVLink generator GUI (deprecated, see README)")
}
# #
# [OPTIONAL] OpenSceneGraph # [OPTIONAL] OpenSceneGraph
# Allow the user to override OpenSceneGraph compilation through a DISABLE_OPEN_SCENE_GRAPH # Allow the user to override OpenSceneGraph compilation through a DISABLE_OPEN_SCENE_GRAPH
...@@ -348,7 +320,9 @@ INCLUDEPATH += \ ...@@ -348,7 +320,9 @@ INCLUDEPATH += \
# #
# [REQUIRED] QWT plotting library dependency. Provides plotting capabilities. # [REQUIRED] QWT plotting library dependency. Provides plotting capabilities.
# #
include(libs/qwt/qwt.pri) include(libs/qwt.pri)
DEPENDPATH += libs/qwt
INCLUDEPATH += libs/qwt
# #
# [REQUIRED] QSerialPort library. Provides serial port wrapper library. # [REQUIRED] QSerialPort library. Provides serial port wrapper library.
...@@ -416,9 +390,10 @@ contains(DEFINES, DISABLE_3DMOUSE) { ...@@ -416,9 +390,10 @@ contains(DEFINES, DISABLE_3DMOUSE) {
exists(/usr/local/lib/libxdrvlib.so) { exists(/usr/local/lib/libxdrvlib.so) {
message("Including support for 3DConnexion mice") message("Including support for 3DConnexion mice")
DEFINES += DEFINES += \
QGC_MOUSE_ENABLED_LINUX \ QGC_MOUSE_ENABLED_LINUX \
ParameterCheck # Hack: Has to be defined for magellan usage ParameterCheck
# Hack: Has to be defined for magellan usage
HEADERS += src/input/Mouse6dofInput.h HEADERS += src/input/Mouse6dofInput.h
SOURCES += src/input/Mouse6dofInput.cpp SOURCES += src/input/Mouse6dofInput.cpp
......
# QGroundControl # QGroundControl
## Open Source Micro Air Vehicle Ground Control Station ## Open Source Micro Air Vehicle Ground Control Station
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
For generating documentation, refer to /doc/README. For generating documentation, refer to /doc/README.
## Notes ## Notes
Please make sure to delete your build folder before re-building. Independent of which Please make sure to delete your build folder before re-building. Independent of which
build system you use (this is not related to Qt or your OS) the dependency checking and build system you use (this is not related to Qt or your OS) the dependency checking and
cleaning is based on the current project revision. So if you change the project and don't remove the build folder before your next build, incremental building can leave you with stale object files. cleaning is based on the current project revision. So if you change the project and don't remove the build folder before your next build, incremental building can leave you with stale object files.
## Additional functionality ## Additional functionality
...@@ -37,9 +37,6 @@ The QUpgrade module relies on `libudev` on Linux platforms, so be sure to instal ...@@ -37,9 +37,6 @@ The QUpgrade module relies on `libudev` on Linux platforms, so be sure to instal
### Specifying MAVLink dialects ### Specifying MAVLink dialects
The MAVLink dialect compiled by default by QGC is for the ardupilotmega. This will happen if no other dialects are specified. Setting the `MAVLINK_CONF` variable sets the dialects, with more than one specified in a space-separated list. Note that doing this may result in compilation errors as certain dialects may conflict with each other! The MAVLink dialect compiled by default by QGC is for the ardupilotmega. This will happen if no other dialects are specified. Setting the `MAVLINK_CONF` variable sets the dialects, with more than one specified in a space-separated list. Note that doing this may result in compilation errors as certain dialects may conflict with each other!
### MAVLink dialect generator
An add-on is available for QGC that provides a UI for generating MAVLink dialects from within QGC. This feature has been deprecated since identical functionality now exists within the MAVLink project itself. Enable this functionality by specifying the `DEFINES` variable `ENABLE_MAVGEN`.
### Opal-RT's RT-LAB simulator ### Opal-RT's RT-LAB simulator
Integration with Opal-RT's RT-LAB simulator can be enabled on Windows by installing RT-LAB 7.2.4. This allows vehicles to be simulated in RT-LAB and communicate directly with QGC on the same computer as if the UAS was actually deployed. This support is enabled by default once the requisite RT-LAB software is installed. Disabling this can be done by adding `DISABLE_RTLAB` to the `DEFINES` variable. Integration with Opal-RT's RT-LAB simulator can be enabled on Windows by installing RT-LAB 7.2.4. This allows vehicles to be simulated in RT-LAB and communicate directly with QGC on the same computer as if the UAS was actually deployed. This support is enabled by default once the requisite RT-LAB software is installed. Disabling this can be done by adding `DISABLE_RTLAB` to the `DEFINES` variable.
...@@ -83,14 +80,15 @@ To build on Mac OSX (10.6 or later): ...@@ -83,14 +80,15 @@ To build on Mac OSX (10.6 or later):
3. Run `make -j4` 3. Run `make -j4`
# Build on Linux # Build on Linux
To build on Linux: To build on Linux:
- - - - - -
1. Install base dependencies (QT + phonon/webkit, SDL) 1. Install base dependencies (QT + phonon/webkit, SDL)
* For Ubuntu: `sudo apt-get install libqt4-dev libphonon-dev libphonon4 phonon-backend-gstreamer qtcreator libsdl1.2-dev build-essential libudev-dev` * For Ubuntu: `sudo apt-get install libqt4-dev libphonon-dev libphonon4 phonon-backend-gstreamer qtcreator libsdl1.2-dev build-essential libudev-dev`
* For Fedora: `sudo yum install qt qt-creator qt-webkit-devel SDL-devel SDL-static systemd-devel` * For Fedora: `sudo yum install qt qt-creator qt-webkit-devel phonon-devel SDL-devel SDL-static systemd-devel`
* For Arch Linux: `pacman -Sy qtwebkit phonon-qt4`
2. **[OPTIONAL]** Install additional libraries 2. **[OPTIONAL]** Install additional libraries
* For text-to-speech (espeak) * For text-to-speech (espeak)
......
...@@ -91,7 +91,7 @@ ...@@ -91,7 +91,7 @@
<damping_coeff_rebound unit="LBS/FT/SEC"> 4.0 </damping_coeff_rebound> <damping_coeff_rebound unit="LBS/FT/SEC"> 4.0 </damping_coeff_rebound>
<max_steer unit="DEG">0</max_steer> <max_steer unit="DEG">0</max_steer>
<brake_group>NONE</brake_group> <brake_group>NONE</brake_group>
<retractable>FIXED</retractable> <retractable>0</retractable>
</contact> </contact>
<contact type="BOGEY" name="NOSE"> <contact type="BOGEY" name="NOSE">
<location unit="M"> <location unit="M">
...@@ -107,7 +107,7 @@ ...@@ -107,7 +107,7 @@
<damping_coeff_rebound unit="LBS/FT/SEC"> 4.0 </damping_coeff_rebound> <damping_coeff_rebound unit="LBS/FT/SEC"> 4.0 </damping_coeff_rebound>
<max_steer unit="DEG">0</max_steer> <max_steer unit="DEG">0</max_steer>
<brake_group>NONE</brake_group> <brake_group>NONE</brake_group>
<retractable>FIXED</retractable> <retractable>0</retractable>
</contact> </contact>
<contact type="STRUCTURE" name="TAIL"> <contact type="STRUCTURE" name="TAIL">
......
...@@ -103,11 +103,11 @@ ...@@ -103,11 +103,11 @@
</ground_reactions> </ground_reactions>
<!-- the front and rear motors spin clockwise, and the left and right motors spin counter-clockwise. --> <!-- the front and rear motors spin clockwise, and the left and right motors spin counter-clockwise. -->
<propulsion> <propulsion>
<engine file="a2830-12" name="front"> <engine file="a2830-12" name="right">
<location unit="M"> <location unit="M">
<x> -0.283 </x> <x> 0.000 </x>
<y> 0.00 </y> <y> 0.283 </y>
<z> 0.00 </z> <z> 0.000 </z>
</location> </location>
<orient unit="DEG"> <orient unit="DEG">
<pitch> 90.00 </pitch> <pitch> 90.00 </pitch>
...@@ -117,8 +117,8 @@ ...@@ -117,8 +117,8 @@
<feed>0</feed> <feed>0</feed>
<thruster file="prop10x4.5"> <thruster file="prop10x4.5">
<location unit="M"> <location unit="M">
<x> -0.283 </x> <x> 0.000 </x>
<y> 0.00 </y> <y> 0.283 </y>
<z> 0.125 </z> <z> 0.125 </z>
</location> </location>
<orient unit="DEG"> <orient unit="DEG">
...@@ -130,11 +130,12 @@ ...@@ -130,11 +130,12 @@
<p_factor> 10 </p_factor> <p_factor> 10 </p_factor>
</thruster> </thruster>
</engine> </engine>
<engine file="a2830-12" name="rear">
<engine file="a2830-12" name="left">
<location unit="M"> <location unit="M">
<x> 0.283 </x> <x> 0.00 </x>
<y> 0.000 </y> <y> -0.283 </y>
<z> 0.000 </z> <z> 0.00 </z>
</location> </location>
<orient unit="DEG"> <orient unit="DEG">
<pitch> 90.00 </pitch> <pitch> 90.00 </pitch>
...@@ -144,8 +145,8 @@ ...@@ -144,8 +145,8 @@
<feed>0</feed> <feed>0</feed>
<thruster file="prop10x4.5"> <thruster file="prop10x4.5">
<location unit="M"> <location unit="M">
<x> 0.283 </x> <x> 0.00 </x>
<y> 0.000 </y> <y> -0.283 </y>
<z> 0.125 </z> <z> 0.125 </z>
</location> </location>
<orient unit="DEG"> <orient unit="DEG">
...@@ -157,11 +158,12 @@ ...@@ -157,11 +158,12 @@
<p_factor> 10 </p_factor> <p_factor> 10 </p_factor>
</thruster> </thruster>
</engine> </engine>
<engine file="a2830-12" name="left">
<engine file="a2830-12" name="front">
<location unit="M"> <location unit="M">
<x> 0.00 </x> <x> -0.283 </x>
<y> 0.283 </y> <y> 0.00 </y>
<z> 0.00 </z> <z> 0.00 </z>
</location> </location>
<orient unit="DEG"> <orient unit="DEG">
<pitch> 90.00 </pitch> <pitch> 90.00 </pitch>
...@@ -171,8 +173,8 @@ ...@@ -171,8 +173,8 @@
<feed>0</feed> <feed>0</feed>
<thruster file="prop10x4.5"> <thruster file="prop10x4.5">
<location unit="M"> <location unit="M">
<x> 0.00 </x> <x> -0.283 </x>
<y> 0.283 </y> <y> 0.00 </y>
<z> 0.125 </z> <z> 0.125 </z>
</location> </location>
<orient unit="DEG"> <orient unit="DEG">
...@@ -184,10 +186,11 @@ ...@@ -184,10 +186,11 @@
<p_factor> 10 </p_factor> <p_factor> 10 </p_factor>
</thruster> </thruster>
</engine> </engine>
<engine file="a2830-12" name="right">
<engine file="a2830-12" name="rear">
<location unit="M"> <location unit="M">
<x> 0.000 </x> <x> 0.283 </x>
<y> -0.283 </y> <y> 0.000 </y>
<z> 0.000 </z> <z> 0.000 </z>
</location> </location>
<orient unit="DEG"> <orient unit="DEG">
...@@ -198,8 +201,8 @@ ...@@ -198,8 +201,8 @@
<feed>0</feed> <feed>0</feed>
<thruster file="prop10x4.5"> <thruster file="prop10x4.5">
<location unit="M"> <location unit="M">
<x> 0.000 </x> <x> 0.283 </x>
<y> -0.283 </y> <y> 0.000 </y>
<z> 0.125 </z> <z> 0.125 </z>
</location> </location>
<orient unit="DEG"> <orient unit="DEG">
...@@ -211,6 +214,7 @@ ...@@ -211,6 +214,7 @@
<p_factor> 10 </p_factor> <p_factor> 10 </p_factor>
</thruster> </thruster>
</engine> </engine>
<tank type="FUEL" number="0"> <tank type="FUEL" number="0">
<location unit="M"> <location unit="M">
<x> 0.00 </x> <x> 0.00 </x>
...@@ -222,6 +226,7 @@ ...@@ -222,6 +226,7 @@
<contents unit="KG"> 0.0 </contents> <contents unit="KG"> 0.0 </contents>
</tank> </tank>
</propulsion> </propulsion>
<aerodynamics> <aerodynamics>
<axis name="LIFT"> <axis name="LIFT">
</axis> </axis>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<output> <output>
<line_separator>newline</line_separator> <line_separator>newline</line_separator>
<var_separator>tab</var_separator> <var_separator>tab</var_separator>
<chunk> <chunk>
<name>time (sec)</name> <name>time (sec)</name>
<type>float</type> <type>float</type>
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
<node>/orientation/roll-deg</node> <node>/orientation/roll-deg</node>
<factor>0.01745329251994329576</factor> <!-- degrees to radians --> <factor>0.01745329251994329576</factor> <!-- degrees to radians -->
</chunk> </chunk>
<chunk> <chunk>
<name>pitch angle (rad)</name> <name>pitch angle (rad)</name>
<type>float</type> <type>float</type>
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
<node>/orientation/pitch-deg</node> <node>/orientation/pitch-deg</node>
<factor>0.01745329251994329576</factor> <!-- degrees to radians --> <factor>0.01745329251994329576</factor> <!-- degrees to radians -->
</chunk> </chunk>
<chunk> <chunk>
<name>yaw angle</name> <name>yaw angle</name>
<type>float</type> <type>float</type>
...@@ -109,7 +109,7 @@ ...@@ -109,7 +109,7 @@
</chunk> </chunk>
<!-- Velocities --> <!-- Velocities -->
<chunk> <chunk>
<name>Velocity North ("vn" mps)</name> <name>Velocity North ("vn" mps)</name>
<type>float</type> <type>float</type>
...@@ -141,7 +141,42 @@ ...@@ -141,7 +141,42 @@
<node>/velocities/airspeed-kt</node> <node>/velocities/airspeed-kt</node>
<factor>0.514444444444444</factor> <!-- knots to mps --> <factor>0.514444444444444</factor> <!-- knots to mps -->
</chunk> </chunk>
<!-- Magnetometer -->
<chunk>
<name>Magnetic Variation (rad)</name>
<type>float</type>
<format>%.8f</format>
<node>/environment/magnetic-variation-deg</node>
<factor>0.01745329251994329576</factor> <!-- degrees to radians -->
</chunk>
<chunk>
<name>Magnetic Dip (rad)</name>
<type>float</type>
<format>%.8f</format>
<node>/environment/magnetic-dip-deg</node>
<factor>0.01745329251994329576</factor> <!-- degrees to radians -->
</chunk>
<!-- Temperature -->
<chunk>
<name>Temperature (deg C)</name>
<type>float</type>
<format>%.8f</format>
<node>/environment/temperature-degc</node>
<factor>1</factor>
</chunk>
<!-- Pressure -->
<chunk>
<name>Pressure (hPa)</name>
<type>float</type>
<format>%.8f</format>
<node>/environment/pressure-inhg</node>
<factor>33.86389</factor> <!-- inhg to hpa -->
</chunk>
</output> </output>
<input> <input>
...@@ -152,28 +187,33 @@ ...@@ -152,28 +187,33 @@
<!-- motors, in range 0.0 to 1.0 --> <!-- motors, in range 0.0 to 1.0 -->
<chunk> <chunk>
<name>throttle0</name> <name>throttle0</name>
<type>double</type> <type>float</type>
<node>/controls/engines/engine[0]/throttle</node> <node>/controls/engines/engine[0]/throttle</node>
</chunk> </chunk>
<chunk> <chunk>
<name>throttle1</name> <name>throttle1</name>
<type>double</type> <type>float</type>
<node>/controls/engines/engine[1]/throttle</node> <node>/controls/engines/engine[1]/throttle</node>
</chunk> </chunk>
<chunk> <chunk>
<name>throttle2</name> <name>throttle2</name>
<type>double</type> <type>float</type>
<node>/controls/engines/engine[2]/throttle</node> <node>/controls/engines/engine[2]/throttle</node>
</chunk> </chunk>
<chunk>
<name>running</name>
<type>bool</type>
<node>/engines/engine/running</node>
</chunk>
<chunk> <chunk>
<name>throttle3</name> <name>throttle3</name>
<type>double</type> <type>float</type>
<node>/controls/engines/engine[3]/throttle</node> <node>/controls/engines/engine[3]/throttle</node>
</chunk> </chunk>
</input> </input>
</generic> </generic>
</PropertyList> </PropertyList>
\ No newline at end of file
This folder contains the various required libraries for QGC to compile. They are distributed with the codebase to ease development.
# Qwt
Qt Widgets for Technical Applications
Version: 6.1
Source obtained: `svn checkout svn://svn.code.sf.net/p/qwt/code/branches/qwt-6.1 qwt`
Contents of `/libs/qwt` is the contents of the `/src` directory from the Qwt repository.
qwt.pri file is custom made to compile all necessary Qwt code in with QGC.
...@@ -73,7 +73,7 @@ static inline uint16_t crc_calculate(const uint8_t* pBuffer, uint16_t length) ...@@ -73,7 +73,7 @@ static inline uint16_t crc_calculate(const uint8_t* pBuffer, uint16_t length)
* @param data new bytes to hash * @param data new bytes to hash
* @param crcAccum the already accumulated checksum * @param crcAccum the already accumulated checksum
**/ **/
static inline void crc_accumulate_buffer(uint16_t *crcAccum, const char *pBuffer, uint8_t length) static inline void crc_accumulate_buffer(uint16_t *crcAccum, const char *pBuffer, uint16_t length)
{ {
const uint8_t *p = (const uint8_t *)pBuffer; const uint8_t *p = (const uint8_t *)pBuffer;
while (length--) { while (length--) {
......
...@@ -5,6 +5,10 @@ ...@@ -5,6 +5,10 @@
#ifndef COMMON_H #ifndef COMMON_H
#define COMMON_H #define COMMON_H
#ifndef MAVLINK_H
#error Wrong include order: common.h MUST NOT BE DIRECTLY USED. Include mavlink.h from the same directory instead or set all defines from mavlink.h manually.
#endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
......
...@@ -73,7 +73,6 @@ MAVLINK_HELPER uint16_t mavlink_finalize_message_chan(mavlink_message_t* msg, ui ...@@ -73,7 +73,6 @@ MAVLINK_HELPER uint16_t mavlink_finalize_message_chan(mavlink_message_t* msg, ui
#endif #endif
{ {
// This code part is the same for all messages; // This code part is the same for all messages;
uint16_t checksum;
msg->magic = MAVLINK_STX; msg->magic = MAVLINK_STX;
msg->len = length; msg->len = length;
msg->sysid = system_id; msg->sysid = system_id;
...@@ -81,12 +80,13 @@ MAVLINK_HELPER uint16_t mavlink_finalize_message_chan(mavlink_message_t* msg, ui ...@@ -81,12 +80,13 @@ MAVLINK_HELPER uint16_t mavlink_finalize_message_chan(mavlink_message_t* msg, ui
// One sequence number per component // One sequence number per component
msg->seq = mavlink_get_channel_status(chan)->current_tx_seq; msg->seq = mavlink_get_channel_status(chan)->current_tx_seq;
mavlink_get_channel_status(chan)->current_tx_seq = mavlink_get_channel_status(chan)->current_tx_seq+1; mavlink_get_channel_status(chan)->current_tx_seq = mavlink_get_channel_status(chan)->current_tx_seq+1;
checksum = crc_calculate((uint8_t*)&msg->len, length + MAVLINK_CORE_HEADER_LEN); msg->checksum = crc_calculate(((const uint8_t*)(msg)) + 3, MAVLINK_CORE_HEADER_LEN);
crc_accumulate_buffer(&msg->checksum, _MAV_PAYLOAD(msg), msg->len);
#if MAVLINK_CRC_EXTRA #if MAVLINK_CRC_EXTRA
crc_accumulate(crc_extra, &checksum); crc_accumulate(crc_extra, &msg->checksum);
#endif #endif
mavlink_ck_a(msg) = (uint8_t)(checksum & 0xFF); mavlink_ck_a(msg) = (uint8_t)(msg->checksum & 0xFF);
mavlink_ck_b(msg) = (uint8_t)(checksum >> 8); mavlink_ck_b(msg) = (uint8_t)(msg->checksum >> 8);
return length + MAVLINK_NUM_NON_PAYLOAD_BYTES; return length + MAVLINK_NUM_NON_PAYLOAD_BYTES;
} }
...@@ -133,7 +133,7 @@ MAVLINK_HELPER void _mav_finalize_message_chan_send(mavlink_channel_t chan, uint ...@@ -133,7 +133,7 @@ MAVLINK_HELPER void _mav_finalize_message_chan_send(mavlink_channel_t chan, uint
buf[4] = mavlink_system.compid; buf[4] = mavlink_system.compid;
buf[5] = msgid; buf[5] = msgid;
status->current_tx_seq++; status->current_tx_seq++;
checksum = crc_calculate((uint8_t*)&buf[1], MAVLINK_CORE_HEADER_LEN); checksum = crc_calculate((const uint8_t*)&buf[1], MAVLINK_CORE_HEADER_LEN);
crc_accumulate_buffer(&checksum, packet, length); crc_accumulate_buffer(&checksum, packet, length);
#if MAVLINK_CRC_EXTRA #if MAVLINK_CRC_EXTRA
crc_accumulate(crc_extra, &checksum); crc_accumulate(crc_extra, &checksum);
...@@ -158,6 +158,7 @@ MAVLINK_HELPER void _mavlink_resend_uart(mavlink_channel_t chan, const mavlink_m ...@@ -158,6 +158,7 @@ MAVLINK_HELPER void _mavlink_resend_uart(mavlink_channel_t chan, const mavlink_m
ck[0] = (uint8_t)(msg->checksum & 0xFF); ck[0] = (uint8_t)(msg->checksum & 0xFF);
ck[1] = (uint8_t)(msg->checksum >> 8); ck[1] = (uint8_t)(msg->checksum >> 8);
// XXX use the right sequence here
MAVLINK_START_UART_SEND(chan, MAVLINK_NUM_NON_PAYLOAD_BYTES + msg->len); MAVLINK_START_UART_SEND(chan, MAVLINK_NUM_NON_PAYLOAD_BYTES + msg->len);
_mavlink_send_uart(chan, (const char *)&msg->magic, MAVLINK_NUM_HEADER_BYTES); _mavlink_send_uart(chan, (const char *)&msg->magic, MAVLINK_NUM_HEADER_BYTES);
...@@ -172,7 +173,13 @@ MAVLINK_HELPER void _mavlink_resend_uart(mavlink_channel_t chan, const mavlink_m ...@@ -172,7 +173,13 @@ MAVLINK_HELPER void _mavlink_resend_uart(mavlink_channel_t chan, const mavlink_m
*/ */
MAVLINK_HELPER uint16_t mavlink_msg_to_send_buffer(uint8_t *buffer, const mavlink_message_t *msg) MAVLINK_HELPER uint16_t mavlink_msg_to_send_buffer(uint8_t *buffer, const mavlink_message_t *msg)
{ {
memcpy(buffer, (const uint8_t *)&msg->magic, MAVLINK_NUM_NON_PAYLOAD_BYTES + (uint16_t)msg->len); memcpy(buffer, (const uint8_t *)&msg->magic, MAVLINK_NUM_HEADER_BYTES + (uint16_t)msg->len);
uint8_t *ck = buffer + (MAVLINK_NUM_HEADER_BYTES + (uint16_t)msg->len);
ck[0] = (uint8_t)(msg->checksum & 0xFF);
ck[1] = (uint8_t)(msg->checksum >> 8);
return MAVLINK_NUM_NON_PAYLOAD_BYTES + (uint16_t)msg->len; return MAVLINK_NUM_NON_PAYLOAD_BYTES + (uint16_t)msg->len;
} }
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#define MAVLINK_MAX_EXTENDED_PAYLOAD_LEN (MAVLINK_MAX_EXTENDED_PACKET_LEN - MAVLINK_EXTENDED_HEADER_LEN - MAVLINK_NUM_NON_PAYLOAD_BYTES) #define MAVLINK_MAX_EXTENDED_PAYLOAD_LEN (MAVLINK_MAX_EXTENDED_PACKET_LEN - MAVLINK_EXTENDED_HEADER_LEN - MAVLINK_NUM_NON_PAYLOAD_BYTES)
#pragma pack(push, 1)
typedef struct param_union { typedef struct param_union {
union { union {
float param_float; float param_float;
...@@ -62,13 +63,12 @@ typedef struct __mavlink_message { ...@@ -62,13 +63,12 @@ typedef struct __mavlink_message {
uint64_t payload64[(MAVLINK_MAX_PAYLOAD_LEN+MAVLINK_NUM_CHECKSUM_BYTES+7)/8]; uint64_t payload64[(MAVLINK_MAX_PAYLOAD_LEN+MAVLINK_NUM_CHECKSUM_BYTES+7)/8];
} mavlink_message_t; } mavlink_message_t;
typedef struct __mavlink_extended_message { typedef struct __mavlink_extended_message {
mavlink_message_t base_msg; mavlink_message_t base_msg;
int32_t extended_payload_len; ///< Length of extended payload if any int32_t extended_payload_len; ///< Length of extended payload if any
uint8_t extended_payload[MAVLINK_MAX_EXTENDED_PAYLOAD_LEN]; uint8_t extended_payload[MAVLINK_MAX_EXTENDED_PAYLOAD_LEN];
} mavlink_extended_message_t; } mavlink_extended_message_t;
#pragma pack(pop)
typedef enum { typedef enum {
MAVLINK_TYPE_CHAR = 0, MAVLINK_TYPE_CHAR = 0,
......
This diff is collapsed.
...@@ -61,6 +61,7 @@ namespace core { ...@@ -61,6 +61,7 @@ namespace core {
Placemark GetPlacemarkFromGeocoder(internals::PointLatLng location); Placemark GetPlacemarkFromGeocoder(internals::PointLatLng location);
int Timeout; int Timeout;
private: private:
int Random(int low, int high);
void GetSecGoogleWords(const core::Point &pos, QString &sec1, QString &sec2); void GetSecGoogleWords(const core::Point &pos, QString &sec1, QString &sec2);
int GetServerNum(const core::Point &pos,const int &max) const; int GetServerNum(const core::Point &pos,const int &max) const;
void TryCorrectGoogleVersions(); void TryCorrectGoogleVersions();
......
...@@ -360,7 +360,7 @@ namespace internals { ...@@ -360,7 +360,7 @@ namespace internals {
{ {
SetProjection(new MercatorProjection()); SetProjection(new MercatorProjection());
} }
maxzoom=19; maxzoom=21;
} }
break; break;
......
...@@ -52,31 +52,37 @@ namespace mapcontrol ...@@ -52,31 +52,37 @@ namespace mapcontrol
} }
void MapRipper::finish() void MapRipper::finish()
{ {
if(zoom<maxzoom) if(zoom<maxzoom)
{ {
++zoom; ++zoom;
QMessageBox msgBox; QMessageBox msgBox;
msgBox.setText(tr("Continue Ripping at zoom level %1? (Continuing automatically after 3s)").arg(zoom)); msgBox.setText(tr("Continue Ripping at zoom level %1? (Continuing automatically after 3s)").arg(zoom));
// msgBox.setInformativeText("Do you want to save your changes?"); // msgBox.setInformativeText("Do you want to save your changes?");
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No); msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
msgBox.setDefaultButton(QMessageBox::Yes); msgBox.setDefaultButton(QMessageBox::Yes);
QTimer::singleShot(3000, &msgBox, SLOT(accept())); QTimer::singleShot(3000, &msgBox, SLOT(accept()));
msgBox.exec(); msgBox.exec();
int ret = msgBox.result(); int ret = msgBox.result();
if(ret==QMessageBox::Yes || ret == 1) if(ret==QMessageBox::Yes || ret == 1)
{ {
points.clear(); points.clear();
points=core->Projection()->GetAreaTileList(area,zoom,0); points=core->Projection()->GetAreaTileList(area,zoom,0);
this->start(); this->start();
} }
else else
{ {
progressForm->close(); progressForm->close();
delete progressForm; delete progressForm;
this->deleteLater(); this->deleteLater();
} }
} }
else
{
progressForm->close();
delete progressForm;
this->deleteLater();
}
} }
......
...@@ -308,7 +308,7 @@ namespace mapcontrol ...@@ -308,7 +308,7 @@ namespace mapcontrol
} }
void WayPointItem::RefreshToolTip() void WayPointItem::RefreshToolTip()
{ {
QString coord_str = QString::number(coord.Lat(), 'f', 6) + " " + QString::number(coord.Lng(), 'f', 6); QString coord_str = QString::number(coord.Lat(), 'f', 7) + " " + QString::number(coord.Lng(), 'f', 7);
setToolTip(QString("WayPoint Number: %1\nDescription: %2\nCoordinate: %4\nAltitude: %5 m (MSL)\nHeading: %6 deg").arg(QString::number(WayPointItem::number)).arg(description).arg(coord_str).arg(QString::number(altitude)).arg(QString::number(heading))); setToolTip(QString("WayPoint Number: %1\nDescription: %2\nCoordinate: %4\nAltitude: %5 m (MSL)\nHeading: %6 deg").arg(QString::number(WayPointItem::number)).arg(description).arg(coord_str).arg(QString::number(altitude)).arg(QString::number(heading)));
} }
......
######################################################################
# Automatically generated by qmake (2.01a) Wed Feb 10 11:43:43 2010
######################################################################
QWTSRCDIR = libs/qwt
DEPENDPATH += $$QWTSRCDIR
INCLUDEPATH += $$QWTSRCDIR
# Input
HEADERS += $$QWTSRCDIR/qwt.h \
$$QWTSRCDIR/qwt_abstract_legend.h \
$$QWTSRCDIR/qwt_abstract_scale.h \
$$QWTSRCDIR/qwt_abstract_scale_draw.h \
$$QWTSRCDIR/qwt_abstract_slider.h \
$$QWTSRCDIR/qwt_analog_clock.h \
$$QWTSRCDIR/qwt_arrow_button.h \
$$QWTSRCDIR/qwt_clipper.h \
$$QWTSRCDIR/qwt_color_map.h \
$$QWTSRCDIR/qwt_compass.h \
$$QWTSRCDIR/qwt_compass_rose.h \
$$QWTSRCDIR/qwt_counter.h \
$$QWTSRCDIR/qwt_curve_fitter.h \
$$QWTSRCDIR/qwt_dial.h \
$$QWTSRCDIR/qwt_dial_needle.h \
$$QWTSRCDIR/qwt_dyngrid_layout.h \
$$QWTSRCDIR/qwt_event_pattern.h \
$$QWTSRCDIR/qwt_global.h \
$$QWTSRCDIR/qwt_graphic.h \
$$QWTSRCDIR/qwt_interval.h \
$$QWTSRCDIR/qwt_knob.h \
$$QWTSRCDIR/qwt_legend.h \
$$QWTSRCDIR/qwt_legend_data.h \
$$QWTSRCDIR/qwt_legend_label.h \
$$QWTSRCDIR/qwt_magnifier.h \
$$QWTSRCDIR/qwt_math.h \
$$QWTSRCDIR/qwt_null_paintdevice.h \
$$QWTSRCDIR/qwt_painter.h \
$$QWTSRCDIR/qwt_painter_command.h \
$$QWTSRCDIR/qwt_panner.h \
$$QWTSRCDIR/qwt_picker.h \
$$QWTSRCDIR/qwt_picker_machine.h \
$$QWTSRCDIR/qwt_pixel_matrix.h \
$$QWTSRCDIR/qwt_plot.h \
$$QWTSRCDIR/qwt_plot_canvas.h \
$$QWTSRCDIR/qwt_plot_curve.h \
$$QWTSRCDIR/qwt_plot_dict.h \
$$QWTSRCDIR/qwt_plot_grid.h \
$$QWTSRCDIR/qwt_plot_item.h \
$$QWTSRCDIR/qwt_plot_layout.h \
$$QWTSRCDIR/qwt_plot_magnifier.h \
$$QWTSRCDIR/qwt_plot_marker.h \
$$QWTSRCDIR/qwt_plot_panner.h \
$$QWTSRCDIR/qwt_plot_picker.h \
$$QWTSRCDIR/qwt_plot_rasteritem.h \
$$QWTSRCDIR/qwt_plot_scaleitem.h \
$$QWTSRCDIR/qwt_plot_seriesitem.h \
$$QWTSRCDIR/qwt_plot_spectrogram.h \
$$QWTSRCDIR/qwt_plot_svgitem.h \
$$QWTSRCDIR/qwt_plot_zoomer.h \
$$QWTSRCDIR/qwt_point_mapper.h \
$$QWTSRCDIR/qwt_point_data.h \
$$QWTSRCDIR/qwt_raster_data.h \
$$QWTSRCDIR/qwt_round_scale_draw.h \
$$QWTSRCDIR/qwt_scale_div.h \
$$QWTSRCDIR/qwt_scale_draw.h \
$$QWTSRCDIR/qwt_scale_engine.h \
$$QWTSRCDIR/qwt_scale_map.h \
$$QWTSRCDIR/qwt_scale_widget.h \
$$QWTSRCDIR/qwt_series_data.h \
$$QWTSRCDIR/qwt_slider.h \
$$QWTSRCDIR/qwt_spline.h \
$$QWTSRCDIR/qwt_symbol.h \
$$QWTSRCDIR/qwt_text.h \
$$QWTSRCDIR/qwt_text_engine.h \
$$QWTSRCDIR/qwt_text_label.h \
$$QWTSRCDIR/qwt_thermo.h \
$$QWTSRCDIR/qwt_transform.h \
$$QWTSRCDIR/qwt_wheel.h \
$$QWTSRCDIR/qwt_widget_overlay.h
SOURCES += $$QWTSRCDIR/qwt_abstract_legend.cpp \
$$QWTSRCDIR/qwt_abstract_scale.cpp \
$$QWTSRCDIR/qwt_abstract_scale_draw.cpp \
$$QWTSRCDIR/qwt_abstract_slider.cpp \
$$QWTSRCDIR/qwt_analog_clock.cpp \
$$QWTSRCDIR/qwt_arrow_button.cpp \
$$QWTSRCDIR/qwt_clipper.cpp \
$$QWTSRCDIR/qwt_color_map.cpp \
$$QWTSRCDIR/qwt_compass.cpp \
$$QWTSRCDIR/qwt_compass_rose.cpp \
$$QWTSRCDIR/qwt_counter.cpp \
$$QWTSRCDIR/qwt_curve_fitter.cpp \
$$QWTSRCDIR/qwt_dial.cpp \
$$QWTSRCDIR/qwt_dial_needle.cpp \
$$QWTSRCDIR/qwt_dyngrid_layout.cpp \
$$QWTSRCDIR/qwt_event_pattern.cpp \
$$QWTSRCDIR/qwt_graphic.cpp \
$$QWTSRCDIR/qwt_interval.cpp \
$$QWTSRCDIR/qwt_knob.cpp \
$$QWTSRCDIR/qwt_legend.cpp \
$$QWTSRCDIR/qwt_legend_data.cpp \
$$QWTSRCDIR/qwt_legend_label.cpp \
$$QWTSRCDIR/qwt_magnifier.cpp \
$$QWTSRCDIR/qwt_math.cpp \
$$QWTSRCDIR/qwt_null_paintdevice.cpp \
$$QWTSRCDIR/qwt_painter.cpp \
$$QWTSRCDIR/qwt_painter_command.cpp \
$$QWTSRCDIR/qwt_panner.cpp \
$$QWTSRCDIR/qwt_picker.cpp \
$$QWTSRCDIR/qwt_picker_machine.cpp \
$$QWTSRCDIR/qwt_pixel_matrix.cpp \
$$QWTSRCDIR/qwt_plot.cpp \
$$QWTSRCDIR/qwt_plot_axis.cpp \
$$QWTSRCDIR/qwt_plot_canvas.cpp \
$$QWTSRCDIR/qwt_plot_curve.cpp \
$$QWTSRCDIR/qwt_plot_dict.cpp \
$$QWTSRCDIR/qwt_plot_grid.cpp \
$$QWTSRCDIR/qwt_plot_item.cpp \
$$QWTSRCDIR/qwt_plot_layout.cpp \
$$QWTSRCDIR/qwt_plot_magnifier.cpp \
$$QWTSRCDIR/qwt_plot_marker.cpp \
$$QWTSRCDIR/qwt_plot_panner.cpp \
$$QWTSRCDIR/qwt_plot_picker.cpp \
$$QWTSRCDIR/qwt_plot_rasteritem.cpp \
$$QWTSRCDIR/qwt_plot_scaleitem.cpp \
$$QWTSRCDIR/qwt_plot_seriesitem.cpp \
$$QWTSRCDIR/qwt_plot_spectrogram.cpp \
$$QWTSRCDIR/qwt_plot_svgitem.cpp \
$$QWTSRCDIR/qwt_plot_xml.cpp \
$$QWTSRCDIR/qwt_plot_zoomer.cpp \
$$QWTSRCDIR/qwt_point_mapper.cpp \
$$QWTSRCDIR/qwt_point_data.cpp \
$$QWTSRCDIR/qwt_raster_data.cpp \
$$QWTSRCDIR/qwt_round_scale_draw.cpp \
$$QWTSRCDIR/qwt_scale_div.cpp \
$$QWTSRCDIR/qwt_scale_draw.cpp \
$$QWTSRCDIR/qwt_scale_engine.cpp \
$$QWTSRCDIR/qwt_scale_map.cpp \
$$QWTSRCDIR/qwt_scale_widget.cpp \
$$QWTSRCDIR/qwt_series_data.cpp \
$$QWTSRCDIR/qwt_slider.cpp \
$$QWTSRCDIR/qwt_spline.cpp \
$$QWTSRCDIR/qwt_symbol.cpp \
$$QWTSRCDIR/qwt_text.cpp \
$$QWTSRCDIR/qwt_text_engine.cpp \
$$QWTSRCDIR/qwt_text_label.cpp \
$$QWTSRCDIR/qwt_thermo.cpp \
$$QWTSRCDIR/qwt_transform.cpp \
$$QWTSRCDIR/qwt_wheel.cpp \
$$QWTSRCDIR/qwt_widget_overlay.cpp
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
* Qwt Widget Library
* Copyright (C) 1997 Josef Wilgen
* Copyright (C) 2002 Uwe Rathmann
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the Qwt License, Version 1.0
*****************************************************************************/
#include "qwt_abstract_legend.h"
/*!
Constructor
\param parent Parent widget
*/
QwtAbstractLegend::QwtAbstractLegend( QWidget *parent ):
QFrame( parent )
{
}
//! Destructor
QwtAbstractLegend::~QwtAbstractLegend()
{
}
/*!
Return the extent, that is needed for elements to scroll
the legend ( usually scrollbars ),
\param orientation Orientation
\return Extent of the corresponding scroll element
*/
int QwtAbstractLegend::scrollExtent( Qt::Orientation orientation ) const
{
Q_UNUSED( orientation );
return 0;
}
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
* Qwt Widget Library
* Copyright (C) 1997 Josef Wilgen
* Copyright (C) 2002 Uwe Rathmann
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the Qwt License, Version 1.0
*****************************************************************************/
#ifndef QWT_ABSTRACT_LEGEND_H
#define QWT_ABSTRACT_LEGEND_H
#include "qwt_global.h"
#include "qwt_legend_data.h"
#include <qframe.h>
#include <qlist.h>
class QVariant;
/*!
\brief Abstract base class for legend widgets
Legends, that need to be under control of the QwtPlot layout system
need to be derived from QwtAbstractLegend.
\note Other type of legends can be implemented by connecting to
the QwtPlot::legendDataChanged() signal. But as these legends
are unknown to the plot layout system the layout code
( on screen and for QwtPlotRenderer ) need to be organized
in application code.
\sa QwtLegend
*/
class QWT_EXPORT QwtAbstractLegend : public QFrame
{
Q_OBJECT
public:
explicit QwtAbstractLegend( QWidget *parent = NULL );
virtual ~QwtAbstractLegend();
/*!
Render the legend into a given rectangle.
\param painter Painter
\param rect Bounding rectangle
\param fillBackground When true, fill rect with the widget background
\sa renderLegend() is used by QwtPlotRenderer
*/
virtual void renderLegend( QPainter *painter,
const QRectF &rect, bool fillBackground ) const = 0;
//! \return True, when no plot item is inserted
virtual bool isEmpty() const = 0;
virtual int scrollExtent( Qt::Orientation ) const;
public Q_SLOTS:
/*!
\brief Update the entries for a plot item
\param itemInfo Info about an item
\param data List of legend entry attributes for the item
*/
virtual void updateLegend( const QVariant &itemInfo,
const QList<QwtLegendData> &data ) = 0;
};
#endif
This diff is collapsed.
...@@ -11,50 +11,85 @@ ...@@ -11,50 +11,85 @@
#define QWT_ABSTRACT_SCALE_H #define QWT_ABSTRACT_SCALE_H
#include "qwt_global.h" #include "qwt_global.h"
#include <qwidget.h>
class QwtScaleEngine; class QwtScaleEngine;
class QwtAbstractScaleDraw; class QwtAbstractScaleDraw;
class QwtScaleDiv; class QwtScaleDiv;
class QwtScaleMap; class QwtScaleMap;
class QwtDoubleInterval; class QwtInterval;
/*! /*!
\brief An abstract base class for classes containing a scale \brief An abstract base class for widgets having a scale
QwtAbstractScale is used to provide classes with a QwtScaleDraw, The scale of an QwtAbstractScale is determined by a QwtScaleDiv
and a QwtScaleDiv. The QwtScaleDiv might be set explicitely definition, that contains the boundaries and the ticks of the scale.
or calculated by a QwtScaleEngine. The scale is painted using a QwtScaleDraw object.
The scale division might be assigned explicitly - but usually
it is calculated from the boundaries using a QwtScaleEngine.
The scale engine also decides the type of transformation of the scale
( linear, logarithmic ... ).
*/ */
class QWT_EXPORT QwtAbstractScale class QWT_EXPORT QwtAbstractScale: public QWidget
{ {
Q_OBJECT
Q_PROPERTY( double lowerBound READ lowerBound WRITE setLowerBound )
Q_PROPERTY( double upperBound READ upperBound WRITE setUpperBound )
Q_PROPERTY( int scaleMaxMajor READ scaleMaxMajor WRITE setScaleMaxMajor )
Q_PROPERTY( int scaleMaxMinor READ scaleMaxMinor WRITE setScaleMaxMinor )
Q_PROPERTY( double scaleStepSize READ scaleStepSize WRITE setScaleStepSize )
public: public:
QwtAbstractScale(); QwtAbstractScale( QWidget *parent = NULL );
virtual ~QwtAbstractScale(); virtual ~QwtAbstractScale();
void setScale(double vmin, double vmax, double step = 0.0); void setScale( double lowerBound, double upperBound );
void setScale(const QwtDoubleInterval &, double step = 0.0); void setScale( const QwtInterval & );
void setScale(const QwtScaleDiv &s); void setScale( const QwtScaleDiv & );
const QwtScaleDiv& scaleDiv() const;
void setAutoScale(); void setLowerBound( double value );
bool autoScale() const; double lowerBound() const;
void setScaleMaxMajor( int ticks); void setUpperBound( double value );
double upperBound() const;
void setScaleStepSize( double stepSize );
double scaleStepSize() const;
void setScaleMaxMajor( int ticks );
int scaleMaxMinor() const; int scaleMaxMinor() const;
void setScaleMaxMinor( int ticks); void setScaleMaxMinor( int ticks );
int scaleMaxMajor() const; int scaleMaxMajor() const;
void setScaleEngine(QwtScaleEngine *); void setScaleEngine( QwtScaleEngine * );
const QwtScaleEngine *scaleEngine() const; const QwtScaleEngine *scaleEngine() const;
QwtScaleEngine *scaleEngine(); QwtScaleEngine *scaleEngine();
int transform( double ) const;
double invTransform( int ) const;
bool isInverted() const;
double minimum() const;
double maximum() const;
const QwtScaleMap &scaleMap() const; const QwtScaleMap &scaleMap() const;
protected: protected:
void rescale(double vmin, double vmax, double step = 0.0); void rescale( double lowerBound,
double upperBound, double stepSize );
void setAbstractScaleDraw( QwtAbstractScaleDraw * );
void setAbstractScaleDraw(QwtAbstractScaleDraw *);
const QwtAbstractScaleDraw *abstractScaleDraw() const; const QwtAbstractScaleDraw *abstractScaleDraw() const;
QwtAbstractScaleDraw *abstractScaleDraw(); QwtAbstractScaleDraw *abstractScaleDraw();
......
This diff is collapsed.
...@@ -14,15 +14,10 @@ ...@@ -14,15 +14,10 @@
#include "qwt_scale_div.h" #include "qwt_scale_div.h"
#include "qwt_text.h" #include "qwt_text.h"
#if QT_VERSION < 0x040000
class QColorGroup;
#else
class QPalette; class QPalette;
#endif
class QPainter; class QPainter;
class QFont; class QFont;
class QwtScaleTransformation; class QwtTransform;
class QwtScaleMap; class QwtScaleMap;
/*! /*!
...@@ -31,8 +26,7 @@ class QwtScaleMap; ...@@ -31,8 +26,7 @@ class QwtScaleMap;
QwtAbstractScaleDraw can be used to draw linear or logarithmic scales. QwtAbstractScaleDraw can be used to draw linear or logarithmic scales.
After a scale division has been specified as a QwtScaleDiv object After a scale division has been specified as a QwtScaleDiv object
using QwtAbstractScaleDraw::setScaleDiv(const QwtScaleDiv &s), using setScaleDiv(), the scale can be drawn with the draw() member.
the scale can be drawn with the QwtAbstractScaleDraw::draw() member.
*/ */
class QWT_EXPORT QwtAbstractScaleDraw class QWT_EXPORT QwtAbstractScaleDraw
{ {
...@@ -40,66 +34,66 @@ public: ...@@ -40,66 +34,66 @@ public:
/*! /*!
Components of a scale Components of a scale
\sa enableComponent(), hasComponent
*/
enum ScaleComponent
{
//! Backbone = the line where the ticks are located
Backbone = 0x01,
- Backbone //! Ticks
- Ticks Ticks = 0x02,
- Labels
\sa QwtAbstractScaleDraw::enableComponent,
QwtAbstractScaleDraw::hasComponent
*/
enum ScaleComponent { //! Labels
Backbone = 1, Labels = 0x04
Ticks = 2,
Labels = 4
}; };
//! Scale components
typedef QFlags<ScaleComponent> ScaleComponents;
QwtAbstractScaleDraw(); QwtAbstractScaleDraw();
QwtAbstractScaleDraw( const QwtAbstractScaleDraw & );
virtual ~QwtAbstractScaleDraw(); virtual ~QwtAbstractScaleDraw();
QwtAbstractScaleDraw &operator=(const QwtAbstractScaleDraw &); void setScaleDiv( const QwtScaleDiv &s );
void setScaleDiv(const QwtScaleDiv &s);
const QwtScaleDiv& scaleDiv() const; const QwtScaleDiv& scaleDiv() const;
void setTransformation(QwtScaleTransformation *); void setTransformation( QwtTransform * );
const QwtScaleMap &map() const; const QwtScaleMap &scaleMap() const;
QwtScaleMap &scaleMap();
void enableComponent(ScaleComponent, bool enable = true); void enableComponent( ScaleComponent, bool enable = true );
bool hasComponent(ScaleComponent) const; bool hasComponent( ScaleComponent ) const;
void setTickLength(QwtScaleDiv::TickType, int length); void setTickLength( QwtScaleDiv::TickType, double length );
int tickLength(QwtScaleDiv::TickType) const; double tickLength( QwtScaleDiv::TickType ) const;
int majTickLength() const; double maxTickLength() const;
void setSpacing(int margin); void setSpacing( double margin );
int spacing() const; double spacing() const;
#if QT_VERSION < 0x040000 void setPenWidth( int width );
virtual void draw(QPainter *, const QColorGroup &) const; int penWidth() const;
#else
virtual void draw(QPainter *, const QPalette &) const; virtual void draw( QPainter *, const QPalette & ) const;
#endif
virtual QwtText label(double) const; virtual QwtText label( double ) const;
/*! /*!
Calculate the extent Calculate the extent
The extent is the distcance from the baseline to the outermost The extent is the distance from the baseline to the outermost
pixel of the scale draw in opposite to its orientation. pixel of the scale draw in opposite to its orientation.
It is at least minimumExtent() pixels. It is at least minimumExtent() pixels.
\param font Font used for drawing the tick labels
\return Number of pixels
\sa setMinimumExtent(), minimumExtent() \sa setMinimumExtent(), minimumExtent()
*/ */
virtual int extent(const QPen &, const QFont &) const = 0; virtual double extent( const QFont &font ) const = 0;
void setMinimumExtent(int); void setMinimumExtent( double );
int minimumExtent() const; double minimumExtent() const;
QwtScaleMap &scaleMap();
protected: protected:
/*! /*!
...@@ -107,11 +101,11 @@ protected: ...@@ -107,11 +101,11 @@ protected:
\param painter Painter \param painter Painter
\param value Value of the tick \param value Value of the tick
\param len Lenght of the tick \param len Length of the tick
\sa drawBackbone(), drawLabel() \sa drawBackbone(), drawLabel()
*/ */
virtual void drawTick(QPainter *painter, double value, int len) const = 0; virtual void drawTick( QPainter *painter, double value, double len ) const = 0;
/*! /*!
Draws the baseline of the scale Draws the baseline of the scale
...@@ -119,7 +113,7 @@ protected: ...@@ -119,7 +113,7 @@ protected:
\sa drawTick(), drawLabel() \sa drawTick(), drawLabel()
*/ */
virtual void drawBackbone(QPainter *painter) const = 0; virtual void drawBackbone( QPainter *painter ) const = 0;
/*! /*!
Draws the label for a major scale tick Draws the label for a major scale tick
...@@ -127,19 +121,21 @@ protected: ...@@ -127,19 +121,21 @@ protected:
\param painter Painter \param painter Painter
\param value Value \param value Value
\sa drawTick, drawBackbone \sa drawTick(), drawBackbone()
*/ */
virtual void drawLabel(QPainter *painter, double value) const = 0; virtual void drawLabel( QPainter *painter, double value ) const = 0;
void invalidateCache(); void invalidateCache();
const QwtText &tickLabel(const QFont &, double value) const; const QwtText &tickLabel( const QFont &, double value ) const;
private: private:
int operator==(const QwtAbstractScaleDraw &) const; QwtAbstractScaleDraw( const QwtAbstractScaleDraw & );
int operator!=(const QwtAbstractScaleDraw &) const; QwtAbstractScaleDraw &operator=( const QwtAbstractScaleDraw & );
class PrivateData; class PrivateData;
PrivateData *d_data; PrivateData *d_data;
}; };
Q_DECLARE_OPERATORS_FOR_FLAGS( QwtAbstractScaleDraw::ScaleComponents )
#endif #endif
This diff is collapsed.
...@@ -10,112 +10,95 @@ ...@@ -10,112 +10,95 @@
#ifndef QWT_ABSTRACT_SLIDER_H #ifndef QWT_ABSTRACT_SLIDER_H
#define QWT_ABSTRACT_SLIDER_H #define QWT_ABSTRACT_SLIDER_H
#include <qwidget.h>
#include "qwt_global.h" #include "qwt_global.h"
#include "qwt_double_range.h" #include "qwt_abstract_scale.h"
/*! /*!
\brief An abstract base class for slider widgets \brief An abstract base class for slider widgets with a scale
QwtAbstractSlider is a base class for A slider widget displays a value according to a scale.
slider widgets. It handles mouse events The class is designed as a common super class for widgets like
and updates the slider's value accordingly. Derived classes QwtKnob, QwtDial and QwtSlider.
only have to implement the getValue() and
getScrollMode() members, and should react to a When the slider is nor readOnly() its value can be modified
valueChange(), which normally requires repainting. by keyboard, mouse and wheel inputs.
The range of the slider is divided into a number of steps from
which the value increments according to user inputs depend.
Only for linear scales the number of steps correspond with
a fixed step size.
*/ */
class QWT_EXPORT QwtAbstractSlider : public QWidget, public QwtDoubleRange class QWT_EXPORT QwtAbstractSlider: public QwtAbstractScale
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY( double value READ value WRITE setValue )
Q_PROPERTY( uint totalSteps READ totalSteps WRITE setTotalSteps )
Q_PROPERTY( uint singleSteps READ singleSteps WRITE setSingleSteps )
Q_PROPERTY( uint pageSteps READ pageSteps WRITE setPageSteps )
Q_PROPERTY( bool stepAlignment READ stepAlignment WRITE setStepAlignment )
Q_PROPERTY( bool readOnly READ isReadOnly WRITE setReadOnly ) Q_PROPERTY( bool readOnly READ isReadOnly WRITE setReadOnly )
Q_PROPERTY( bool valid READ isValid WRITE setValid ) Q_PROPERTY( bool tracking READ isTracking WRITE setTracking )
Q_PROPERTY( double mass READ mass WRITE setMass ) Q_PROPERTY( bool wrapping READ wrapping WRITE setWrapping )
#ifndef Q_MOC_RUN // Qt3 moc
#define QWT_PROPERTY Q_PROPERTY Q_PROPERTY( bool invertedControls READ invertedControls WRITE setInvertedControls )
Q_PROPERTY( Orientation orientation
READ orientation WRITE setOrientation )
#else // Qt4 moc
// MOC_SKIP_BEGIN
Q_PROPERTY( Qt::Orientation orientation
READ orientation WRITE setOrientation )
// MOC_SKIP_END
#endif
public: public:
/*! explicit QwtAbstractSlider( QWidget *parent = NULL );
Scroll mode
\sa getScrollMode()
*/
enum ScrollMode {
ScrNone,
ScrMouse,
ScrTimer,
ScrDirect,
ScrPage
};
explicit QwtAbstractSlider(Qt::Orientation, QWidget *parent = NULL);
virtual ~QwtAbstractSlider(); virtual ~QwtAbstractSlider();
void setUpdateTime(int t); void setValid( bool );
void stopMoving(); bool isValid() const;
void setTracking(bool enable);
virtual void setMass(double val); double value() const;
virtual double mass() const;
#if QT_VERSION >= 0x040000 void setWrapping( bool );
virtual void setOrientation(Qt::Orientation o); bool wrapping() const;
Qt::Orientation orientation() const;
#else
virtual void setOrientation(Orientation o);
Orientation orientation() const;
#endif
bool isReadOnly() const; void setTotalSteps( uint );
uint totalSteps() const;
/* void setSingleSteps( uint );
Wrappers for QwtDblRange::isValid/QwtDblRange::setValid made uint singleSteps() const;
to be available as Q_PROPERTY in the designer.
*/
/*! void setPageSteps( uint );
\sa QwtDblRange::isValid uint pageSteps() const;
*/
bool isValid() const {
return QwtDoubleRange::isValid();
}
/*! void setStepAlignment( bool );
\sa QwtDblRange::isValid bool stepAlignment() const;
*/
void setValid(bool valid) {
QwtDoubleRange::setValid(valid);
}
public slots: void setTracking( bool );
virtual void setValue(double val); bool isTracking() const;
virtual void fitValue(double val);
virtual void incValue(int steps); void setReadOnly( bool );
bool isReadOnly() const;
virtual void setReadOnly(bool); void setInvertedControls( bool );
bool invertedControls() const;
signals: public Q_SLOTS:
void setValue( double val );
Q_SIGNALS:
/*! /*!
\brief Notify a change of value. \brief Notify a change of value.
In the default setting When tracking is enabled (default setting),
(tracking enabled), this signal will be emitted every this signal will be emitted every time the value changes.
time the value changes ( see setTracking() ).
\param value new value \param value New value
\sa setTracking(), sliderMoved()
*/ */
void valueChanged(double value); void valueChanged( double value );
/*! /*!
This signal is emitted when the user presses the This signal is emitted when the user presses the
movable part of the slider (start ScrMouse Mode). movable part of the slider.
*/ */
void sliderPressed(); void sliderPressed();
...@@ -123,70 +106,59 @@ signals: ...@@ -123,70 +106,59 @@ signals:
This signal is emitted when the user releases the This signal is emitted when the user releases the
movable part of the slider. movable part of the slider.
*/ */
void sliderReleased(); void sliderReleased();
/*! /*!
This signal is emitted when the user moves the This signal is emitted when the user moves the
slider with the mouse. slider with the mouse.
\param value new value
\param value New value
\sa valueChanged()
*/ */
void sliderMoved(double value); void sliderMoved( double value );
protected: protected:
virtual void setPosition(const QPoint &); virtual void mousePressEvent( QMouseEvent * );
virtual void valueChange(); virtual void mouseReleaseEvent( QMouseEvent * );
virtual void mouseMoveEvent( QMouseEvent * );
virtual void timerEvent(QTimerEvent *e); virtual void keyPressEvent( QKeyEvent * );
virtual void mousePressEvent(QMouseEvent *e); virtual void wheelEvent( QWheelEvent * );
virtual void mouseReleaseEvent(QMouseEvent *e);
virtual void mouseMoveEvent(QMouseEvent *e);
virtual void keyPressEvent(QKeyEvent *e);
virtual void wheelEvent(QWheelEvent *e);
/*! /*!
\brief Determine the value corresponding to a specified poind \brief Determine what to do when the user presses a mouse button.
\param pos Mouse position
This is an abstract virtual function which is called when \retval True, when pos is a valid scroll position
the user presses or releases a mouse button or moves the \sa scrolledTo()
mouse. It has to be implemented by the derived class.
\param p point
*/ */
virtual double getValue(const QPoint & p) = 0; virtual bool isScrollPosition( const QPoint &pos ) const = 0;
/*! /*!
\brief Determine what to do when the user presses a mouse button. \brief Determine the value for a new position of the
movable part of the slider
This function is abstract and has to be implemented by derived classes. \param pos Mouse position
It is called on a mousePress event. The derived class can determine
what should happen next in dependence of the position where the mouse \return Value for the mouse position
was pressed by returning scrolling mode and direction. QwtAbstractSlider \sa isScrollPosition()
knows the following modes:<dl>
<dt>QwtAbstractSlider::ScrNone
<dd>Scrolling switched off. Don't change the value.
<dt>QwtAbstractSlider::ScrMouse
<dd>Change the value while the user keeps the
button pressed and moves the mouse.
<dt>QwtAbstractSlider::ScrTimer
<dd>Automatic scrolling. Increment the value
in the specified direction as long as
the user keeps the button pressed.
<dt>QwtAbstractSlider::ScrPage
<dd>Automatic scrolling. Same as ScrTimer, but
increment by page size.</dl>
\param p point where the mouse was pressed
\retval scrollMode The scrolling mode
\retval direction direction: 1, 0, or -1.
*/ */
virtual void getScrollMode( const QPoint &p, virtual double scrolledTo( const QPoint &pos ) const = 0;
int &scrollMode, int &direction) = 0;
void incrementValue( int numSteps );
void setMouseOffset(double); virtual void scaleChange();
double mouseOffset() const;
protected:
virtual void sliderChange();
int scrollMode() const; double incrementedValue(
double value, int stepCount ) const;
private: private:
void buttonReleased(); double alignedValue( double ) const;
double boundedValue( double ) const;
class PrivateData; class PrivateData;
PrivateData *d_data; PrivateData *d_data;
......
...@@ -8,69 +8,94 @@ ...@@ -8,69 +8,94 @@
*****************************************************************************/ *****************************************************************************/
#include "qwt_analog_clock.h" #include "qwt_analog_clock.h"
#include "qwt_round_scale_draw.h"
#include <qmath.h>
#include <qlocale.h>
/*! class QwtAnalogClockScaleDraw: public QwtRoundScaleDraw
Constructor
\param parent Parent widget
*/
QwtAnalogClock::QwtAnalogClock(QWidget *parent):
QwtDial(parent)
{ {
initClock(); public:
} QwtAnalogClockScaleDraw()
{
setSpacing( 8 );
enableComponent( QwtAbstractScaleDraw::Backbone, false );
setTickLength( QwtScaleDiv::MinorTick, 2 );
setTickLength( QwtScaleDiv::MediumTick, 4 );
setTickLength( QwtScaleDiv::MajorTick, 8 );
setPenWidth( 1 );
}
virtual QwtText label( double value ) const
{
if ( qFuzzyCompare( value + 1.0, 1.0 ) )
value = 60.0 * 60.0 * 12.0;
return QLocale().toString( qRound( value / ( 60.0 * 60.0 ) ) );
}
};
#if QT_VERSION < 0x040000
/*! /*!
Constructor Constructor
\param parent Parent widget \param parent Parent widget
\param name Object name
*/ */
QwtAnalogClock::QwtAnalogClock(QWidget* parent, const char *name): QwtAnalogClock::QwtAnalogClock( QWidget *parent ):
QwtDial(parent, name) QwtDial( parent )
{ {
initClock(); setWrapping( true );
} setReadOnly( true );
#endif
void QwtAnalogClock::initClock() setOrigin( 270.0 );
{ setScaleDraw( new QwtAnalogClockScaleDraw() );
setWrapping(true);
setReadOnly(true); setTotalSteps( 60 );
const int secondsPerHour = 60.0 * 60.0;
setOrigin(270.0); QList<double> majorTicks;
setRange(0.0, 60.0 * 60.0 * 12.0); // seconds QList<double> minorTicks;
setScale(-1, 5, 60.0 * 60.0);
setScaleOptions(ScaleTicks | ScaleLabel); for ( int i = 0; i < 12; i++ )
setScaleTicks(1, 0, 8); {
scaleDraw()->setSpacing(8); majorTicks += i * secondsPerHour;
QColor knobColor = for ( int j = 1; j < 5; j++ )
#if QT_VERSION < 0x040000 minorTicks += i * secondsPerHour + j * secondsPerHour / 5.0;
palette().color(QPalette::Active, QColorGroup::Text); }
#else
palette().color(QPalette::Active, QPalette::Text); QwtScaleDiv scaleDiv;
#endif scaleDiv.setInterval( 0.0, 12.0 * secondsPerHour );
knobColor = knobColor.dark(120); scaleDiv.setTicks( QwtScaleDiv::MajorTick, majorTicks );
scaleDiv.setTicks( QwtScaleDiv::MinorTick, minorTicks );
setScale( scaleDiv );
QColor knobColor = palette().color( QPalette::Active, QPalette::Text );
knobColor = knobColor.dark( 120 );
QColor handColor; QColor handColor;
int width; int width;
for ( int i = 0; i < NHands; i++ ) { for ( int i = 0; i < NHands; i++ )
if ( i == SecondHand ) { {
if ( i == SecondHand )
{
width = 2; width = 2;
handColor = knobColor.dark(120); handColor = knobColor.dark( 120 );
} else { }
else
{
width = 8; width = 8;
handColor = knobColor; handColor = knobColor;
} }
QwtDialSimpleNeedle *hand = new QwtDialSimpleNeedle( QwtDialSimpleNeedle *hand = new QwtDialSimpleNeedle(
QwtDialSimpleNeedle::Arrow, true, handColor, knobColor); QwtDialSimpleNeedle::Arrow, true, handColor, knobColor );
hand->setWidth(width); hand->setWidth( width );
d_hand[i] = NULL; d_hand[i] = NULL;
setHand((Hand)i, hand); setHand( static_cast<Hand>( i ), hand );
} }
} }
...@@ -82,24 +107,25 @@ QwtAnalogClock::~QwtAnalogClock() ...@@ -82,24 +107,25 @@ QwtAnalogClock::~QwtAnalogClock()
} }
/*! /*!
Nop method, use setHand instead Nop method, use setHand() instead
\sa QwtAnalogClock::setHand \sa setHand()
*/ */
void QwtAnalogClock::setNeedle(QwtDialNeedle *) void QwtAnalogClock::setNeedle( QwtDialNeedle * )
{ {
// no op // no op
return; return;
} }
/*! /*!
Set a clockhand Set a clock hand
\param hand Specifies the type of hand \param hand Specifies the type of hand
\param needle Hand \param needle Hand
\sa QwtAnalogClock::hand() \sa hand()
*/ */
void QwtAnalogClock::setHand(Hand hand, QwtDialNeedle *needle) void QwtAnalogClock::setHand( Hand hand, QwtDialNeedle *needle )
{ {
if ( hand >= 0 || hand < NHands ) { if ( hand >= 0 && hand < NHands )
{
delete d_hand[hand]; delete d_hand[hand];
d_hand[hand] = needle; d_hand[hand] = needle;
} }
...@@ -108,9 +134,9 @@ void QwtAnalogClock::setHand(Hand hand, QwtDialNeedle *needle) ...@@ -108,9 +134,9 @@ void QwtAnalogClock::setHand(Hand hand, QwtDialNeedle *needle)
/*! /*!
\return Clock hand \return Clock hand
\param hd Specifies the type of hand \param hd Specifies the type of hand
\sa QwtAnalogClock::setHand \sa setHand()
*/ */
QwtDialNeedle *QwtAnalogClock::hand(Hand hd) QwtDialNeedle *QwtAnalogClock::hand( Hand hd )
{ {
if ( hd < 0 || hd >= NHands ) if ( hd < 0 || hd >= NHands )
return NULL; return NULL;
...@@ -121,81 +147,75 @@ QwtDialNeedle *QwtAnalogClock::hand(Hand hd) ...@@ -121,81 +147,75 @@ QwtDialNeedle *QwtAnalogClock::hand(Hand hd)
/*! /*!
\return Clock hand \return Clock hand
\param hd Specifies the type of hand \param hd Specifies the type of hand
\sa QwtAnalogClock::setHand \sa setHand()
*/ */
const QwtDialNeedle *QwtAnalogClock::hand(Hand hd) const const QwtDialNeedle *QwtAnalogClock::hand( Hand hd ) const
{ {
return ((QwtAnalogClock *)this)->hand(hd); return const_cast<QwtAnalogClock *>( this )->hand( hd );
} }
/*! /*!
\brief Set the current time \brief Set the current time
This is the same as QwtAnalogClock::setTime(), but Qt < 3.0
can't handle default parameters for slots.
*/ */
void QwtAnalogClock::setCurrentTime() void QwtAnalogClock::setCurrentTime()
{ {
setTime(QTime::currentTime()); setTime( QTime::currentTime() );
} }
/*! /*!
Set a time Set a time
\param time Time to display \param time Time to display
*/ */
void QwtAnalogClock::setTime(const QTime &time) void QwtAnalogClock::setTime( const QTime &time )
{
if ( time.isValid() ) {
setValue((time.hour() % 12) * 60.0 * 60.0
+ time.minute() * 60.0 + time.second());
} else
setValid(false);
}
/*!
Find the scale label for a given value
\param value Value
\return Label
*/
QwtText QwtAnalogClock::scaleLabel(double value) const
{ {
if ( value == 0.0 ) if ( time.isValid() )
value = 60.0 * 60.0 * 12.0; {
setValue( ( time.hour() % 12 ) * 60.0 * 60.0
return QString::number(int(value / (60.0 * 60.0))); + time.minute() * 60.0 + time.second() );
}
else
setValid( false );
} }
/*! /*!
\brief Draw the needle \brief Draw the needle
A clock has no single needle but three hands instead. drawNeedle A clock has no single needle but three hands instead. drawNeedle()
translates value() into directions for the hands and calls translates value() into directions for the hands and calls
drawHand(). drawHand().
\param painter Painter \param painter Painter
\param center Center of the clock \param center Center of the clock
\param radius Maximum length for the hands \param radius Maximum length for the hands
\param direction Dummy, not used. \param dir Dummy, not used.
\param cg ColorGroup \param colorGroup ColorGroup
\sa QwtAnalogClock::drawHand() \sa drawHand()
*/ */
void QwtAnalogClock::drawNeedle(QPainter *painter, const QPoint &center, void QwtAnalogClock::drawNeedle( QPainter *painter, const QPointF &center,
int radius, double, QPalette::ColorGroup cg) const double radius, double dir, QPalette::ColorGroup colorGroup ) const
{ {
if ( isValid() ) { Q_UNUSED( dir );
const double hours = value() / (60.0 * 60.0);
const double minutes = (value() - (int)hours * 60.0 * 60.0) / 60.0; if ( isValid() )
const double seconds = value() - (int)hours * 60.0 * 60.0 {
- (int)minutes * 60.0; const double hours = value() / ( 60.0 * 60.0 );
const double minutes =
drawHand(painter, HourHand, center, radius, ( value() - qFloor(hours) * 60.0 * 60.0 ) / 60.0;
360.0 - (origin() + 360.0 * hours / 12.0), cg); const double seconds = value() - qFloor(hours) * 60.0 * 60.0
drawHand(painter, MinuteHand, center, radius, - qFloor(minutes) * 60.0;
360.0 - (origin() + 360.0 * minutes / 60.0), cg);
drawHand(painter, SecondHand, center, radius, double angle[NHands];
360.0 - (origin() + 360.0 * seconds / 60.0), cg); angle[HourHand] = 360.0 * hours / 12.0;
angle[MinuteHand] = 360.0 * minutes / 60.0;
angle[SecondHand] = 360.0 * seconds / 60.0;
for ( int hand = 0; hand < NHands; hand++ )
{
const double d = 360.0 - angle[hand] - origin();
drawHand( painter, static_cast<Hand>( hand ),
center, radius, d, colorGroup );
}
} }
} }
...@@ -209,15 +229,16 @@ void QwtAnalogClock::drawNeedle(QPainter *painter, const QPoint &center, ...@@ -209,15 +229,16 @@ void QwtAnalogClock::drawNeedle(QPainter *painter, const QPoint &center,
\param direction Direction of the hand in degrees, counter clockwise \param direction Direction of the hand in degrees, counter clockwise
\param cg ColorGroup \param cg ColorGroup
*/ */
void QwtAnalogClock::drawHand(QPainter *painter, Hand hd, void QwtAnalogClock::drawHand( QPainter *painter, Hand hd,
const QPoint &center, int radius, double direction, const QPointF &center, double radius, double direction,
QPalette::ColorGroup cg) const QPalette::ColorGroup cg ) const
{ {
const QwtDialNeedle *needle = hand(hd); const QwtDialNeedle *needle = hand( hd );
if ( needle ) { if ( needle )
{
if ( hd == HourHand ) if ( hd == HourHand )
radius = qRound(0.8 * radius); radius = qRound( 0.8 * radius );
needle->draw(painter, center, radius, direction, cg); needle->draw( painter, center, radius, direction, cg );
} }
} }
...@@ -10,10 +10,10 @@ ...@@ -10,10 +10,10 @@
#ifndef QWT_ANALOG_CLOCK_H #ifndef QWT_ANALOG_CLOCK_H
#define QWT_ANALOG_CLOCK_H #define QWT_ANALOG_CLOCK_H
#include <qdatetime.h>
#include "qwt_global.h" #include "qwt_global.h"
#include "qwt_dial.h" #include "qwt_dial.h"
#include "qwt_dial_needle.h" #include "qwt_dial_needle.h"
#include <qdatetime.h>
/*! /*!
\brief An analog clock \brief An analog clock
...@@ -21,7 +21,8 @@ ...@@ -21,7 +21,8 @@
\image html analogclock.png \image html analogclock.png
\par Example \par Example
\verbatim #include <qwt_analog_clock.h> \code
#include <qwt_analog_clock.h>
QwtAnalogClock *clock = new QwtAnalogClock(...); QwtAnalogClock *clock = new QwtAnalogClock(...);
clock->scaleDraw()->setPenWidth(3); clock->scaleDraw()->setPenWidth(3);
...@@ -34,10 +35,7 @@ ...@@ -34,10 +35,7 @@
timer->connect(timer, SIGNAL(timeout()), clock, SLOT(setCurrentTime())); timer->connect(timer, SIGNAL(timeout()), clock, SLOT(setCurrentTime()));
timer->start(1000); timer->start(1000);
\endverbatim \endcode
Qwt is missing a set of good looking hands.
Contributions are very welcome.
\note The examples/dials example shows how to use QwtAnalogClock. \note The examples/dials example shows how to use QwtAnalogClock.
*/ */
...@@ -51,41 +49,43 @@ public: ...@@ -51,41 +49,43 @@ public:
Hand type Hand type
\sa setHand(), hand() \sa setHand(), hand()
*/ */
enum Hand
enum Hand { {
//! Needle displaying the seconds
SecondHand, SecondHand,
//! Needle displaying the minutes
MinuteHand, MinuteHand,
//! Needle displaying the hours
HourHand, HourHand,
//! Number of needles
NHands NHands
}; };
explicit QwtAnalogClock(QWidget* parent = NULL); explicit QwtAnalogClock( QWidget* parent = NULL );
#if QT_VERSION < 0x040000
explicit QwtAnalogClock(QWidget* parent, const char *name);
#endif
virtual ~QwtAnalogClock(); virtual ~QwtAnalogClock();
virtual void setHand(Hand, QwtDialNeedle *); void setHand( Hand, QwtDialNeedle * );
const QwtDialNeedle *hand(Hand) const;
QwtDialNeedle *hand(Hand);
public slots: const QwtDialNeedle *hand( Hand ) const;
QwtDialNeedle *hand( Hand );
public Q_SLOTS:
void setCurrentTime(); void setCurrentTime();
void setTime(const QTime & = QTime::currentTime()); void setTime( const QTime & );
protected: protected:
virtual QwtText scaleLabel(double) const; virtual void drawNeedle( QPainter *, const QPointF &,
double radius, double direction, QPalette::ColorGroup ) const;
virtual void drawNeedle(QPainter *, const QPoint &,
int radius, double direction, QPalette::ColorGroup) const;
virtual void drawHand(QPainter *, Hand, const QPoint &, virtual void drawHand( QPainter *, Hand, const QPointF &,
int radius, double direction, QPalette::ColorGroup) const; double radius, double direction, QPalette::ColorGroup ) const;
private: private:
virtual void setNeedle(QwtDialNeedle *); // use setHand instead
void initClock(); void setNeedle( QwtDialNeedle * );
QwtDialNeedle *d_hand[NHands]; QwtDialNeedle *d_hand[NHands];
}; };
......
This diff is collapsed.
...@@ -10,8 +10,8 @@ ...@@ -10,8 +10,8 @@
#ifndef QWT_ARROW_BUTTON_H #ifndef QWT_ARROW_BUTTON_H
#define QWT_ARROW_BUTTON_H #define QWT_ARROW_BUTTON_H
#include <qpushbutton.h>
#include "qwt_global.h" #include "qwt_global.h"
#include <qpushbutton.h>
/*! /*!
\brief Arrow Button \brief Arrow Button
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
class QWT_EXPORT QwtArrowButton : public QPushButton class QWT_EXPORT QwtArrowButton : public QPushButton
{ {
public: public:
explicit QwtArrowButton (int num, Qt::ArrowType, QWidget *parent = NULL); explicit QwtArrowButton ( int num, Qt::ArrowType, QWidget *parent = NULL );
virtual ~QwtArrowButton(); virtual ~QwtArrowButton();
Qt::ArrowType arrowType() const; Qt::ArrowType arrowType() const;
...@@ -33,18 +33,16 @@ public: ...@@ -33,18 +33,16 @@ public:
virtual QSize minimumSizeHint() const; virtual QSize minimumSizeHint() const;
protected: protected:
#if QT_VERSION >= 0x040000 virtual void paintEvent( QPaintEvent *event );
virtual void paintEvent(QPaintEvent *event);
#endif
virtual void drawButtonLabel(QPainter *p); virtual void drawButtonLabel( QPainter *p );
virtual void drawArrow(QPainter *, virtual void drawArrow( QPainter *,
const QRect &, Qt::ArrowType) const; const QRect &, Qt::ArrowType ) const;
virtual QRect labelRect() const; virtual QRect labelRect() const;
virtual QSize arrowSize(Qt::ArrowType, virtual QSize arrowSize( Qt::ArrowType,
const QSize &boundingSize) const; const QSize &boundingSize ) const;
virtual void keyPressEvent(QKeyEvent *); virtual void keyPressEvent( QKeyEvent * );
private: private:
class PrivateData; class PrivateData;
......
This diff is collapsed.
...@@ -11,27 +11,30 @@ ...@@ -11,27 +11,30 @@
#define QWT_CLIPPER_H #define QWT_CLIPPER_H
#include "qwt_global.h" #include "qwt_global.h"
#include "qwt_array.h" #include "qwt_interval.h"
#include "qwt_polygon.h" #include <qpolygon.h>
#include "qwt_double_rect.h" #include <qvector.h>
#include "qwt_double_interval.h"
class QRect; class QRect;
class QRectF;
/*! /*!
\brief Some clipping algos \brief Some clipping algorithms
*/ */
class QWT_EXPORT QwtClipper class QWT_EXPORT QwtClipper
{ {
public: public:
static QwtPolygon clipPolygon(const QRect &, const QwtPolygon &); static QPolygon clipPolygon( const QRect &,
static QwtPolygonF clipPolygonF(const QwtDoubleRect &, const QwtPolygonF &); const QPolygon &, bool closePolygon = false );
static QPolygon clipPolygon( const QRectF &,
const QPolygon &, bool closePolygon = false );
#if QT_VERSION >= 0x040000 static QPolygonF clipPolygonF( const QRectF &,
static QwtArray<QwtDoubleInterval> clipCircle( const QPolygonF &, bool closePolygon = false );
const QwtDoubleRect &, const QwtDoublePoint &, double radius);
#endif static QVector<QwtInterval> clipCircle(
const QRectF &, const QPointF &, double radius );
}; };
#endif #endif
This diff is collapsed.
...@@ -10,21 +10,10 @@ ...@@ -10,21 +10,10 @@
#ifndef QWT_COLOR_MAP_H #ifndef QWT_COLOR_MAP_H
#define QWT_COLOR_MAP_H #define QWT_COLOR_MAP_H
#include <qglobal.h> #include "qwt_global.h"
#include "qwt_interval.h"
#include <qcolor.h> #include <qcolor.h>
#if QT_VERSION < 0x040000
#include <qvaluevector.h>
#else
#include <qvector.h> #include <qvector.h>
#endif
#include "qwt_array.h"
#include "qwt_double_interval.h"
#if defined(QWT_TEMPLATEDLL)
// MOC_SKIP_BEGIN
template class QWT_EXPORT QwtArray<double>;
// MOC_SKIP_END
#endif
/*! /*!
\brief QwtColorMap is used to map values into colors. \brief QwtColorMap is used to map values into colors.
...@@ -45,67 +34,60 @@ class QWT_EXPORT QwtColorMap ...@@ -45,67 +34,60 @@ class QWT_EXPORT QwtColorMap
{ {
public: public:
/*! /*!
- RGB\n Format for color mapping
The map is intended to map into QRgb values.
- Indexed\n
The map is intended to map into 8 bit values, that
are indices into the color table.
\sa rgb(), colorIndex(), colorTable() \sa rgb(), colorIndex(), colorTable()
*/ */
enum Format { enum Format
{
//! The map is intended to map into RGB values.
RGB, RGB,
/*!
The map is intended to map into 8 bit values, that
are indices into the color table.
*/
Indexed Indexed
}; };
QwtColorMap(Format = QwtColorMap::RGB ); QwtColorMap( Format = QwtColorMap::RGB );
virtual ~QwtColorMap(); virtual ~QwtColorMap();
inline Format format() const; Format format() const;
//! Clone the color map
virtual QwtColorMap *copy() const = 0;
/*! /*!
Map a value of a given interval into a rgb value. Map a value of a given interval into a RGB value.
\param interval Range for the values \param interval Range for the values
\param value Value \param value Value
\return rgb value, corresponding to value \return RGB value, corresponding to value
*/ */
virtual QRgb rgb( virtual QRgb rgb( const QwtInterval &interval,
const QwtDoubleInterval &interval, double value) const = 0; double value ) const = 0;
/*! /*!
Map a value of a given interval into a color index Map a value of a given interval into a color index
\param interval Range for the values \param interval Range for the values
\param value Value \param value Value
\return color index, corresponding to value \return color index, corresponding to value
*/ */
virtual unsigned char colorIndex( virtual unsigned char colorIndex(
const QwtDoubleInterval &interval, double value) const = 0; const QwtInterval &interval, double value ) const = 0;
QColor color(const QwtDoubleInterval &, double value) const; QColor color( const QwtInterval &, double value ) const;
#if QT_VERSION < 0x040000 virtual QVector<QRgb> colorTable( const QwtInterval & ) const;
virtual QValueVector<QRgb> colorTable(const QwtDoubleInterval &) const;
#else
virtual QVector<QRgb> colorTable(const QwtDoubleInterval &) const;
#endif
private: private:
Format d_format; Format d_format;
}; };
/*! /*!
\brief QwtLinearColorMap builds a color map from color stops. \brief QwtLinearColorMap builds a color map from color stops.
A color stop is a color at a specific position. The valid A color stop is a color at a specific position. The valid
range for the positions is [0.0, 1.0]. When mapping a value range for the positions is [0.0, 1.0]. When mapping a value
into a color it is translated into this interval. If into a color it is translated into this interval according to mode().
mode() == FixedColors the color is calculated from the next lower
color stop. If mode() == ScaledColors the color is calculated
by interpolating the colors of the adjacent stops.
*/ */
class QWT_EXPORT QwtLinearColorMap: public QwtColorMap class QWT_EXPORT QwtLinearColorMap: public QwtColorMap
{ {
...@@ -114,67 +96,66 @@ public: ...@@ -114,67 +96,66 @@ public:
Mode of color map Mode of color map
\sa setMode(), mode() \sa setMode(), mode()
*/ */
enum Mode { enum Mode
{
//! Return the color from the next lower color stop
FixedColors, FixedColors,
//! Interpolating the colors of the adjacent stops.
ScaledColors ScaledColors
}; };
QwtLinearColorMap(QwtColorMap::Format = QwtColorMap::RGB); QwtLinearColorMap( QwtColorMap::Format = QwtColorMap::RGB );
QwtLinearColorMap( const QColor &from, const QColor &to, QwtLinearColorMap( const QColor &from, const QColor &to,
QwtColorMap::Format = QwtColorMap::RGB); QwtColorMap::Format = QwtColorMap::RGB );
QwtLinearColorMap(const QwtLinearColorMap &);
virtual ~QwtLinearColorMap(); virtual ~QwtLinearColorMap();
QwtLinearColorMap &operator=(const QwtLinearColorMap &); void setMode( Mode );
virtual QwtColorMap *copy() const;
void setMode(Mode);
Mode mode() const; Mode mode() const;
void setColorInterval(const QColor &color1, const QColor &color2); void setColorInterval( const QColor &color1, const QColor &color2 );
void addColorStop(double value, const QColor&); void addColorStop( double value, const QColor& );
QwtArray<double> colorStops() const; QVector<double> colorStops() const;
QColor color1() const; QColor color1() const;
QColor color2() const; QColor color2() const;
virtual QRgb rgb(const QwtDoubleInterval &, double value) const; virtual QRgb rgb( const QwtInterval &, double value ) const;
virtual unsigned char colorIndex( virtual unsigned char colorIndex(
const QwtDoubleInterval &, double value) const; const QwtInterval &, double value ) const;
class ColorStops; class ColorStops;
private: private:
// Disabled copy constructor and operator=
QwtLinearColorMap( const QwtLinearColorMap & );
QwtLinearColorMap &operator=( const QwtLinearColorMap & );
class PrivateData; class PrivateData;
PrivateData *d_data; PrivateData *d_data;
}; };
/*! /*!
\brief QwtAlphaColorMap variies the alpha value of a color \brief QwtAlphaColorMap varies the alpha value of a color
*/ */
class QWT_EXPORT QwtAlphaColorMap: public QwtColorMap class QWT_EXPORT QwtAlphaColorMap: public QwtColorMap
{ {
public: public:
QwtAlphaColorMap(const QColor & = QColor(Qt::gray)); QwtAlphaColorMap( const QColor & = QColor( Qt::gray ) );
QwtAlphaColorMap(const QwtAlphaColorMap &);
virtual ~QwtAlphaColorMap(); virtual ~QwtAlphaColorMap();
QwtAlphaColorMap &operator=(const QwtAlphaColorMap &); void setColor( const QColor & );
virtual QwtColorMap *copy() const;
void setColor(const QColor &);
QColor color() const; QColor color() const;
virtual QRgb rgb(const QwtDoubleInterval &, double value) const; virtual QRgb rgb( const QwtInterval &, double value ) const;
private: private:
QwtAlphaColorMap( const QwtAlphaColorMap & );
QwtAlphaColorMap &operator=( const QwtAlphaColorMap & );
virtual unsigned char colorIndex( virtual unsigned char colorIndex(
const QwtDoubleInterval &, double value) const; const QwtInterval &, double value ) const;
class PrivateData; class PrivateData;
PrivateData *d_data; PrivateData *d_data;
...@@ -194,13 +175,16 @@ private: ...@@ -194,13 +175,16 @@ private:
color table once and find the color using colorIndex(). color table once and find the color using colorIndex().
*/ */
inline QColor QwtColorMap::color( inline QColor QwtColorMap::color(
const QwtDoubleInterval &interval, double value) const const QwtInterval &interval, double value ) const
{ {
if ( d_format == RGB ) { if ( d_format == RGB )
return QColor( rgb(interval, value) ); {
} else { return QColor( rgb( interval, value ) );
const unsigned int index = colorIndex(interval, value); }
return colorTable(interval)[index]; // slow else
{
const unsigned int index = colorIndex( interval, value );
return colorTable( interval )[index]; // slow
} }
} }
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
* Qwt Widget Library
* Copyright (C) 1997 Josef Wilgen
* Copyright (C) 2002 Uwe Rathmann
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the Qwt License, Version 1.0
*****************************************************************************/
#ifndef _QWT_COMPAT_H_
#define _QWT_COMPAT_H_
#include "qwt_global.h"
#include "qwt_interval.h"
#include "qwt_point_3d.h"
#include <qlist.h>
#include <qvector.h>
#include <qpoint.h>
#include <qsize.h>
#include <qrect.h>
#include <qpolygon.h>
// A couple of definition for Qwt5 compatibility
#define qwtMax qMax
#define qwtMin qMin
#define qwtAbs qAbs
#define qwtRound qRound
#define QwtArray QVector
typedef QList<double> QwtValueList;
typedef QPointF QwtDoublePoint;
typedef QSizeF QwtDoubleSize;
typedef QRectF QwtDoubleRect;
typedef QPolygon QwtPolygon;
typedef QPolygonF QwtPolygonF;
typedef QwtInterval QwtDoubleInterval;
typedef QwtPoint3D QwtDoublePoint3D;
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment