Git Product home page Git Product logo

ppt_renderer's Introduction

Project Status

Continuous Build Status

New in Debrief

Supported by

The development of Debrief has been supported by Oxygen XML

Oxygen Logo

The development of Debrief has also been supported by the YourKit Java Profiler

YourKit Logo

ppt_renderer's People

Contributors

ianmayo avatar purvil12c avatar saulhidalgoaular avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ppt_renderer's Issues

Script to change color of animated item

We will change the color of the marker to match that in my application.

So, we need a script that will take R,G,B integers, and set the marker to that color.

Time label in plot

We need to show the current time in the plot.

We'll do this by having a series of animated text boxes, that appear over each other, in a particular location.

We'll change the donor slide, so that it has a rectangular shape, titled "time".

We'll parse the times in the GPX tracks, to get Python time values. Then we'll format the time to hh:MM:ss and put those values into duplicates of the text box.

Create base line using coordinates

In addition to the moving marker, we draw a line that shows the route.

This means the marker will move along the route.

Could you:

  • insert a PowerPoint shape that represents a freehand line
  • simplify the OOXML for this line down to a few coordinates
  • create a script to parse the attached GPX file
  • create a script to use our set of coordinates for this line . Note: the attached file has two tracks, so we'll have to make a copy of the line.
  • change the color of the line to match the color in the GPX file

Note: I'm pretty sure the line will use a different coordinate space to the animation path.

Note: I've considered the projection issue, in #9

Note: the coordinate systems are discussed in this article: https://startbigthinksmall.wordpress.com/2010/01/04/points-inches-and-emus-measuring-units-in-office-open-xml/

Growing track

We currently show the full track, with a marker moving along it.

An analyst has asked if it's possible for the track to grow as time moves forward.

Could you reduce a scenario down to, say, 5 positions, then see if it's possible to build up the track live?

I think the animated path will remain unchanged. We'll be changing the single solid line into a series of "appear" animations for circle objects - at the time intervals we've used for the animation.

The probable strategy for this is to start with an empty presentation. Create it, and save it.

Use the python unpack script to unpack it into a folder.

Then, make a copy of the pptx file. Open it in PowerPoint and create an animation of a series of circles appearing, one per second. Save and close.

Use the python unpack script to unpack this new version.

Use some app to compare the two slide1.xml files. The changed XML is what is needed for the new animation.

The master template file will have to be modified to introduce the new circle marker. Edit the slide1.xml for the master template to give the element id as "footprint".

Then, modify the Python script so that:

  • we no longer create the static line (track object)
  • we now create the series of animated points (using the coordinates that were used to create the track object). The timing of the animation should be the same as is used for the callout movement.
  • this animation will probably have to run in parallel with the moving callout

Handle re-projecting coordinates into rectangle

Our rectangle looks like this:
screen shot 2018-06-14 at 16 10 39

So, we have the offset (location) of the top-left corner, plus it's height and width.

We'll have to use these values to shift our coordinates to the right place inside the rectangle.

I think it will be something like this:

function intoRectangle(width, height, x, y, rectX, rectY, rectWid, rectHeight)
{
  newX = rectX +  x * (rectWid / width) 
  newY = rectY + y * (rectHeight / height)
}

Here is a spreadsheet that validates the above algorithm.

Put track name in callout

#11 covers the correct way to position a callout, so that the arrow points at the current position.

I'd like you to experiment with putting the track name (trimmed to 4 characters) into the callout, please.

That means we'll have a callout with the name of the track moving along the animated line.

This will avoid the requirement to have a key on the diagram.

Separate task

I have a folder of images (attached).

I need the images renamed, so they contain a date. The date should be in this format:

yyyymmdd_hhmmss.jpg

The first image needs to be at 19951212_093600

Then each image needs to be 20 seconds later. There are 215 images, so the last image will be about an hour after the first one.

I also require a less dense version of the data. So, we only rename every 5th file, and they're 1 minute 40 seconds apart. So, we have fewer images, but they still cover the same time period.

The output of the task will be two zip-files of images - one detailed, the other less detailed. The first file will be named . 19951212_093600.jpg . The last image will be named something like 19951212_103420.jpg

honolulu engagment.zip

Document XML in usage

Somewhere I need to produce technical documentation for the XML that we use.

@purvil12c is the natural person to capture this.

So, @purvil12c - could you create a wiki page in this repo that will act as a reference for the XML we're expecting, together with examples.

It should also document what we use to represent the dynamic aspects.

Remember - GitHub has formatting options for presenting raw code.

Some earlier thoughts are captured here: debrief/debrief#2903

Scaling factor in animated path

The animated path should be scaled to fit into the rectangle.

But, we're currently hard-coding the scaling factor & offset.

We need to generate those values using the plot area & rectangle dimensions

Create "donor" slide

We could do with a correctly formatted slide, to base our work on.

It should have:

  • a fill rectangle shape, called "map"
  • a freehand line, called "track"
  • a circle shape, called "marker". This shape will have a freehand path animation

We should:

  • For the shapes above (line and animation path) we just need, say, 3 coordinates - to keep the file small/simple.
  • Try to remove as many other features from the slide1.xml as possible, without breaking the slide. We certainly don't need all those "cxnlist" elements.

So, please create the above - probably by starting in PPT, then unpacking and editing the XML

Handle change of speed of travel for tracks

