Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
jpsacha committed Apr 27, 2019
2 parents a5c2700 + 72309a2 commit 104b68d
Show file tree
Hide file tree
Showing 126 changed files with 753 additions and 665 deletions.
37 changes: 24 additions & 13 deletions FlyCapture2-demo/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,25 @@
import sbt.Keys._

name := "FlyCapture2-demo"
version := "1.3.6"
version := "1.5"

scalaVersion := "2.12.7"
scalaVersion := "2.12.8"

// Platform classifier for native library dependencies
lazy val platform = org.bytedeco.javacpp.Loader.getPlatform

// @formatter:off
val commonSettings = Seq(
scalaVersion := "2.12.7",
scalaVersion := "2.12.8",
scalacOptions ++= Seq("-unchecked", "-deprecation", "-Xlint", "-explaintypes"),
// Some dependencies like `javacpp` are packaged with maven-plugin packaging
classpathTypes += "maven-plugin",
libraryDependencies ++= Seq(
"org.bytedeco.javacpp-presets" % "flycapture" % "2.11.3.121-1.4.3" classifier "",
"org.bytedeco.javacpp-presets" % "flycapture" % "2.11.3.121-1.4.3" classifier platform,
"log4j" % "log4j" % "1.2.17",
"org.scala-lang" % "scala-reflect" % scalaVersion.value,
"org.scala-lang.modules" %% "scala-parser-combinators" % "1.1.1",
"org.bytedeco" % "flycapture" % "2.13.3.31-1.5" classifier "",
"org.bytedeco" % "flycapture" % "2.13.3.31-1.5" classifier platform,
"log4j" % "log4j" % "1.2.17",
"org.scala-lang" % "scala-reflect" % scalaVersion.value,
"org.scala-lang.modules" %% "scala-parser-combinators" % "1.1.2",
),
resolvers ++= Seq(
// Resolver.sonatypeRepo("snapshots"),
Expand All @@ -35,15 +35,26 @@ val commonSettings = Seq(
javaOptions += "-Xmx1G"
)

// Determine OS version of JavaFX binaries
lazy val osName = System.getProperty("os.name") match {
case n if n.startsWith("Linux") => "linux"
case n if n.startsWith("Mac") => "mac"
case n if n.startsWith("Windows") => "win"
case _ => throw new Exception("Unknown platform!")
}

lazy val javaFXModules = Seq("base", "controls", "fxml", "graphics", "media", "swing", "web")

val uiSettings = commonSettings ++ Seq(
libraryDependencies ++= Seq(
"org.clapper" %% "grizzled-slf4j" % "1.3.2",
"org.slf4j" % "slf4j-api" % "1.7.25",
"org.slf4j" % "slf4j-log4j12" % "1.7.25",
"org.scalafx" %% "scalafx" % "8.0.181-R13",
"org.clapper" %% "grizzled-slf4j" % "1.3.3",
"org.slf4j" % "slf4j-api" % "1.7.26",
"org.slf4j" % "slf4j-log4j12" % "1.7.26",
"org.scalafx" %% "scalafx" % "11-R16",
"org.scalafx" %% "scalafxml-core-sfx8" % "0.4",
"org.scalafx" %% "scalafx-extras" % "0.2.0"
"org.scalafx" %% "scalafx-extras" % "0.3.0"
),
libraryDependencies ++= javaFXModules.map(m => "org.openjfx" % s"javafx-$m" % "11.0.2" classifier osName),
addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.1" cross CrossVersion.full)
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/*
* Copyright (c) 2011-2014 Jarek Sacha. All Rights Reserved.
* Copyright (c) 2011-2019 Jarek Sacha. All Rights Reserved.
*
* Author's e-mail: jpsacha at gmail.com
*/

package flycapture

import org.bytedeco.javacpp.FlyCapture2.Error
import org.bytedeco.flycapture.FlyCapture2.Error

import scala.collection.mutable
import scala.language.experimental.macros
Expand Down Expand Up @@ -139,7 +139,7 @@ class CheckMacro(val c: blackbox.Context) {
val result =
q"""
..${tempVars.map(_.decl)}
if( $transformed.GetType() != org.bytedeco.javacpp.FlyCapture2.PGRERROR_OK ) {
if( $transformed.GetType() != org.bytedeco.flycapture.global.FlyCapture2.PGRERROR_OK ) {
val errorDesc = $transformed.GetDescription().getString
val printedCode = ${show(expr)}
val printedValues = List(..${tempVars.map(_.debug)})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/*
* Copyright (c) 2014 Jarek Sacha. All Rights Reserved.
* Copyright (c) 2011-2019 Jarek Sacha. All Rights Reserved.
*
* Author's e-mail: jpsacha at gmail.com
*/
package flycapture.examples.cpp

import org.bytedeco.javacpp.FlyCapture2.Error
import org.bytedeco.flycapture.FlyCapture2._

class FC2Exception(message: String, val error: Error) extends Exception(message: String)
Original file line number Diff line number Diff line change
@@ -1,29 +1,26 @@
/*
* Copyright (c) 2014 Jarek Sacha. All Rights Reserved.
* Copyright (c) 2011-2019 Jarek Sacha. All Rights Reserved.
*
* Author's e-mail: jpsacha at gmail.com
*/

package flycapture.examples.cpp

import flycapture.CheckMacro._
import org.bytedeco.flycapture.FlyCapture2._
import org.bytedeco.flycapture.global.FlyCapture2._
import org.bytedeco.javacpp
import org.bytedeco.javacpp.FlyCapture2._
import org.bytedeco.javacpp.{FloatPointer, IntPointer}

/**
* Some helper methods extracted from FlyCapture2 SDK sample application.
* Arguments and return values and input arguments are modified to fit Scala style.
* Method names correspond to the original names
*
* @author Jarek Sacha
*/
* Some helper methods extracted from FlyCapture2 SDK sample application.
* Arguments and return values and input arguments are modified to fit Scala style.
* Method names correspond to the original names
*
* @author Jarek Sacha
*/
object FC2Utils {

case class Dimension(rows: Int, columns: Int)

case class ResolutionAndPixelFormat(rows: Int, columns: Int, pixelFormat: Int)

def getCamResolutionAndPixelFormat(camera: CameraBase): ResolutionAndPixelFormat = {

// get the current source-image settings
Expand Down Expand Up @@ -100,7 +97,6 @@ object FC2Utils {
case _ => None
}


private def getDimensionsFromVideoMode(videoMode: Int): Option[Dimension] = videoMode match {
case VIDEOMODE_160x120YUV444 =>
Some(Dimension(columns = 160, rows = 120))
Expand All @@ -120,4 +116,8 @@ object FC2Utils {
case _ =>
None
}

case class Dimension(rows: Int, columns: Int)

case class ResolutionAndPixelFormat(rows: Int, columns: Int, pixelFormat: Int)
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
/*
* Copyright (c) 2014 Jarek Sacha. All Rights Reserved.
* Copyright (c) 2011-2019 Jarek Sacha. All Rights Reserved.
*
* Author's e-mail: jpsacha at gmail.com
*/

package flycapture.examples.cpp.snap

import org.bytedeco.javacpp.FlyCapture2.CameraBase

import scala.reflect.runtime.universe.typeOf
import org.bytedeco.flycapture.FlyCapture2._
import scalafx.scene.Parent
import scalafx.stage.Stage

import scala.reflect.runtime.universe.typeOf

/**
* Create camera configuration UI.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
/*
* Copyright (c) 2014 Jarek Sacha. All Rights Reserved.
* Copyright (c) 2011-2019 Jarek Sacha. All Rights Reserved.
*
* Author's e-mail: jpsacha at gmail.com
*/

package flycapture.examples.cpp.snap

import java.util.concurrent.atomic.AtomicBoolean
import javafx.{concurrent => jfxc}

import flycapture.CheckMacro.check
import flycapture.examples.cpp.FC2Exception
import org.bytedeco.javacpp.FlyCapture2._
import javafx.{concurrent => jfxc}
import org.bytedeco.flycapture.FlyCapture2._
import org.bytedeco.flycapture.global.FlyCapture2._
import org.bytedeco.javacpp.IntPointer

import scalafx.Includes._
import scalafx.beans.property.{BooleanProperty, ObjectProperty}
import scalafx.geometry.Pos
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
/*
* Copyright (c) 2014 Jarek Sacha. All Rights Reserved.
* Copyright (c) 2011-2019 Jarek Sacha. All Rights Reserved.
*
* Author's e-mail: jpsacha at gmail.com
*/

package flycapture.examples.cpp.snap

import flycapture.examples.cpp.snap.CameraConfigurationModel.TestPattern

import scalafx.Includes._
import scalafx.scene.control.{CheckBox, RadioButton, ToggleGroup}
import scalafx.scene.layout.GridPane
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
/*
* Copyright (c) 2014 Jarek Sacha. All Rights Reserved.
* Copyright (c) 2011-2019 Jarek Sacha. All Rights Reserved.
*
* Author's e-mail: jpsacha at gmail.com
*/

package flycapture.examples.cpp.snap

import org.bytedeco.javacpp.FlyCapture2.{CameraInfo, PGRGuid}
import org.bytedeco.flycapture.FlyCapture2._

/**
* Basic camera information.
*
* @author Jarek Sacha
*/
* Basic camera information.
*
* @author Jarek Sacha
*/
case class CameraID(guid: PGRGuid, cameraInfo: CameraInfo) {
override def toString = s"#${cameraInfo.serialNumber} (${cameraInfo.modelName.getString})"
}
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
/*
* Copyright (c) 2014 Jarek Sacha. All Rights Reserved.
* Copyright (c) 2011-2019 Jarek Sacha. All Rights Reserved.
*
* Author's e-mail: jpsacha at gmail.com
*/

package flycapture.examples.cpp.snap

import javafx.scene.control.MultipleSelectionModel

import flycapture.CheckMacro.check
import grizzled.slf4j.Logger
import org.bytedeco.javacpp.FlyCapture2._

import javafx.scene.control.MultipleSelectionModel
import org.bytedeco.flycapture.FlyCapture2._
import scalafx.Includes._
import scalafx.beans.property.{IntegerProperty, ObjectProperty, StringProperty}
import scalafx.collections.ObservableBuffer
import scalafx.event.subscriptions.Subscription

/**
* Model for camera selection UI.
*
* @author Jarek Sacha
*/
* Model for camera selection UI.
*
* @author Jarek Sacha
*/
class CameraSelectionModel(busManager: BusManager) {

// TODO automatically update list of cameras when cameras are connected/disconnected
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
/*
* Copyright (c) 2014 Jarek Sacha. All Rights Reserved.
* Copyright (c) 2011-2019 Jarek Sacha. All Rights Reserved.
*
* Author's e-mail: jpsacha at gmail.com
*/

package flycapture.examples.cpp.snap

import javafx.beans.{binding => jfxbb}

import scalafx.Includes._
import scalafx.scene.control._
import scalafxml.core.macros.sfxml
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014 Jarek Sacha. All Rights Reserved.
* Copyright (c) 2011-2019 Jarek Sacha. All Rights Reserved.
*
* Author's e-mail: jpsacha at gmail.com
*/
Expand All @@ -10,15 +10,15 @@ import java.io.IOException

import grizzled.slf4j.Logger
import org.apache.log4j.Level

import scala.reflect.runtime.universe.typeOf
import scalafx.Includes._
import scalafx.application.JFXApp.PrimaryStage
import scalafx.application.{JFXApp, Platform}
import scalafx.scene.Scene
import scalafx.scene.image.Image
import scalafxml.core.{DependenciesByType, FXMLView}

import scala.reflect.runtime.universe.typeOf

/**
* `FlyCaptureSnapApp` starts the FlyCaptureSnap application.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014 Jarek Sacha. All Rights Reserved.
* Copyright (c) 2011-2019 Jarek Sacha. All Rights Reserved.
*
* Author's e-mail: jpsacha at gmail.com
*/
Expand All @@ -8,16 +8,15 @@ package flycapture.examples.cpp.snap

import java.io.{File, IOException}
import java.util.concurrent.locks.ReentrantReadWriteLock
import javafx.{concurrent => jfxc}

import flycapture.CheckMacro.check
import flycapture.examples.cpp.FC2Exception
import flycapture.examples.cpp.FC2Utils._
import grizzled.slf4j.Logger
import org.bytedeco.javacpp.FlyCapture2._
import javafx.{concurrent => jfxc}
import org.bytedeco.flycapture.FlyCapture2._
import org.bytedeco.flycapture.global.FlyCapture2._
import org.bytedeco.javacpp.{IntPointer, Pointer}

import scala.reflect.runtime.universe.typeOf
import scalafx.Includes._
import scalafx.application.Platform
import scalafx.beans.property.{BooleanProperty, ObjectProperty, StringProperty}
Expand All @@ -32,6 +31,8 @@ import scalafx.stage.{FileChooser, Stage}
import scalafx.util.Duration
import scalafxml.core.{DependenciesByType, FXMLView}

import scala.reflect.runtime.universe.typeOf

object SnapModel {


Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014 Jarek Sacha. All Rights Reserved.
* Copyright (c) 2011-2019 Jarek Sacha. All Rights Reserved.
*
* Author's e-mail: jpsacha at gmail.com
*/
Expand All @@ -11,8 +11,6 @@ import java.util.concurrent

import grizzled.slf4j.Logger
import org.apache.log4j.{BasicConfigurator, Level}

import scala.reflect.runtime.universe._
import scalafx.Includes._
import scalafx.application.Platform
import scalafx.scene.Parent
Expand All @@ -22,6 +20,8 @@ import scalafx.scene.layout.{GridPane, Priority}
import scalafx.stage.Window
import scalafxml.core.{DependenciesByType, FXMLView}

import scala.reflect.runtime.universe._

/**
* @author Jarek Sacha
*/
Expand Down
Loading

0 comments on commit 104b68d

Please sign in to comment.