27th Oct 2016 SVG graphics and .NET 4.6

Discussions about the preview versions of Virtual Radar Server.
Forum rules
Please bear in mind if you do install a preview version that it is unfinished code, there may be bugs, bits missing, things that don't work etc.

Posts in this forum will not show up in forum search results. Old threads will be pruned occasionally.
agw
Posts: 1883
Joined: Fri Feb 17, 2012 3:20 am

27th Oct 2016 SVG graphics and .NET 4.6

Postby agw » Fri Oct 28, 2016 1:05 am

This preview introduces SVG aircraft markers and a move from .NET 3.5 (which ships with Windows 7) to .NET 4.6 (which ships with Windows 10 but will run on anything later than XP). The installer is smaller because it doesn't contain the .NET web installer any more. If you try to run the program and you don't have .NET 4.6 installed then you should get a prompt telling you how to get the .NET 4.6 installer. I'm not 100% sure on that though, I need to try it on some different versions of Windows.

The upgrade to 4.6 means that if you are running Mono and you have a VirtualRadar.exe.config to fix the Mono SQLite v4 error that the old versions threw on startup then you should remove the .config file, it's no longer required.

There is no .NET 4.6 for Windows XP, so if you're running XP then do not install this version. The current release version will be the last one that runs on XP.

The SVG graphics have three benefits over the old system:

1. The graphics are drawn by the browser, not by the server. It reduces the workload on the server.
2. SVG is an XML format and can be manipulated by the JavaScript that builds it, which means that you can change the colours of the aircraft markers to match whatever conditions you like (as opposed to the current selected / not selected colours).
3. The appearance of text on markers should now be consistent between Windows and Linux installations. Linux installations have a hard time drawing text on graphics so they had to use labels under the marker, which never looked very good.

The downsides with SVG are:

1. It increases the workload on the browser.
2. Older browsers can't draw SVG. The intention is to support a a fallback to server-drawn markers when the site is running on old browsers but that's not in place yet. The 5th November preview adds support for falling back to bitmap markers when the browser doesn't support SVG.
3. The server would automatically scale the font for long strings so that they would still fit in the marker. I haven't figured out a way to reproduce this in SVG so if you have long text in the marker it will get clipped.

I've tested the SVG markers on Chrome, Firefox, Edge, IE11 and iOS9 mobile Safari and so far they're holding up, albeit with some small differences between them.

Not all of the markers have got SVG versions in place yet. If you added your own markers then they'll continue to work, it's just that the text will look different because it's coming from the server or a marker label.