Our marker moves along the track at a uniform speed.

In real life, the ship may change speed during the time period. When it is travelling faster, the marker should be moving along the line faster.

Here are possible ways of solving it.

  1. Generate the track as a series of segments of steady speed. If the vessel speed changes more than, say 0.1 kts from the previous step, start a new segment. Python will then generate multiple animations to represent these different time periods. The animation duration will match the relative duration of that segment.

  2. Generate the track like we do now. Generate a new animation for each coordinate. So, for each coordinate we do "move to" last coord, then "line to" this coord. We should experiment with finding out if this causes performance problem or fragility.

Find/interrogate target rectangle

We're going to draw the tracks into a user-supplied rectangle.

So, re-name the rectangle to "map".

Then experiment with producing a script that retrieves (and outputs) the location and dimensions of the map component.

Note: as part of this task, we should rename the rectangle in the XML file. It should be renamed as "map". So, in the future, the slide may contain a range of rectangles/shapes - but it's the "map" rectangle that we know we're drawing into.

Simplify path element

The custom path is currently a complex set of coordinates.

Remove as much as possible from the path element

Issue with callout offset

The track name callouts are slightly offset - it looks like they're 20 pixels away to the north-west.

Video here: https://youtu.be/lf7kFJBlGd4

It looks like the offset remains fairly steady during the run . That suggests it's not about scaling, but a start point.

Good luck with it :-)

Make callouts the same color as the track

Each callout should have some formatting to show which track it's attached to.

Having a solid fill in the relevant color seems a bit overkills.

I suggest the following formatting:

  • solid background fill, in very light grey
  • track name in black text
  • callout "line" is 3px weight, in track color

Learn about origin of motion path

I created a Callout shape on a slide. Then I produced an custom path for it to follow:
image

I expected the callout to follow the path.

But, when the animation starts, the callout shape jumps down before it starts moving along the path (possibly so it's centred over the path). This means the pointer at the bottom of the callout isn't pointing at the line. Clearly the anchor for the animation is the centre of the callout. Not the geometric centre, but the centre of the text-area for the call-out.

I've found that I have to move the motion path up to the centre of the shape for the Callout shape to follow the correct route:
image

We need to learn about this. We may need to determine the dimensions of the callout, in order to apply the correct offset.

Hmm, I think this data may give the offset to the centre of the shape:
image

Show scrolling/appearing diary entries

We have observers that watch the wargames, and capture what is happening. The diary is called a narrative, and each observation is called an entry.

We'd like these messages to appear in the export. I've created two test files that include narrative data, in the file-level extensions object.

I'd appreciate you using a trick like the time-box to show these. But, it will have to be a larger box, and it doesn't appear on a regular interval.

Please create a new text box on the slide, called "narrative". We'll duplicate that.

IIRC, the times are specified in milliseconds. If I've done my maths right, the elapsed value for each Entry is in millis from the start of the simulation run.

If it's better to provide them in elapsed millis since the previous one, I can change it to doing that.

Avoid generating corrupt XML

Unfortunately our Python processing is resulting in a PPTX that PowerPoint says is corrupt, and has to fix.

This doesn't look professional.

So, we need to either find a way to prevent the problem arising, or to find a way to fix the corrupted file before we save it. (The first option is my favourite).

We need to be able to do a round-trip (unpack file, make change to slide1.xml, repack file) without PowerPoint thinking it's corrupt.

Find XML schema for PPTX

  • Find an schema for PPTX, hopefully around 2010 version.
  • Develop script to validate (test) our modified PPTX against this schema.
  • Call validation script as part of "pack" operation. Fail (with clear warning) if validation fails.

Insert set of coordinates for animation

Here are two sets of coordinates. Experiment with inserting them.

The outer rectangle is 800 wide by 600 tall.

These coordinates will have to be scaled to match the size of the rectangle that will contain them.

Here are the coordinates for the path.
A: 100,100 200,100, 300,200 450,300 400,250 350,200
B: 300,300 250,250 200,250 150,150 130,120 140,150 160,140

** UPDATE ** . I've attached a file containing coordinates to be used, please.

Seeing this PPT running will be a Huge Milestone. I'll be excited to show it to my users.

Note: we can move the coordinates into a structured format, if you like. You could wrap them in XML, if you wish.

** Note 2:** here is a spreadsheet that includes the transforms necessary to move from Debrief screen coordinates to PowerPoint coordinates

Steps:

  • retrieve the size of the whole presentation (presentation.xml)
  • retrieve the size of the rectangle
  • use the coordinate transform function to get the rectangle TL & BR in 0..1 animation units (see below)
  • Use the new TL & BR to get the origin and dimensions of the rectangle
  • Use the origin and dimensions to calculate the screen coords (from GPX) in animation units

rectangle coords in animation dimensions

TL =  coordinateTransformation(mapX, mapY, mapCX, mapCY, 0, 0, 1, 1)
BR = coordinateTransformation(mapX + mapCX, mapY + mapCY, mapCX, mapCY, 0, 0, 1, 1)

rectangle represented as animated target values

animX = TL.x
animY = TL.y
animCX = BR.x - TL.x
animCY = BT.y - TL.y

Now loop through coordinates with:
(x,y) = coordinateTransform(x, y, dimensionWidth, dimensionHeight, animX, animY, animCX, animCY)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.