Recent

Author Topic: Visual PlanIt Overlay mode  (Read 18060 times)

chrv

  • New Member
  • *
  • Posts: 32
Visual PlanIt Overlay mode
« on: December 03, 2021, 10:54:56 am »
Hello everyone,

I'm trying to understand how "Overlay mode" works in Visual PlanIt.
I have read the wiki carefully but I cannot figure out how to activate this "Overlay mode".

In the attached zip, I made a prototype. Could someone modify this example so that "Overlay mode" can be activated.

Thank you

wp

  • Hero Member
  • *****
  • Posts: 9570
Re: Visual PlanIt Overlay mode
« Reply #1 on: December 03, 2021, 05:43:18 pm »
It looks as if grouping of resources has only be implemented for datastores based on databases, but not for datastores based on flat files.

Please give me some time to add this.
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

chrv

  • New Member
  • *
  • Posts: 32
Re: Visual PlanIt Overlay mode
« Reply #2 on: December 03, 2021, 05:57:39 pm »
In fact, i am interested in SQLite. I used XML as an example. I will check now with SQLinte.
Thank you.

wp

  • Hero Member
  • *****
  • Posts: 9570
Re: Visual PlanIt Overlay mode
« Reply #3 on: December 03, 2021, 06:36:08 pm »
SQLite3 should work, I tested it. The sample code in the wiki, however, is a bit imprecise because it uses constant ids for the resources to be merged, better to specify them as parameters:
Code: Pascal  [Select][+][-]
  1. procedure TMainForm.CreateResourceGroup(AResourceIDs: array of Integer; AGroupName: String = '');
  2. var
  3.   datastore: TVpCustomDatastore;
  4.   grp: TVpResourceGroup;
  5. begin
  6.   datastore := VpControlLink1.Datastore;
  7.   grp := datastore.Resources.AddResourceGroup(AResourceIDs, AGroupName);
  8.   grp.ReadOnly := true;
  9.   grp.Pattern := opDiagCross;
  10.   if datastore.Resource <> nil then
  11.     datastore.Resource.Group := grp
  12.   else
  13.     datastore.Resource.Group := nil;
  14.   datastore.RefreshEvents;  // or: datastore.UpdateGroupEvents;
  15. end;

So, when you want to overlay the second and third resources into the first resource shown in the resource combobox you should call it like this:
Code: Pascal  [Select][+][-]
  1. var
  2.   parentRes: Integer;
  3.   overlaidRes1: Integer;
  4.   overlaidRes2: Integer;
  5. ...
  6.   parentRes := datastore.Resources.Items[0];
  7.   overlaidRes1 := datastore.Resources.Items[1];
  8.   overlaidRes2 := datastore.Resources.Items[2];
  9.   CreateResourceGroup([parentRes, overlaidRes1, overlaidRes2]);
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

chrv

  • New Member
  • *
  • Posts: 32
Re: Visual PlanIt Overlay mode
« Reply #4 on: December 04, 2021, 12:06:53 pm »
Thank you very much: it works
minor fix:
Code: Pascal  [Select][+][-]
  1. aParentRes: = VpSqlite3Datastore1.Resources.Items [0].ResourceID

Can I still ask:
- how do I "deoverlay" the view.

Thank you for helping me

wp

  • Hero Member
  • *****
  • Posts: 9570
Re: Visual PlanIt Overlay mode
« Reply #5 on: December 04, 2021, 08:16:04 pm »
I added another way to tvplanit trunk how to create a resource group which is clearer and more flexible in my opinion: TVpResource.OverlayResources(AResources, ACaption). AResources is an array of the resource instances to be overlaid (not the resource ids any more!), and ACaption is an optional name for the resource group. When AResources is nil then resourcegroup assigned to the currently selected resource is removed. Unlike the old method, the resource to which the other resource are added must not be contained in AResources any more.

Code: Pascal  [Select][+][-]
  1.  type TVpResource = class(...)
  2.    function OverlayResources(const AResources: TVpResourceArray;  ACaption: String = ''): TVpResourceGroup;
  3.  