There are some new global options to control the generation of the SVG:

  • aircraftMarkerUseSvg (boolean, default = true) -- Set to false to switch SVG off entirely (Removed - SVG can now be switched off in Tools | Options | Web Site)
  • svgAircraftMarkerSelectedFill (CSS colour string, default #FFFF00) -- The fill colour of the selected aircraft marker.
  • svgAircraftMarkerNormalFill (CSS colour string, default #FFFFFF) -- The fill colour of the not-selected aircraft marker.
  • svgAircraftMarkerAltitudeLineStroke (CSS colour string, default #000) - The colour of the altitude stalk
  • svgAircraftMarkerAltitudeLineWidth (number, default 1) - The width of the altitude stalk
  • svgAircraftMarkerTextShadowFilterXml (string, SVG XML) - The <filter> tag that is applied to add shadow to the text on the marker. It must have an id of "vrs-text-shadow-filter". Set to an empty string to remove the filter entirely.
  • svgAircraftMarkerTextStyle (JavaScript object) - An object with properties named after SVG style attributes (illegal JavaScript names such as font-family need to be in quotes) and values that control the appearance of the marker's text

At the moment the default svgAircraftMarkerTextStyle is this but it could change before release:

Code: Select all

{
    'font-family': 'Roboto, Sans-Serif',
    'font-size': '8pt',
    'font-weight': '700',
    'fill': '#FFFFFF'
}


If you are adding custom markers and you want to add SVG support then you need to add a field called embeddedSvg to your marker object that should point to an object with two properties:

Code: Select all

svg - a string that contains the SVG. Don't include the <xml> tag at the start of the SVG.
aircraftMarkerStatusFillPaths: An optional array of IDs of paths in the SVG that should be filled with colour to denote the status of the aircraft.


You can see examples of embedded SVG objects here: https://github.com/vradarserver/vrs/blob/master/VirtualRadar.WebSite/Site/Web/script/vrs/embeddedSvgs.ts
and the JavaScript that the TS compiles down to here: https://github.com/vradarserver/vrs/blob/master/VirtualRadar.WebSite/Site/Web/script/vrs/embeddedSvgs.js

If you want to use marker colours to denote different aircraft states (other than selected / not selected) then at the moment there's no easy way to hook your code in for that. It'll be coming in a future preview.

DeWoert
Posts: 35
Joined: Mon Feb 29, 2016 9:36 pm

Re: 27th Oct 2016 SVG graphics and .NET 4.6

Postby DeWoert » Sat Oct 29, 2016 11:53 pm

Like the new svg option, but in the meantime I have one question:
Since i'm using custom markers at the moment, the MarkerTextStyle on those is still the "old" way.
Is there a solution to get the "new" MarkerTextStyle on the (old-style) CustomMarkers ?

Pidea
Posts: 12
Joined: Wed Apr 29, 2015 5:27 pm
Contact:

Re: 27th Oct 2016 SVG graphics and .NET 4.6

Postby Pidea » Sun Oct 30, 2016 9:38 am

Hi Andrew, I've just installed the x64 version on a Windows Server 2012 R2 machine with all the plugins but after restarting VRS none of the plugins show up in the Tools > Plugins dialogue box.

The 32-bit version woks fine which is odd.

agw
Posts: 1883
Joined: Fri Feb 17, 2012 3:20 am

Re: 27th Oct 2016 SVG graphics and .NET 4.6

Postby agw » Mon Oct 31, 2016 9:46 pm

DeWoert wrote:Like the new svg option, but in the meantime I have one question:
Since i'm using custom markers at the moment, the MarkerTextStyle on those is still the "old" way.
Is there a solution to get the "new" MarkerTextStyle on the (old-style) CustomMarkers ?


For various reasons it's not easy to add the SVG text to a bitmap marker or make the bitmap marker text look exactly like the SVG text. However, one approach could be to draw the bitmap font as an image layer in a generated SVG and then after that it's just another SVG. I'll take a look into it.

EDIT 06-Nov: I took a look into it and I can't really do it. The problem is that SVG images are a single image that gets rotated and then one or more paths are filled with a colour to indicate the aircraft's status. Adding an image layer into the SVG and then rotating it shouldn't be a problem but there's no way for me to fill the image with the status colour.

However, in the latest update I added support for switching SVGs off in the options (Tools | Options | Web Site), if you have custom markers and you can't produce SVG versions of them then you can just switch SVG off.

agw
Posts: 1883
Joined: Fri Feb 17, 2012 3:20 am

Re: 27th Oct 2016 SVG graphics and .NET 4.6

Postby agw » Mon Oct 31, 2016 9:48 pm

Pidea wrote:Hi Andrew, I've just installed the x64 version on a Windows Server 2012 R2 machine with all the plugins but after restarting VRS none of the plugins show up in the Tools > Plugins dialogue box.

The 32-bit version woks fine which is odd.


The plugin installers remember their last installation folder. My guess is that they're all installing into C:\Program Files (x86)\VirtualRadar instead of C:\Program Files\VirtualRadar.

The 32-bit installer installs to (x86) by default whereas the 64-bit doesn't. Each installation has its own set of plugins, they're in a folder under the installation folder.

andrew
Posts: 20
Joined: Sat Apr 26, 2014 10:31 am

Re: 27th Oct 2016 SVG graphics and .NET 4.6

Postby andrew » Tue Nov 01, 2016 9:48 am

Hi, I'm using VRS on my Raspberry Pi 3 since march, it runs great.
Today i wanted to try preview version, but it throws an error.

This is the log:

Code: Select all

[2016-11-01 09:41:07.626 UTC] [t1] Caught exception loading plugin /home/pi/virtualradar/Plugins/WebAdmin/VirtualRadar.Plugin.WebAdmin.dll: <<TOP LEVEL>>: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.MissingMethodException: Method not found: 'System.Array.Empty'.
  at VirtualRadar.Plugin.WebAdmin.Options..ctor () [0x00000] in <filename unknown>:0
  at VirtualRadar.Plugin.WebAdmin.Plugin..ctor () [0x00000] in <filename unknown>:0
  at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (System.Reflection.MonoCMethod,object,object[],System.Exception&)
  at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00000] in <filename unknown>:0
  --- End of inner exception stack trace ---
  at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00000] in <filename unknown>:0
  at System.Activator.CreateInstance (System.Type type, Boolean nonPublic) [0x00000] in <filename unknown>:0
  at System.Activator.CreateInstance (System.Type type) [0x00000] in <filename unknown>:0
  at VirtualRadar.Library.PluginManager.LoadPlugins () [0x00000] in <filename unknown>:0
<<INNER>>: System.MissingMethodException: Method not found: 'System.Array.Empty'.
  at VirtualRadar.Plugin.WebAdmin.Options..ctor () [0x00000] in <filename unknown>:0
  at VirtualRadar.Plugin.WebAdmin.Plugin..ctor () [0x00000] in <filename unknown>:0
  at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (System.Reflection.MonoCMethod,object,object[],System.Exception&)
  at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00000] in <filename unknown>:0

