Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Misc additions #4

Merged
merged 3 commits into from

2 participants

@oliv3

start_link/0, start_link/1
oriented/2
stroke dotted style

@krestenkrab krestenkrab merged commit 644fd01 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 2, 2014
  1. @oliv3

    Add oriented/2

    oliv3 authored
  2. @oliv3

    Add start_link/0, start_link/1

    oliv3 authored
  3. @oliv3

    Add stroke dotted style

    oliv3 authored
This page is out of date. Refresh to see the latest.
Showing with 15 additions and 7 deletions.
  1. +10 −4 src/erlubi.erl
  2. +5 −3 src/erlubi_edge.erl
View
14 src/erlubi.erl
@@ -25,7 +25,7 @@
-behaviour(gen_server).
-export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, code_change/3]).
--export([start/0, start/1, call/2, callv/2, stop/0]).
+-export([start/0, start/1, start_link/0, start_link/1, call/2, callv/2, stop/0]).
-export([clear/0, vertex/0, edge/2,
remove_vertex/1, remove_edge/1]).
@@ -44,7 +44,13 @@ start() ->
start("127.0.0.1").
start(Host) ->
- gen_server:start({local, ?MODULE}, ?MODULE, [Host,20738], []).
+ gen_server:start({local, ?MODULE}, ?MODULE, [Host, 20738], []).
+
+start_link() ->
+ start_link("127.0.0.1").
+
+start_link(Host) ->
+ gen_server:start_link({local, ?MODULE}, ?MODULE, [Host, 20738], []).
call(Method,Args) ->
case gen_server:call(?MODULE, {call, Method, Args}, 10000) of
@@ -88,8 +94,8 @@ remove_edge({erlubi_edge, E}) ->
%% Server implementation, a.k.a.: callbacks
init([Host,Port]) ->
- io:format("init", []),
- {ok, #state{ host=Host, port=Port }}.
+ %% io:format("init", []),
+ {ok, #state{ host=Host, port=Port }}.
handle_call(stop, _From, State) ->
{stop, normal, stopped, State};
View
8 src/erlubi_edge.erl
@@ -24,6 +24,7 @@
-export([new/1, id/1]).
-export([remove/1, arrow/2, arrow_position/2, spline/2, stroke/2, visible/2]).
+-export([oriented/2]).
new(ID) ->
{?MODULE, [ID]}.
@@ -55,12 +56,13 @@ stroke(solid, {?MODULE, [_ID]}=THIS) ->
set("stroke", "solid", THIS);
stroke(dashed, {?MODULE, [_ID]}=THIS) ->
set("stroke", "dashed", THIS);
+stroke(dotted, {?MODULE, [_ID]}=THIS) ->
+ set("stroke", "dotted", THIS);
stroke(none, {?MODULE, [_ID]}=THIS) ->
set("stroke", "none", THIS).
visible(Boolean, {?MODULE, [_ID]}=THIS) when is_boolean(Boolean) ->
set("visible", Boolean, THIS).
-
-
-
+oriented(Boolean, {?MODULE, [_ID]}=THIS) when is_boolean(Boolean) ->
+ set("oriented", Boolean, THIS).
Something went wrong with that request. Please try again.