This code is working in your second demo project correctly for me:
Code: Pascal  [Select][+][-]
  1. procedure TForm1.CheckBox1Change(Sender: TObject);
  2. var
  3.   aParentRes: TVpResource;
  4.   aOverlaidRes: TvpResourceArray = nil;
  5. begin
  6.   aParentRes := VpSqlite3Datastore1.Resources.Items[0];
  7.   if CheckBox1.Checked then
  8.   begin
  9.     SetLength(aOverlaidRes, 2);
  10.     aOverlaidRes[0] := VpSqlite3Datastore1.Resources.Items[1];
  11.     aOverlaidRes[1] := VpSqlite3Datastore1.Resources.Items[2];
  12.     aParentRes.OverlayResources(aOverlaidRes);
  13.   end else
  14.     aParentRes.OverlayResources(nil);
  15. end;

I also extended the FullDemo project of the tvplanit installation by a possibility to select from a TCheckListbox the resources to be overlaid.
« Last Edit: December 04, 2021, 09:55:52 pm by wp »
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

chrv

  • New Member
  • *
  • Posts: 32
Re: Visual PlanIt Overlay mode
« Reply #6 on: December 06, 2021, 09:14:48 pm »
I tested your demo on trunk.
Everything seems to word as expected.
I will try to test my app on this version

Many thanks

wp

  • Hero Member
  • *****
  • Posts: 9570
Re: Visual PlanIt Overlay mode
« Reply #7 on: December 07, 2021, 12:16:32 am »
The wiki article about overlaid events (https://wiki.freepascal.org/Turbopower_Visual_PlanIt#Overlaying_events) has been updated to document the TVpResource.OverlayResources method.

And the flat-file datastores (xml, ini, json) have been extended to support resource groups as well.
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

chrv

  • New Member
  • *
  • Posts: 32
Re: Visual PlanIt Overlay mode
« Reply #8 on: December 08, 2021, 12:13:34 pm »
How is it possible to update Visual PlanIt from Online Package Manager. Is Visual PlanIt uptodate on OPM ?

Thank you ?

wp

  • Hero Member
  • *****
  • Posts: 9570
Re: Visual PlanIt Overlay mode
« Reply #9 on: December 08, 2021, 12:17:18 pm »
This new code is not yet available via OPM. You should either get the svn version from CCR, or download the zip-snapshot from https://sourceforge.net/p/lazarus-ccr/svn/HEAD/tree/components/tvplanit/.
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

chrv

  • New Member
  • *
  • Posts: 32
Re: Visual PlanIt Overlay mode
« Reply #10 on: December 13, 2021, 05:27:12 pm »
Hello everyone,

I just did a simple test for PlanIt (see attachment, requires trunk version).
Everything goes well until I place 2 events in exactly the same place (same date and same time but with different "Description") => often (but not always) 1 of the 2 events disappears (only one event is visible).
The same appears with Overlay.
What am i missing ?
(you can use drag and drop to move events easily)

Thank you

wp

  • Hero Member
  • *****
  • Posts: 9570
Re: Visual PlanIt Overlay mode
« Reply #11 on: December 14, 2021, 10:59:10 am »
The overlapping "same" events issue should be fixed now. It was caused by the typical "don't do this with floating point values" mistake: do not compare floats by using the = operator, but allow for a tolerance due to round-off errors.

There is still an issue with drag and drop: When I add the first event to a new database and drag the event to another time slot the event is not deleted from the original time slot.
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

chrv

  • New Member
  • *
  • Posts: 32
Re: Visual PlanIt Overlay mode
« Reply #12 on: December 14, 2021, 02:04:19 pm »
I reinstalled the packege (r8177). Unfortunately, the same problem seems to persit unchanged on my test app.

wp

  • Hero Member
  • *****
  • Posts: 9570
Re: Visual PlanIt Overlay mode
« Reply #13 on: December 14, 2021, 06:37:25 pm »
Found another location which compares times using the >= and <= operators --> fixed. I do not see the disappearing "same" events any more, even when resources are overlaid.

If you still see the issue please give a description of the exact steps that I have to follow..
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

chrv

  • New Member
  • *
  • Posts: 32
Re: Visual PlanIt Overlay mode
« Reply #14 on: December 15, 2021, 10:04:08 am »
I send you an exemple (See attached app).

Event2 dragged on Event3 => OK
Event2 dragged on Event1 => Event2 disappears under Event1.

 

TinyPortal © 2005-2018