[2016-11-01 09:41:07.695 UTC] [t1] Program started, version 2.4.0.41476, build date 27/10/2016 22:02:32 UTC
[2016-11-01 09:41:07.696 UTC] [t1] Working folder /home/pi/.local/share/VirtualRadar
[2016-11-01 09:41:07.729 UTC] [t1] System.MissingMethodException: Method not found: 'System.Array.Empty'.
  at VirtualRadar.Interface.Settings.BaseStationSettings..ctor () [0x00000] in <filename unknown>:0
  at VirtualRadar.Interface.Settings.Configuration..ctor () [0x00000] in <filename unknown>:0
  at VirtualRadar.Library.Presenter.SplashPresenter.LoadConfiguration (IConfigurationStorage configurationStorage) [0x00000] in <filename unknown>:0
  at VirtualRadar.Library.Presenter.SplashPresenter.StartApplication () [0x00000] in <filename unknown>:0
  at VirtualRadar.Headless.View.SplashView.ShowView () [0x00000] in <filename unknown>:0
  at VirtualRadar.Program.StartApplication (System.String[] args) [0x00000] in <filename unknown>:0
  at VirtualRadar.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0


I use 3 plugins (all preview versions): WebAdmin, Database editor, Database writer. Any ideas? Thanks!

andrew
Posts: 20
Joined: Sat Apr 26, 2014 10:31 am

Re: 27th Oct 2016 SVG graphics and .NET 4.6

Postby andrew » Tue Nov 01, 2016 11:11 am

OK I get it: on Raspbian the default MONO version is 3.2.8 (using sudo apt-get install mono-complete).
This is unable to run the new preview version of VRS, so I removed the old mono installation and followed the instruction on the official mono site: http://www.mono-project.com/docs/gettin ... all/linux/
Now I got the last mono on my Pi3 and the preview version runs fine!

Hope this helps...

dsfh2992
Posts: 153
Joined: Tue Oct 06, 2015 9:57 pm

Re: 27th Oct 2016 SVG graphics and .NET 4.6

Postby dsfh2992 » Wed Nov 02, 2016 12:26 am

What sort of reduction in CPU utilization would we expect to see with this preview version vs. 2.4.0 for a site with tons of viewers?

egpd1701
Posts: 43
Joined: Fri Nov 08, 2013 3:39 pm

Re: 27th Oct 2016 SVG graphics and .NET 4.6

Postby egpd1701 » Fri Nov 04, 2016 4:39 pm

Hi

I've loaded the new preview version but I don't see the new embedded SVG's? Is there anything else I need to do to activate them?

I have another question too. I want to create SVG's per type like we do for dump1090 etc and I would like to see a small (1 or 2 a/c) example of how to code the custom plugin as I'm just missing something on this thread please.

Thanks

agw
Posts: 1883
Joined: Fri Feb 17, 2012 3:20 am

Re: 27th Oct 2016 SVG graphics and .NET 4.6

Postby agw » Sun Nov 06, 2016 1:51 am

dsfh2992 wrote:What sort of reduction in CPU utilization would we expect to see with this preview version vs. 2.4.0 for a site with tons of viewers?


I'm not sure :) You should certainly see a lot less bandwidth consumed by images.


Return to “Preview Versions”

Who is online

Users browsing this forum: No registered users and 1 guest